Your IP : 18.227.140.235


Current Path : /var/www/u0635749/data/www/hobbyclick.ru/hobbyclick.ru/www/hobbyclick/local/ajax/
Upload File :
Current File : /var/www/u0635749/data/www/hobbyclick.ru/hobbyclick.ru/www/hobbyclick/local/ajax/order.php

<?php
use \Bitrix\Sale;

require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");

$request = \Bitrix\Main\Context::getCurrent()->getRequest();

if (!$request->isAjaxRequest() || !$request->isPost() || (int) $request->getPost('element') < 1) {
    die();
}

$element = (int) $request->getPost('element');

\Bitrix\Main\Loader::includeModule('sale');

$basket = Sale\Basket::loadItemsForFUser(Sale\Fuser::getId(), Bitrix\Main\Context::getCurrent()->getSite());

$item = $basket->createItem('catalog', $element);
$item->setFields(array(
    'QUANTITY' => 1,
    'CURRENCY' => Bitrix\Currency\CurrencyManager::getBaseCurrency(),
    'LID' => Bitrix\Main\Context::getCurrent()->getSite(),
    'PRODUCT_PROVIDER_CLASS' => 'CCatalogProductProvider',
));

$basket->save();



$APPLICATION->IncludeComponent(
    "meven:order-one-click",
    "",
    array(),
    false
);