Всем привет! Верстаю карточку товара и делюсь опытом
Сегодня сделал автогенерацию текста из артикула, цены, скидки, и имени товара.
Примерно так:

- <?php
- $nomercat = $item->getElement('d60e15cc-e340-4666-a748-9ee970bf3f5a')->data();
- $nomercat = $this->app->data->create($nomercat);
- $nomercat = $nomercat->find('0.value', 'Уточняйте по телефону');
- $priceget = $item->getElement('f4483451-befa-4f92-b5bf-e2e9c3e90283')->data()->variations;
- $priceget = $this->app->data->create($priceget);
- $skuitem = $priceget->find('0._sku.value', 'Артикул не найден');
- $finddiscount = $priceget->find('0._discount.value', '');
- $priceget = $priceget->find('0._value.value', 'Уточняйте по телефону');
- $pricegetround = round($priceget,0);
- if (!empty($finddiscount) && $priceget) {
- if (preg_match('/\%/',$finddiscount)) {
- $finddiscount = str_replace('%','',$finddiscount);
- $getpricewithdiscount = round($priceget - ($priceget * ($finddiscount / 100)),0);
- }
- else {
- $getpricewithdiscount = round($priceget - ($priceget * ($finddiscount / 100)),0);
- }
- }
- else {
- $getpricewithdiscount = $priceget;
- }
- ?>
- <p>
- <?php echo $item->name ?> за <?php echo $getpricewithdiscount ?> руб. устанавливается на тягачи и самосвалы ОАО КамАЗ.
- Номер детали по каталогу: <?php echo $nomercat ?> / артикул: <?php echo $skuitem ?>.
- <p> Мы являемся ведущим поставщиков з/ч КамАЗ в Камском регионе и г. Набережные Челны.
- </p>