Last active
November 30, 2016 10:52
-
-
Save saiik/60212a240e37049daf4572da3b336b47 to your computer and use it in GitHub Desktop.
Add & delete Shopware Attributes using the new CRUD feature
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $attr = Shopware()->Container()->get("shopware_attribute.crud_service"); | |
| $attr->update( | |
| "attributes_table", | |
| 'your_field_name', | |
| 'field_type', | |
| [ | |
| 'label' => 'Display Label', | |
| 'displayInBackend' => true, | |
| 'position' => 1 | |
| ] | |
| ); | |
| $meta = Shopware()->Models()->getConfiguration()->getMetadataCacheImpl(); | |
| $meta->deleteAll(); | |
| Shopware()->Models()->generateAttributeModels( | |
| ['attributes_table'] | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $attr = Shopware()->Container()->get('shopware_attribute.crud_service'); | |
| $attr->delete( | |
| 'attributes_table', | |
| 'your_field' | |
| ); | |
| $meta = Shopware()->Models()->getConfiguration()->getMetadataCacheImpl(); | |
| $meta->deleteAll(); | |
| Shopware()->Models()->generateAttributeModels( | |
| ['attributes_table'] | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment