Вот упрощенный пример добавления веса товара к сниппету “Таблица товаров” (products_table)
app/addons/my_changes/schemas/snippets/order_products_table.post.php
<?php
$schema['product_extended'] = array(
'class' => '\Tygh\Template\Document\Variables\GenericVariable',
'data' => function (\Tygh\Template\Snippet\Table\ItemContext $context) {
$product = $context->getItem();
$product_extended['weight'] = db_get_field('SELECT weight FROM ?:products WHERE product_id =?i', $product['product_id']);
$product_extended['weight'] = round($data['weight'],1). ' кг';
return $product_extended;
},
'arguments' => array('#context', '#config', '@formatter'),
'attributes' => array(
'weight'
)
);
return $schema;