D
D
Dmitry Grabko2017-04-12 17:34:29
1C-Bitrix
Dmitry Grabko, 2017-04-12 17:34:29

How to display the unit of measurement of a product in Bitrix?

Greetings, I'm just starting to learn Bitrix, I ran into a problem.
In the product catalog, the unit of measure of the product is displayed statically through the template:

<span class="product-item-price product-item-price-right">
      за шт.<br>
      <b><?=$arItem["PRICES"]["розничная"]["VALUE"]?> Р</b> 
    </span>

The "Unit" value is filled in the trade catalog:
213112dfe18743149725a0aae30c0f5b.png
How to automatically substitute the value from the trade catalog instead of the static one. What should be included in the template?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Sintsov, 2018-10-03
@romiras_spb

I am not a deep connoisseur of Bitrix, but I would do it like this:

<span class="product-item-price product-item-price-right">
      за шт.<br>
      <?$defaultMeasure = \CCatalogMeasure::getDefaultMeasure(true, true);?>
      <b><?=$arItem["PRICES"]["розничная"]["VALUE"]?> <?=$defaultMeasure['SYMBOL_RUS']?></b> 
    </span>

K
KimonoVIP, 2018-12-22
@KimonoVIP

$item_measure = $arResult['OFFERS'][0]['ITEM_MEASURE']['TITLE'];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question