Hi!
In case of email notification documents, you will need to extend the default \Tygh\Template\Snippet\Table\ProductVariable
class. For this, you will have to create the post schema for this one:
app/schemas/snippets/order_products_table.php
There you will have to specify your own class that will handle the product variable used in the snippet.
The fastest way is to extend the mentioned class, so all you will have to add in your new one is the new public public property of this class, which have to contain value from the $this->product['variation_features']
. It will be an array with the list of product features on which this product’s variations are based. For example:
array (
549 =>
array (
'feature_id' => '549',
'feature_style' => 'dropdown_images',
'position' => '10',
'purpose' => 'group_catalog_item',
'display_on_catalog' => 'Y',
'description' => 'Color',
'internal_name' => 'Color',
'prefix' => '',
'suffix' => '',
'purpose_position' => '0',
'product_feature_purpose' => 'group_catalog_item',
'variant' => 'Blue',
'variant_id' => '1199',
'variant_position' => '2',
),
548 =>
array (
'feature_id' => '548',
'feature_style' => 'dropdown_labels',
'position' => '20',
'purpose' => 'group_variation_catalog_item',
'display_on_catalog' => 'Y',
'description' => 'Size',
'internal_name' => 'Size',
'prefix' => '',
'suffix' => '',
'purpose_position' => '1',
'product_feature_purpose' => 'group_variation_catalog_item',
'variant' => 'Medium',
'variant_id' => '1195',
'variant_position' => '3',
),
)
so you will be able to access them using twig’s for
operator to iterate through its elements and, for example print the description and variant elements.
Also don’t forget to add the new property to the list of available ones in the attributes
method of this class.
You can also check this part of our documentation for some examples:
I hope it will help you.