Answer the question
In order to leave comments, you need to log in
Bitrix. How to change the price of an item in the cart to your own?
Good afternoon.
There is a product, a calculator for choosing additional options is written on the detailed card.
When buying, accordingly, the cost of options is not applied, but remains basic.
How can I change the base price to the price that was calculated on the detailed one?
I watched this guide , method 3. But I didn’t understand where to insert this code?
Thank you.
Answer the question
In order to leave comments, you need to log in
Instruction is correct
In init.php
1. Inherit your Provider
class CCatalogProductProviderCustom extends CCatalogProductProvider
{
public static function GetProductData($arParams)
{
//Чтобы не переписывать всю логику наследуемся от родителя
$arResult = parent::GetProductData($arParams);
//Ниже описываем свою логику подменяем данные в $arResult
return $arResult;
}
}
AddEventHandler('sale', 'OnSaleBasketItemRefreshData', 'BeforeBasketAddHandler');
function BeforeBasketAddHandler($BasketItem)
{
$BasketItem->setField("PRODUCT_PROVIDER_CLASS", "CCatalogProductProviderCustom");
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question