$arLocation = \Bitrix\Sale\Location\LocationTable::getByCode($locationId)->fetch();
$propertyCollection = $order->getPropertyCollection();
$locationProperty = $propertyCollection->getDeliveryLocation();
$locationProperty->setValue($arLocation["CODE"]);
// $zipProperty = $propertyCollection->getDeliveryLocationZip();
//$zipProperty->setValue("101000");
// по ID LOCATION в свойствах заказа
$somePropValue = $propertyCollection->getItemByOrderPropertyId(4);
// пробую установить
$somePropValue->setValue("101000");
<?
$products = [1 => ["id" => 226256, "quantity" => 1]];
// есть код местоположения, Москва
$locationId = '0000073738';
// офорлеем
$siteId = Context::getCurrent()->getSite();
$currencyCode = CurrencyManager::getBaseCurrency();
// содаем корзину
$basket = Bitrix\Sale\Basket::create($siteId);
foreach ($products as $product) {
$item = $basket->createItem('catalog', $product['id']);
unset($product["id"]);
$item->setFields([
'QUANTITY' => $product['quantity'],
'CURRENCY' => \Bitrix\Currency\CurrencyManager::getBaseCurrency(),
'LID' => \Bitrix\Main\Context::getCurrent()->getSite(),
'PRODUCT_PROVIDER_CLASS' => 'CCatalogProductProvider',
'WEIGHT' => 5000,
]);
}
// пока пишем тестового пользвателя
$order = Bitrix\Sale\Order::create($siteId, 67020);
$order->setPersonTypeId(1);
$order->setBasket($basket);
// дополняем заказ метоположением заказа
$arLocation = \Bitrix\Sale\Location\LocationTable::getByCode($locationId)->fetch();
$propertyCollection = $order->getPropertyCollection();
$locationProperty = $propertyCollection->getDeliveryLocation();
$locationProperty->setValue($arLocation["CODE"]);
$zipProperty = $propertyCollection->getDeliveryLocationZip();
$zipProperty->setValue("101000");
// Создаём одну отгрузку и получаем доставки
$shipmentCollection = $order->getShipmentCollection();
$shipment = $shipmentCollection->createItem();
$shipmentItemCollection = $shipment->getShipmentItemCollection();
$shipment->setField('CURRENCY', $order->getCurrency());
foreach ($order->getBasket() as $item) {
$shipmentItem = $shipmentItemCollection->createItem($item);
$shipmentItem->setQuantity($item->getQuantity());
}
//проверка доступности отгрузки и получение списка доставок
$mode = \Bitrix\Sale\Services\Base\RestrictionManager::MODE_CLIENT;
$deliveryList = \Bitrix\Sale\Delivery\Services\Manager::getRestrictedList($shipment, $mode);
$resultDelivery = [];
$restrictionParams = ['ID' => 'ID'];
// дополнительно фильтрую отгрузки по доступности города
foreach ($deliveryList as $delivery) {
if (Bitrix\Sale\Delivery\Restrictions\ByLocation::check($locationId, $restrictionParams, $delivery['ID'])) {
$resultDelivery[] = $delivery;
echo "<br>";
print_r($delivery);
}
}
?>
$zipProperty = $propertyCollection->getDeliveryLocationZip();
$zipProperty->setValue("101000");
onfailure: function (data, response) {
console.log(response.data);
Фильтр а фильтре? копия свойства для чего?
В фильтре есть не активные элементы, их нужно скрыть.