Answer the question
In order to leave comments, you need to log in
Why are PROPS carts reset after ajax request in Bitrix?
There is an event that transfers the PROPS values to the basket, the trouble is that if you change the quantity in the basket, then these values \u200b\u200bfly off and put absolutely incomprehensible and where they came from too
AddEventHandler("sale", "OnBeforeBasketAdd", "OnBeforePresentToBasket");
function OnBeforePresentToBasket(&$arFields)
{
if(CModule::IncludeModule("iblock"))
{
$arFilter = array("IBLOCK_ID" => 17, 'ID' => $arFields['PRODUCT_ID']);
$arSelect = array('IBLOCK_ID',"ID","PROPERTY_SVOISTVO1","PROPERTY_SVOISTVO1");
$rsElement = CIBlockElement::GetList(array('SORT' => 'ASC'), $arFilter, false, false, $arSelect);
if ($arElement = $rsElement->GetNext())
{
$arFields['PROPS'][] = array(
'NAME' => "Свойство 1",
'CODE' => "SVOISTVO1",
'VALUE' => $arElement["PROPERTY_SVOISTVO1_VALUE"],
'SORT' => 0
);
$arFields['PROPS']['1'] = array(
'NAME' => "Свойство 2",
'CODE' => "SVOISTVO2",
'VALUE' => $arElement["PROPERTY_SVOISTVO2_VALUE"],
'SORT' => 1
);
}
}
return;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question