Одностраничный компонент отображает список товаров на разных яхыках, отправленных пользователем в корзину.
class.php
Подробнее можно озакомиться на странице официальной документации.
В компоненте изменены следующие файлы:class.php
Code
Copy code
Code copied!
//Изменено подключение класса use Modulemarket\Translator\Highloadblock as HL;
Code
Copy code
Code copied!
//Выполнено подключение самого модуля:
Loader::includeModule("modulemarket.translator");
Code
Copy code
Code copied!
// В функции добавлена строка кода \Modulemarket\Translator\Basket\BasketClass::translateResult($result);
protected function getBasketResult()
{
$result = [];
$result['GRID']['HEADERS'] = $this->getGridColumns();
if ($this->isCompatibleMode())
{
$result['GRID']['ROWS'] = $this->getGridRows();
}
if (!$this->isBasketIntegrated())
{
$result += $this->getBasketTotal();
$result += $this->getCouponInfo();
if ($this->usePrepayment === 'Y' && (float)$result['allSum'] > 0)
{
$result += $this->getPrepayment();
}
}
$result += $this->getErrors();
$result['BASKET_ITEMS_COUNT'] = $this->storage['BASKET_ITEMS_COUNT'];
$result['ORDERABLE_BASKET_ITEMS_COUNT'] = $this->storage['ORDERABLE_BASKET_ITEMS_COUNT'];
$result['NOT_AVAILABLE_BASKET_ITEMS_COUNT'] = $this->storage['NOT_AVAILABLE_BASKET_ITEMS_COUNT'];
$result['DELAYED_BASKET_ITEMS_COUNT'] = $this->storage['DELAYED_BASKET_ITEMS_COUNT'];
$result['BASKET_ITEM_MAX_COUNT_EXCEEDED'] = $this->basketItemsMaxCountExceeded();
$result['EVENT_ONCHANGE_ON_START'] = $this->isNeedBasketUpdateEvent();
$result['CURRENCIES'] = $this->getFormatCurrencies();
$this->applyTemplateMutator($result);
\Modulemarket\Translator\Basket\BasketClass::translateResult($result); // Фантич 01.07.2022
return $result;
}
Code
Copy code
Code copied!
//изменена часть функции getSkuPropsData
while ($arData = $rsData->fetch())
{
HL\HighLoadBlockTable::RenameRowKeys($arData); $arValues['n'.$arData['ID']] = [
'ID' => $arData['ID'],
'NAME' => $arData['UF_NAME'],
'SORT' => (int)$arData['UF_SORT'],
'FILE' => $arData['UF_FILE'],
'PICT' => false,
'XML_ID' => $arData['UF_XML_ID'],
];
}
Code
Copy code
Code copied!
//Адаптирована функция loadBasketItems
protected function loadBasketItems($itemsToLoad = null)
{
if ($this->isFastLoadRequest())
{
$this->basketItems = $this->getBasketItemsRawArray();
}
else
{
$this->basketItems = $this->getBasketItemsArray($itemsToLoad);
}
//edit_by_Fantych: 15.08.2023
foreach ($this->basketItems as &$Item)
{
if ($arRes = \FCIBlockElement::GetByID($Item["PRODUCT_ID"])->GetNextElement())
{
$fields = $arRes->GetFields();
$Item["~NAME"] = $fields["~NAME"] ? $fields["~NAME"] : $fields["NAME"];
$Item["NAME"] = $fields["NAME"] ? $fields["NAME"] : $fields["~NAME"];
$properties = $arRes->GetProperties();
// PROPS
foreach ($Item["PROPS"] as &$prop)
{
if(isset($properties[$prop["CODE"]]))
{
$prop["~NAME"] = $properties[$prop["CODE"]]["~NAME"] ? $properties[$prop["CODE"]]["~NAME"] : $prop["~NAME"];
$prop["NAME"] = $properties[$prop["CODE"]]["NAME"] ? $properties[$prop["CODE"]]["NAME"] : $prop["NAME"];
$prop["~VALUE"] = $properties[$prop["CODE"]]["~VALUE"] ? $properties[$prop["CODE"]]["~VALUE"] : $prop["~VALUE"];
$prop["VALUE"] = $properties[$prop["CODE"]]["VALUE"] ? $properties[$prop["CODE"]]["VALUE"] : $prop["VALUE"];
}
}
unset($prop);
// PROPS_ALL
foreach ($Item["PROPS_ALL"] as &$prop)
{
if(isset($properties[$prop["CODE"]]))
{
$prop["NAME"] = $properties[$prop["CODE"]]["NAME"] ? $properties[$prop["CODE"]]["NAME"] : $prop["NAME"];
$prop["VALUE"] = $properties[$prop["CODE"]]["VALUE"] ? $properties[$prop["CODE"]]["VALUE"] : $prop["VALUE"];
}
}
unset($prop);
}
}
unset($Item);
if (!empty($this->basketItems))
{
$this->loadCatalogInfo();
$this->loadIblockProperties();
if (self::includeCatalog())
{
$this->basketItems = $this->getSkuPropsData($this->basketItems, $this->storage['PARENTS'], $this->offersProps);
}
}
}
Количество показов: 674
Дата изменения: 18.09.2023 07:55:56