Answer the question
In order to leave comments, you need to log in
Why aren't cart item properties set?
\Bitrix\Main\Loader::includeModule('catalog');
$res = Add2BasketByProductID($id, 1, array(), array(
array(
array("NAME"=>"Shelovek", "CODE"=>"CHEL", "VALUE"=>"1"),
array("NAME" => "Цвет", "CODE" => "CLR", "VALUE" => "красный"),
array("NAME" => "Размер", "VALUE" => "25"),
)
));
if($res !== false)
$response = array('bool' => true, 'cnt' => getProductsCount());
$db_res = CSaleBasket::GetPropsList(
array(
"SORT" => "ASC",
"NAME" => "ASC"
),
array("BASKET_ID" => $product["ID"])
);
while ($ar_res = $db_res->Fetch())
{
echo $ar_res["NAME"]."=".$ar_res["VALUE"]."<br>";
}
Answer the question
In order to leave comments, you need to log in
Judging by the code, you are passing in the filter of the CSaleBasket::GetPropsList method in BASKET_ID not the ID of the basket item, but the ID of the item. As a result, nothing is returned. In the filter, in the BASKET_ID key, it is necessary to pass exactly the ID of the basket element.
In general, I would advise you to do everything on D7. Here there are many examples implemented on D7, including working with a basket.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question