M
M
mirexdoors2018-10-16 11:50:27
1C-Bitrix
mirexdoors, 2018-10-16 11:50:27

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

2 answer(s)
E
eternalfire, 2018-10-16
@eternalfire

can you do it in/php_interface/init.php

AddEventHandler("sale", "OnSaleComponentOrderOneStepOrderProps", "OnSaleComponentOrderOneStepOrderProps");
function OnSaleComponentOrderOneStepOrderProps(&$arResult, &$arUserResult, &$arParams)
{
    $arUserResult['DELIVERY_LOCATION'] = 269; // id Санкт-Петербурга
}

M
mirexdoors, 2018-10-16
@mirexdoors

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 question

Ask a Question

731 491 924 answers to any question