Export Attributes
The bundle offers a service to format the attributes and attribute values into the necessary format for the twocream Shopware Connector Bundle
.
The service must be obtained via dependency injection; it is important that the Asset Helper for the project implements the interface Twocream\ProductAttributeBundle\Components\Export\Helper\AssetHelperInterface
.
Product Attribute Service
Class
Twocream\ProductAttributeBundle\Components\Export\Service\ProductAttributeService
Method prepareAttribute
This method formats an attribute object into an array.
Name | Value |
---|---|
Function | prepareAttribute(Concrete $attribute): ?array |
Argument $attribute | Attribute object that should be formatted |
Return value | Array with attribute data under the following keys:'id', 'uuid', 'identifier', 'quantity-value-default', 'show-on-filter', 'show-on-detail', 'attribute-type', 'sort-type', 'position', 'attribute-name', 'attribute-description', 'attribute-locations' |
Method prepareAttributeValue
This method formats an attribute value object into an array.
Name | Value |
---|---|
Function | prepareAttributeValue(Concrete $attributeValue, AssetHelperInterface $assetHelper, array $valueThumbnails, bool $exportArticleAssignment, string $articleNumberField): ?array |
Argument $attributeValue | Attribute value object that should be formatted |
Argument $assetHelper | Asset helper for copying assets, which implements the Asset Helper interface See Asset Helper Interface |
(Optional) Argument $valueThumbnails | Array of thumbnails to be generated |
(Optional) Argument $exportArticleAssignment | If true , the return array includes 'article-assignments' with the IDs of the linked objects; default is true |
(Optional) Argument $articleNumberField | Name of the ID field in the product class used for article links, default is 'articleNumber' |
Return value | Array with attribute value data under the following keys:'id', 'uuid', 'identifier', 'attribute-id', 'attribute-uuid', 'quantity-value', 'position', 'value', 'color', 'image' |
Method getArticleAssignmentByProductId
This method returns the IDs and UUIDs of all attribute values that have a link to a specific data object.
Name | Value |
---|---|
Function | getArticleAssignmentByProductId(DataObject\Listing\Concrete $listing, int $productId): array |
Argument $listing | Listing of the attribute value class |
Argument $productId | ID of the object for which the function should find the linked attribute values |
Return value | Array with the IDs and UUIDs of the linked attribute values; each array entry follows this format:['id' => 123, 'uuid' => 123] |
Asset Helper Interface
Twocream\ProductAttributeBundle\Components\Export\Helper\AssetHelperInterface
This method serves to export the images of the attribute values. Within the twocream Shopware Connector Bundle
, there is an abstract logic that handles the storage of these images.
It is important that this interface is implemented in the project-specific Asset Helper.