Answer the question
In order to leave comments, you need to log in
How to automatically change the price when changing / loading a product in 1s-Bitrix?
Good day
, When importing goods from 1C to 1C-Bitrix, it is necessary to rewrite the price something like this: $arFields['PRICE']=$arFields['PRICE']/100*110;
in init.php I threw an event (I found a similar one on the forum),
<?
AddEventHandler("catalog", "OnBeforePriceUpdate", array("MyClass", "OnBeforePriceUpdateHandler"));
class MyClass
{
function OnBeforePriceUpdateHandler($PRICE_ID, $arFields)
{
$db_price = CPrice::GetList(
array(),
array(
"ID" => $PRICE_ID
)
);
if($ar_price = $db_price->Fetch())
{
if($ar_price['PRICE'] != $arFields['PRICE'])
{
$arFields['PRICE']=$arFields['PRICE']/100*110;
}
}
}
}
Answer the question
In order to leave comments, you need to log in
Read the documentation, you are using
AddEventHandler("iblock", "OnBeforeIBlockElementUpdate", Array("MyClass", "OnBeforeIBlockElementUpdateHandler"));
First you use OnBeforeIBlockElementUpdate, in this event there is no PRICE field, secondly
you pass Array("MyClass", "OnBeforeIBlockElementUpdateHandler"));
You don't have such function in your class, you have OnBeforePriceUpdateHandler Related
link
dev.1c-bitrix.ru/support/forum/forum6/topic47042
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question