bitrix:sale.basket.basket

Одностраничный компонент отображает список товаров на разных яхыках, отправленных пользователем в корзину.

Подробнее можно озакомиться на  странице официальной документации.

В компоненте изменены следующие файлы:

class.php
Code Copy code Code copied!
1
2
//Изменено подключение класса
use Modulemarket\Translator\Highloadblock as HL;
Code Copy code Code copied!
1
2
//Выполнено подключение самого модуля:
Loader::includeModule("modulemarket.translator"); 
Code Copy code Code copied!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// В функции добавлена строка кода \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!
1
2
3
4
5
6
7
8
9
10
11
12
//изменена часть функции 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!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//Адаптирована функция 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);
      }
   }
}

Количество показов: 333
Дата изменения: 18.09.2023 07:55:56