$basket = \Bitrix\Sale\Basket::create('s3');
$basket = $basket->getOrderableItems();
foreach ($basket as $item) {
$item->getItemById($id)->delete();
}
$item = $basket->createItem("catalog", $id);
$item->setFields(array(
'PRODUCT_ID' => $id,
'CURRENCY' => 'RUB',
'QUANTITY' => $quantity,
'LID' => SITE_ID,
'PRODUCT_PROVIDER_CLASS' => '\CCatalogProductProvider'
));
// order
$order = \Bitrix\Sale\Order::create(SITE_ID, $USER->isAuthorized() ? $USER->GetID() : $ID);
$order->setPersonTypeId(5);
$order->setBasket($basket);
//shippment collection
$shipColl = $order->getShipmentCollection();
$shipp = $shipColl->createItem(\Bitrix\Sale\Delivery\Services\Manager::getObjectById(1));
$shipColl = $shipp->getShipmentItemCollection();
foreach ($basket as $basketItem) {
$item = $shipColl->createItem($basketItem);
$item->setQuantity($basketItem->getQuantity());
}
//props
$propsColl = $order->getPropertyCollection();
$order->setField('COMMENTS', 'Это быстрый заказ. Нужно перезвонить клиенту.');
$phoneProp = $propsColl->getPhone();
$phoneProp->setValue($phone);
$nameProp = $propsColl->getProfileName();
$nameProp->setValue($name);
$emailProp = $propsColl->getUserEmail();
$emailProp->setValue($email);
// pay
$payColl = $order->getPaymentCollection();
$payment = $payColl->createItem(\Bitrix\Sale\PaySystem\Manager::getObjectById(13));
$payment->setField("SUM", $order->getPrice());
$payment->setField("CURRENCY", $order->getCurrency());
//save
$order->save();
.row {
display: none;
}
$(document).ready(function() {
$('#one_click_buy').submit(function(e) {
e.preventDefault();
$.ajax({
type: "POST",
url: 'component_folder/ajax.php',
dataType: "json",
data: {'id': <?= $arResult['PRODUCT_ID'] ?>},
success: function(response)
{
$('#OneBuyClickRX').modal('hide');
$('#ordersuccess').modal('show');
}
});
});
});
json_decode($id);
foreach ($arResult as $arItem)
if ($arItem['DETAIL_IMAGE']['NAME'] == '000.jpg') {
$arParams['ACTIVE'] == 'N';
}