A
A
Alexander2021-07-26 12:05:37
1C-Bitrix
Alexander, 2021-07-26 12:05:37

How to write an additional item in the JCCatalogItem array of a product card? price?

The site has 2 prices.
Goods and their TPs also have 2 prices.

Need to push two prices into the JCCatalogItem.currentPrices array?
So that when changing the TP I could manipulate prices, or maybe there is some other solution and someone implemented it? share your experience

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
PetrPo, 2021-07-26
@PetrPo

You can add a parameter to the catalog.section call , then the ITEM_ALL_PRICES key will be added to $arResult, it will contain all prices. In the catalog.item template in template.php, at the very end, the $jsParams array is formed, where there is a line before it for the TP, in $item['JS_OFFERS'] you can either add your key and write $item['ITEM_ALL_PRICES '] and shovel all the js - or if you need prices directly in JCCatalogItem.currentPrices, then something like this'FILL_ITEM_ALL_PRICES' => 'Y'

foreach($item['JS_OFFERS'] as $key => &$offer) {
  $offer['ITEM_PRICES'] = $item['OFFERS'][$key]['ITEM_ALL_PRICES'];
}
unset($offer);

though js will still have to be edited, but not as much as in the first version

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question