Answer the question
In order to leave comments, you need to log in
Passing product properties to cart D7 how to solve wiping problem?
Hello!
There is a problem with the new D7 kernel.
I have a property details in the product card.
The transfer of product properties to the basket is carried out in the following way:
$props = array();
$basketPropRes = Sale\Internals\BasketPropertyTable::getList(array(
'filter' => array(
"BASKET_ID" => $arBasket["ID"],
),
));
while ($property = $basketPropRes->fetch()) {
unset($property["BASKET_ID"]);
$props[] = $property;
}
$item = $basket->createItem('catalog', $_REQUEST["prod"]);
$basketPropertyCollection = $item->getPropertyCollection();
$basketPropertyCollection->setProperty($props);
$basketPropertyCollection->save();
Array
(
[0] => Array
(
[ID] => 279563
[NAME] => Склад
[VALUE] => 20
[CODE] => STORE
[SORT] => 100
)
[1] => Array
(
[ID] => 279564
[NAME] => Название склада
[VALUE] => Склад СПб Центральный
[CODE] => STORE_NAME
[SORT] => 100
)
[2] => Array
(
[ID] => 279565
[NAME] => Артикул
[VALUE] => 327320097
[CODE] => CML2_ARTICLE
[SORT] => 100
)
[3] => Array
(
[ID] => 279566
[NAME] => Реквизиты
[VALUE] => Gerep
[CODE] => CML2_TRAITS
[SORT] => 100
)
[4] => Array
(
[ID] => 279567
[NAME] => Реквизиты
[VALUE] => a29c8f2f-b5b8-11e4-8e7b-00155dc0ba09
[CODE] => CML2_TRAITS
[SORT] => 100
)
[5] => Array
(
[ID] => 279568
[NAME] => Реквизиты
[VALUE] => Товар (пр. ТМЦ)
[CODE] => CML2_TRAITS
[SORT] => 100
)
[6] => Array
(
[ID] => 279569
[NAME] => Реквизиты
[VALUE] => Товар
[CODE] => CML2_TRAITS
[SORT] => 100
)
)
dump($basketPropertyCollection->getPropertyValues());
Array
(
[STORE] => Array
(
[CODE] => STORE
[ID] => 295667
[VALUE] => 20
[SORT] => 100
[NAME] => Склад
)
[STORE_NAME] => Array
(
[CODE] => STORE_NAME
[ID] => 295668
[VALUE] => Склад СПб Центральный
[SORT] => 100
[NAME] => Название склада
)
[CML2_ARTICLE] => Array
(
[CODE] => CML2_ARTICLE
[ID] => 295669
[VALUE] => 327320097
[SORT] => 100
[NAME] => Артикул
)
[CML2_TRAITS] => Array
(
[CODE] => CML2_TRAITS
[ID] => 295673
[VALUE] => Товар
[SORT] => 100
[NAME] => Реквизиты
)
)
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