<?
AddEventHandler("sale", "OnOrderUpdate", "OnOrderAddHandler");
function OnOrderAddHandler(&$ID, &$arFields) {
$dbItemsInOrder = CSaleBasket::GetList( array( "ID" => "ASC" ), array( "ORDER_ID" => intval($ID) ) );
while( $arItems = $dbItemsInOrder->Fetch() )
CIBlockElement::SetPropertyValueCode($arItems["PRODUCT_ID"], "status", array("VALUE"=>"6"));
}
AddEventHandler("sale", "OnSaleStatusOrder", "OnStatusChangeAddHandler");
function OnStatusChangeAddHandler(&$ID, &$val) {
if($val == "F"){
if(CModule::IncludeModule("iblock")){
$dbItemsInOrder = CSaleBasket::GetList( array( "ID" => "ASC" ), array( "ORDER_ID" => intval($ID) ) );
while( $arItems = $dbItemsInOrder->Fetch() )
CIBlockElement::SetPropertyValueCode($arItems["PRODUCT_ID"], "status", array("VALUE"=>"5"));
}
}
}
?>
|