Answer the question
In order to leave comments, you need to log in
How to change location in sale.order.ajax?
Hello!
It is necessary to change the location id on the checkout page (take it from cookies). How to do it right?
Answer the question
In order to leave comments, you need to log in
can you do it in/php_interface/init.php
AddEventHandler("sale", "OnSaleComponentOrderOneStepOrderProps", "OnSaleComponentOrderOneStepOrderProps");
function OnSaleComponentOrderOneStepOrderProps(&$arResult, &$arUserResult, &$arParams)
{
$arUserResult['DELIVERY_LOCATION'] = 269; // id Санкт-Петербурга
}
const PROP_LOCATION = 6;
const PROP_ZIP = 4;
const PROP_LOCATION_NAME = 5;
static function OnSaleComponentOrderProperties(&$arFields)
{
$rsLocaction = CSaleLocation::GetLocationZIP($_COOKIE['cityId']);
$arLocation = $rsLocaction->Fetch();
$arFields['ORDER_PROP'][self::PROP_ZIP] = $arLocation['ZIP'];
$arFields['ORDER_PROP'][self::PROP_LOCATION_NAME] = $_COOKIE['userCity'];
$arFields['ORDER_PROP'][self::PROP_LOCATION] = CSaleLocation::getLocationCODEbyID($_COOKIE['cityId']);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question