<commit_before><?php
namespace Notagency\Components;

\CBitrixComponent::includeComponentClass('notagency:materials.list');

class CatalogList extends MaterialsList
{
    protected $needModules = [
        'iblock',
        'catalog',
    ];

    protected function processElement($element)
    {
        $element = parent::processElement($element);
        $element = $this->processAmount($element);
        $element = $this->processPrice($element);
        return $element;
    }

    protected function processAmount($element)
    {
        $product = \CCatalogProduct::GetByID($element['ID']);
        $element['QUANTITY'] = $product['QUANTITY'];
        return $element;
    }

    protected function processPrice($element)
    {
        $element['CATALOG_DETAILS'] = \CCatalogProduct::GetOptimalPrice($element['ID']);
        $element['PRICE_FORMATTED'] = $this->formatPrice($element['CATALOG_DETAILS']['PRICE']['PRICE']);
        return $element;
    }

    protected function formatPrice($price)
    {
        $price = \CCurrencyLang::CurrencyFormat($price, 'RUB', false);
        return $price;
    }
}<commit_msg>Update class.php<commit_after><?php
namespace Notagency\Components;

\CBitrixComponent::includeComponentClass('notagency:materials.list');

class CatalogList extends MaterialsList
{
    protected $needModules = [
        'iblock',
        'catalog',
    ];

    protected function processElement($element)
    {
        $element = parent::processElement($element);
        $element = $this->processAmount($element);
        $element = $this->processPrice($element);
        return $element;
    }

    protected function processAmount($element)
    {
        $product = \CCatalogProduct::GetByID($element['ID']);
        $element['QUANTITY'] = $product['QUANTITY'];

        if (empty($product['MEASURE'])) {
            $arDefaultMeasure = \CIBlockPriceTools::GetDefaultMeasure();
            $element['CATALOG_MEASURE_NAME'] = $arDefaultMeasure['SYMBOL_RUS'];
        } else {
            $rsMeasures = \CCatalogMeasure::getList(false, array('ID' => $product['MEASURE']));
            if ($arMeasure = $rsMeasures->GetNext()) {
                $element['CATALOG_MEASURE_NAME'] = $arMeasure['SYMBOL_RUS'];
            }
        }
        return $element;
    }

    protected function processPrice($element)
    {
        $element['CATALOG_DETAILS'] = \CCatalogProduct::GetOptimalPrice($element['ID']);
        $element['PRICE_FORMATTED'] = $this->formatPrice($element['CATALOG_DETAILS']['PRICE']['PRICE'], $element['CATALOG_DETAILS']['PRICE']['CURRENCY'], true);
        return $element;
    }

    protected function formatPrice($price, $currency = 'RUB', $useTemplate = false)
    {
        $price = \CCurrencyLang::CurrencyFormat($price, $currency, $useTemplate);
        return $price;
    }
}
{'fraction_non_alphanumeric': 0.15166548547129696, 'fraction_numerical': 0.0, 'mean_word_length': 3.349768875192604, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1785033', 'n_tokens_mistral': 831, 'n_tokens_neox': 809, 'n_words': 123}