本文整理汇总了PHP中CSaleBasket::OrderBasket方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleBasket::OrderBasket方法的具体用法?PHP CSaleBasket::OrderBasket怎么用?PHP CSaleBasket::OrderBasket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleBasket
的用法示例。
在下文中一共展示了CSaleBasket::OrderBasket方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
}
if ('' == $errorMessage) {
$arAdditionalFields = array("LID" => SITE_ID, "STATUS_ID" => "N", "PAYED" => "N", "CANCELED" => "N", "USER_DESCRIPTION" => $ORDER_DESCRIPTION);
$affiliateID = CSaleAffiliate::GetAffiliate();
if ($affiliateID > 0) {
$dbAffiliat = CSaleAffiliate::GetList(array(), array("SITE_ID" => SITE_ID, "ID" => $affiliateID));
$arAffiliates = $dbAffiliat->Fetch();
if (count($arAffiliates) > 1) {
$arAdditionalFields["AFFILIATE_ID"] = $affiliateID;
}
} else {
$arAdditionalFields["AFFILIATE_ID"] = false;
}
$ORDER_ID = CSaleOrder::DoSaveOrder($arBasketItems, $arAdditionalFields, 0, $arErrors);
if ($ORDER_ID > 0 && empty($arErrors)) {
CSaleBasket::OrderBasket($ORDER_ID, CSaleBasket::GetBasketUserID(), SITE_ID, false);
/*send mail order*/
$strOrderList = "";
foreach ($arBasketItems["BASKET_ITEMS"] as $val) {
if (CSaleBasketHelper::isSetItem($val)) {
continue;
}
$strOrderList .= $val["NAME"] . " - " . $val["QUANTITY"] . " " . GetMessage("SOA_SHT") . ": " . SaleFormatCurrency($val["PRICE"], $arBasketItems["CURRENCY"]);
$strOrderList .= "\n";
}
$arFields = array("ORDER_ID" => $ORDER_ID, "ORDER_DATE" => Date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT", SITE_ID))), "ORDER_USER" => strlen($payerName) > 0 ? $payerName : $USER->GetFullName(), "PRICE" => SaleFormatCurrency($arBasketItems["PRICE"], $arBasketItems["CURRENCY"]), "BCC" => COption::GetOptionString("sale", "order_email", "order@" . $SERVER_NAME), "EMAIL" => strlen($payerEMail) > 0 ? $payerEMail : $USER->GetEmail(), "ORDER_LIST" => $strOrderList, "SALE_EMAIL" => COption::GetOptionString("sale", "order_email", "order@" . $SERVER_NAME), "DELIVERY_PRICE" => $arBasketItems["PRICE_DELIVERY"]);
$eventName = "SALE_NEW_ORDER";
$bSend = true;
foreach (GetModuleEvents("sale", "OnOrderNewSendEmail", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($ORDER_ID, &$eventName, &$arFields)) === false) {
$bSend = false;
示例2: list
if ($arBasket['CATALOG_XML_ID'] != '' && strpos($arBasket['CATALOG_XML_ID'], '@') !== false) {
list($amount, $curr) = explode('@', $arBasket['CATALOG_XML_ID']);
if ($curr == $arResult['REQUEST_ACCOUNT']) {
CSaleBasket::Delete($arBasket['ID']);
}
}
}
if ($arParams['PAY_IMMED']) {
CSaleBasket::DeleteAll(CSaleBasket::GetBasketUserID());
}
CSaleBasket::Add(array('PRODUCT_ID' => $arResult['CURRENCIES'][$arResult['REQUEST_ACCOUNT']]['ID'], 'PRICE' => CCurrencyRates::ConvertCurrency($arResult['MONEY_OFF'], $arResult['REQUEST_ACCOUNT'], $arResult['LANG_CURRENCY']), 'CURRENCY' => $arResult['LANG_CURRENCY'], 'QUANTITY' => 1, 'LID' => LANG, 'DELAY' => 'N', 'CAN_BUY' => 'Y', 'NAME' => GetMessage('SPT_NAME_IN_CART', array('#VALUE#' => SaleFormatCurrency($arResult['REQUEST_AMOUNT'], $arResult['REQUEST_ACCOUNT']))), 'MODULE' => 'asd.money', 'DETAIL_PAGE_URL' => '', 'CATALOG_XML_ID' => $arResult['REQUEST_AMOUNT'] . '@' . $arResult['REQUEST_ACCOUNT']));
if ($arParams['PAY_IMMED']) {
$ORDER_ID = CSaleOrder::Add(array('LID' => SITE_ID, 'PERSON_TYPE_ID' => $arParams['PERSON_TYPE'], 'PRICE' => CCurrencyRates::ConvertCurrency($arResult['MONEY_OFF'], $arResult['REQUEST_ACCOUNT'], $arResult['LANG_CURRENCY']), 'CURRENCY' => $arResult['LANG_CURRENCY'], 'PAY_SYSTEM_ID' => $arResult['REQUEST_PAY_SYSTEM'], 'USER_ID' => $USER->getID()));
if ($ORDER_ID > 0) {
$arOrder = CSaleOrder::GetByID($ORDER_ID);
CSaleBasket::OrderBasket($ORDER_ID);
}
$arPaySysAction = $arResult['PAY_SYSTEMS'][$arResult['REQUEST_PAY_SYSTEM']];
if (strlen($arPaySysAction['ACTION_FILE']) > 0) {
CSalePaySystemAction::InitParamArrays($arOrder, $ORDER_ID, $arPaySysAction['PARAMS']);
$pathToAction = $_SERVER['DOCUMENT_ROOT'] . $arPaySysAction['ACTION_FILE'];
$pathToAction = rtrim(str_replace('\\', '/', $pathToAction), '/');
if (file_exists($pathToAction)) {
if (is_dir($pathToAction)) {
if (file_exists($pathToAction . '/payment.php')) {
include $pathToAction . '/payment.php';
}
} else {
include $pathToAction;
}
}
示例3: array
}
$affiliateID = CSaleAffiliate::GetAffiliate();
if ($affiliateID > 0) {
$dbAffiliat = CSaleAffiliate::GetList(array(), array("SITE_ID" => SITE_ID, "ID" => $affiliateID));
$arAffiliates = $dbAffiliat->Fetch();
if (count($arAffiliates) > 1) {
$arFields["AFFILIATE_ID"] = $affiliateID;
}
} else {
$arFields["AFFILIATE_ID"] = false;
}
$arResult["ORDER_ID"] = CSaleOrder::DoSaveOrder($arOrderDat, $arFields, 0, $arResult["ERROR"]);
$arResult["ORDER_ID"] = IntVal($arResult["ORDER_ID"]);
if ($arResult["ORDER_ID"] > 0 && empty($arResult["ERROR"])) {
$arOrder = CSaleOrder::GetByID($arResult["ORDER_ID"]);
CSaleBasket::OrderBasket($arResult["ORDER_ID"], CSaleBasket::GetBasketUserID(), SITE_ID, false);
$arResult["ACCOUNT_NUMBER"] = $arResult["ORDER_ID"] <= 0 ? $arResult["ORDER_ID"] : $arOrder["ACCOUNT_NUMBER"];
}
$withdrawSum = 0.0;
if (empty($arResult["ERROR"])) {
if ($arResult["PAY_FROM_ACCOUNT"] == "Y" && $arUserResult["PAY_CURRENT_ACCOUNT"] == "Y" && ($arParams["ONLY_FULL_PAY_FROM_ACCOUNT"] == "Y" && DoubleVal($arResult["USER_ACCOUNT"]["CURRENT_BUDGET"]) >= DoubleVal($orderTotalSum) || $arParams["ONLY_FULL_PAY_FROM_ACCOUNT"] != "Y")) {
$withdrawSum = CSaleUserAccount::Withdraw($USER->GetID(), $orderTotalSum, $arResult["BASE_LANG_CURRENCY"], $arResult["ORDER_ID"]);
if ($withdrawSum > 0) {
$arFields = array("SUM_PAID" => $withdrawSum, "USER_ID" => $USER->GetID());
CSaleOrder::Update($arResult["ORDER_ID"], $arFields);
if ($withdrawSum == $orderTotalSum) {
CSaleOrder::PayOrder($arResult["ORDER_ID"], "Y", False, False);
}
}
}
if ($arResult["HAVE_PREPAYMENT"]) {
示例4: array
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/include/prolog_before.php";
CModule::IncludeModule("sale");
if (isset($_GET['order_basket'])) {
$dbBasketItems = CSaleBasket::GetList(false, array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "LID" => SITE_ID, "ORDER_ID" => "NULL"), false, false, array("ID", "QUANTITY", "PRICE"));
$price = 0;
while ($item = $dbBasketItems->Fetch()) {
$price += intval($item['QUANTITY']) * $item['PRICE'];
}
$arFields = array("LID" => 's1', "PERSON_TYPE_ID" => 1, "PAYED" => "N", "CANCELED" => "N", "STATUS_ID" => "N", "PRICE" => $price, "CURRENCY" => "RUB", "USER_ID" => intval($USER->GetId()), "PAY_SYSTEM_ID" => 1, "USER_DESCRIPTION" => "");
$orderId = CSaleOrder::Add($arFields);
if (false === $orderId) {
return false;
}
$user = CUser::GetByID($USER->GetId())->Fetch();
$ar = array('ORDER_ID' => $orderId, 'ORDER_PROPS_ID' => 2, "NAME" => "Адрес доставки", "CODE" => "delivery_address", 'VALUE' => $user['PERSONAL_STREET']);
CSaleOrderPropsValue::Add($ar);
CSaleBasket::OrderBasket($orderId, $_SESSION["SALE_USER_ID"], SITE_ID);
$tmp = explode(',', $user['NAME']);
$eventFields = array('NAME' => $tmp[0], 'EMAIL' => $user['EMAIL']);
$eventName = $user['PERSONAL_CITY'] == 'Москва' ? 'NEW_ORDER_MOSCOW' : 'NEW_ORDER_RUSSIA';
CEvent::Send($eventName, 's1', $eventFields);
CEvent::Send('NEW_ORDER_ADMIN', 's1', array());
return true;
}
示例5: __MakeOrder
function __MakeOrder($prdCnt=1, $arData = Array())
{
global $APPLICATION, $USER, $DB;
CModule::IncludeModule("iblock");
CModule::IncludeModule("sale");
CModule::IncludeModule("catalog");
$arPrd = Array();
$dbItem = CIBlockElement::GetList(Array("PROPERTY_MORE_PHOTO" => "DESC", "ID" => "ASC"), Array("IBLOCK_TYPE" => "offers", "IBLOCK_SITE_ID" => WIZARD_SITE_ID, "PROPERTY_NEWPRODUCT" => false), false, Array("nTopCount" => 10), Array("ID", "IBLOCK_ID", "XML_ID", "NAME", "DETAIL_PAGE_URL", "IBLOCK_XML_ID"));
while($arItem = $dbItem->GetNext())
$arPrd[] = $arItem;
if(!empty($arPrd))
{
for($i=0; $i<$prdCnt;$i++)
{
$prdID = $arPrd[mt_rand(0, 9)];
$arProduct = CCatalogProduct::GetByID($prdID["ID"]);
$CALLBACK_FUNC = "";
$arCallbackPrice = CSaleBasket::ReReadPrice($CALLBACK_FUNC, "catalog", $prdID["ID"], 1);
$arFields = array(
"PRODUCT_ID" => $prdID["ID"],
"PRODUCT_PRICE_ID" => $arCallbackPrice["PRODUCT_PRICE_ID"],
"PRICE" => $arCallbackPrice["PRICE"],
"CURRENCY" => $arCallbackPrice["CURRENCY"],
"WEIGHT" => $arProduct["WEIGHT"],
"QUANTITY" => 1,
"LID" => WIZARD_SITE_ID,
"DELAY" => "N",
"CAN_BUY" => "Y",
"NAME" => $prdID["NAME"],
"CALLBACK_FUNC" => $CALLBACK_FUNC,
"MODULE" => "catalog",
"PRODUCT_PROVIDER_CLASS" => "CCatalogProductProvider",
"ORDER_CALLBACK_FUNC" => "",
"CANCEL_CALLBACK_FUNC" => "",
"PAY_CALLBACK_FUNC" => "",
"DETAIL_PAGE_URL" => $prdID["DETAIL_PAGE_URL"],
"CATALOG_XML_ID" => $prdID["IBLOCK_XML_ID"],
"PRODUCT_XML_ID" => $prdID["XML_ID"],
"VAT_RATE" => $arCallbackPrice['VAT_RATE'],
);
$addres = CSaleBasket::Add($arFields);
}
$arOrder = Array(
"LID" => $arData["SITE_ID"],
"PERSON_TYPE_ID" => $arData["PERSON_TYPE_ID"],
"PAYED" => "N",
"CANCELED" => "N",
"STATUS_ID" => "N",
"PRICE" => 1,
"CURRENCY" => $arData["CURRENCY"],
"USER_ID" => $arData["USER_ID"],
"PAY_SYSTEM_ID" => $arData["PAY_SYSTEM_ID"],
//"PRICE_DELIVERY" => $arData["PRICE_DELIVERY"],
//"DELIVERY_ID" => $arData["DELIVERY_ID"],
);
$dbFUserListTmp = CSaleUser::GetList(array("USER_ID" => $arData["USER_ID"]));
if(empty($dbFUserListTmp))
{
$arFields = array(
"=DATE_INSERT" => $DB->GetNowFunction(),
"=DATE_UPDATE" => $DB->GetNowFunction(),
"USER_ID" => $arData["USER_ID"]
);
$ID = CSaleUser::_Add($arFields);
}
$orderID = CSaleOrder::Add($arOrder);
CSaleBasket::OrderBasket($orderID, CSaleBasket::GetBasketUserID(), WIZARD_SITE_ID);
$dbBasketItems = CSaleBasket::GetList(
array("NAME" => "ASC"),
array(
"FUSER_ID" => CSaleBasket::GetBasketUserID(),
"LID" => WIZARD_SITE_ID,
"ORDER_ID" => $orderID
),
false,
false,
array("ID", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY", "PRICE", "WEIGHT", "NAME")
);
$ORDER_PRICE = 0;
while ($arBasketItems = $dbBasketItems->GetNext())
{
$ORDER_PRICE += roundEx($arBasketItems["PRICE"], SALE_VALUE_PRECISION) * DoubleVal($arBasketItems["QUANTITY"]);
}
$totalOrderPrice = $ORDER_PRICE + $arData["PRICE_DELIVERY"];
CSaleOrder::Update($orderID, Array("PRICE" => $totalOrderPrice));
foreach($arData["PROPS"] as $val)
{
$arFields = Array(
"ORDER_ID" => $orderID,
"ORDER_PROPS_ID" => $val["ID"],
"NAME" => $val["NAME"],
"CODE" => $val["CODE"],
"VALUE" => $val["VALUE"],
//.........这里部分代码省略.........
示例6: array
$USER_DESCRIPTION .= $valProps['NAME'] . ' - ' . sestHL::getByIdHL(HL_Version, $valProps['VALUE'], true, 'UF_NAME') . ';';
}
}
}
}
$index += 1;
}
//dd($USER_DESCRIPTION);
$arFields = array("LID" => "s1", "PERSON_TYPE_ID" => 1, "PAYED" => "N", "CANCELED" => "N", "STATUS_ID" => "N", "PRICE" => $totalSum, "CURRENCY" => "UAH", "USER_ID" => IntVal($USER->GetID()), "PAY_SYSTEM_ID" => 1, "PRICE_DELIVERY" => 1, "DELIVERY_ID" => 1, "DISCOUNT_VALUE" => 0.0, "TAX_VALUE" => 0.0, "USER_DESCRIPTION" => $USER_DESCRIPTION);
$ORDER_ID = CSaleOrder::Add($arFields);
if ($ORDER_ID) {
global $USER;
$arEventFields = array("EMAIL" => $USER->GetEmail(), "ORDER_ID" => $ORDER_ID, "PRICE" => $_GET['totalSum']);
CEvent::SendImmediate("SALE_NEW_ORDER_SEST", "s1", $arEventFields);
//привязал корзину к заказу
CSaleBasket::OrderBasket($ORDER_ID, 0, SITE_ID);
//$_SESSION["SALE_USER_ID"]
foreach ($arrCleanProducts as $key => $value) {
$res = CSaleBasket::Update($value->elementBaskId, array('QUANTITY' => $value->quantity, 'PRICE' => $value->oneSum));
}
} else {
//dd(bad);
}
}
}
?>
示例7: NextPayment
//.........这里部分代码省略.........
CStatistic::Set_Event("eStore", "add2basket", $arFields["PRODUCT_ID"]);
$arFields = array(
"LID" => $arOrder["LID"],
"PERSON_TYPE_ID" => $arOrder["PERSON_TYPE_ID"],
"PAYED" => "N",
"CANCELED" => "N",
"STATUS_ID" => "N",
"PRICE_DELIVERY" => $deliveryPrice,
"ALLOW_DELIVERY" => "N",
"PRICE" => $totalOrderPrice,
"CURRENCY" => $baseSiteCurrency,
"DISCOUNT_VALUE" => $discount,
"USER_ID" => $arOrder["USER_ID"],
"PAY_SYSTEM_ID" => $arOrder["PAY_SYSTEM_ID"],
"DELIVERY_ID" => $deliveryID,
"USER_DESCRIPTION" => $arOrder["USER_DESCRIPTION"],
"TAX_VALUE" => (($bUseVat)? $taxVatPrice : $taxPrice),
"STAT_GID" => $arOrder["STAT_GID"],
"RECURRING_ID" => $arRecur["ID"]
);
$newOrderID = CSaleOrder::Add($arFields);
$newOrderID = IntVal($newOrderID);
if ($newOrderID <= 0)
$bSuccess = False;
}
if ($bSuccess)
{
$arDiscounts = array();
$arDiscounts[$basketID] = $discountProduct;
CSaleBasket::OrderBasket($newOrderID, $currentFUser, $arOrder["LID"], $arDiscounts);
}
if ($bSuccess)
{
for ($it = 0, $intCount = count($arTaxList); $it < $intCount; $it++)
{
$arFields = array(
"ORDER_ID" => $newOrderID,
"TAX_NAME" => $arTaxList[$it]["TAX_NAME"],
"IS_PERCENT" => $arTaxList[$it]["IS_PERCENT"],
"VALUE" => ($arTaxList[$it]["IS_PERCENT"]=="Y") ? $arTaxList[$it]["VALUE"] : RoundEx(CCurrencyRates::ConvertCurrency($arTaxList[$it]["VALUE"], $arTaxList[$it]["CURRENCY"], $baseSiteCurrency), 2),
"VALUE_MONEY" => $arTaxList[$it]["VALUE_MONEY"],
"APPLY_ORDER" => $arTaxList[$it]["APPLY_ORDER"],
"IS_IN_PRICE" => $arTaxList[$it]["IS_IN_PRICE"],
"CODE" => $arTaxList[$it]["CODE"]
);
CSaleOrderTax::Add($arFields);
}
$dbOrderPropValues = CSaleOrderPropsValue::GetList(
array(),
array("ORDER_ID" => $arRecur["ORDER_ID"]),
false,
false,
array("ORDER_PROPS_ID", "NAME", "CODE", "VALUE", "PROP_IS_PAYER", "PROP_IS_EMAIL")
);
while ($arOrderPropValues = $dbOrderPropValues->Fetch())
{
$arFields = array(
"ORDER_ID" => $newOrderID,
"ORDER_PROPS_ID" => $arOrderPropValues["ORDER_PROPS_ID"],
"NAME" => $arOrderPropValues["NAME"],
示例8: AddProduct
public static function AddProduct ($idProduct, $quantity, $arRewriteFields, $arProductParams, $userId, $currency, $personType, $clearCart) {
if (CModule::IncludeModule("catalog")) {
global $DB;
global $USER;
if ($clearCart == "Y" && (int)$idProduct > 0) {
CSaleBasket::DeleteAll(CSaleBasket::GetBasketUserID());
}
if (Add2BasketByProductID( $idProduct, $quantity, $arRewriteFields, $arProductParams)) { // В корзину
// Получаю параметры корзины
$dbBasketItems = CSaleBasket::GetList(array("NAME" => "ASC", "ID" => "ASC"), array("FUSER_ID" => CSaleBasket::GetBasketUserID(), "ORDER_ID" => "NULL"), false, false, array("ID", "PRODUCT_ID", "QUANTITY", "DELAY", "CAN_BUY", "PRICE", "NAME"));
while ($arItems = $dbBasketItems->Fetch()) {
$arBasketItems[] = $arItems;
}
foreach ($arBasketItems as $valBasketItems) {
$productPriceSumm = $productPriceSumm + ((int)$valBasketItems["QUANTITY"]*(int)$valBasketItems["PRICE"]);
}
$strOrderList = "";
foreach ($arBasketItems as $arItem)
{
$measureText = (isset($arItem["MEASURE_TEXT"]) && strlen($arItem["MEASURE_TEXT"])) ? $arItem["MEASURE_TEXT"] : GetMessage("SOA_SHT");
$strOrderList .= $arItem["NAME"]." - ".$arItem["QUANTITY"]." ".$measureText.": ".SaleFormatCurrency($arItem["PRICE"], $arItem["CURRENCY"]);
$strOrderList .= "\n";
}
// Создаю заказ
$arOrderFields = array(
"LID" => SITE_ID,
"PERSON_TYPE_ID" => $personType,
"PAYED" => "N",
"CANCELED" => "N",
"STATUS_ID" => "N",
"PRICE" => $productPriceSumm,
"CURRENCY" => $currency,
"USER_ID" => $userId,
"USER_DESCRIPTION" => "",
"ADDITIONAL_INFO" => ""
);
$ORDER_ID = CSaleOrder::Add($arOrderFields);
// Привязываем товары из корзины текущего пользователя к заказу
CSaleBasket::OrderBasket($ORDER_ID, CSaleBasket::GetBasketUserID(), SITE_ID, false);
$rsUser = CUser::GetByID($userId);
$arUser = $rsUser->Fetch();
$arFields = Array(
"ORDER_ID" => $ORDER_ID,
"ORDER_DATE" => Date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT", SITE_ID))),
"ORDER_USER" => $arUser["NAME"],
"PRICE" => $productPriceSumm,
"BCC" => COption::GetOptionString("sale", "order_email", "order@".$SERVER_NAME),
"EMAIL" => (strlen($arUserResult["USER_EMAIL"])>0 ? $arUserResult["USER_EMAIL"] : $USER->GetEmail()),
"ORDER_LIST" => $strOrderList,
"SALE_EMAIL" => COption::GetOptionString("sale", "order_email", "order@".$SERVER_NAME),
);
$eventName = "SALE_NEW_ORDER";
$event = new CEvent;
$event->Send($eventName, SITE_ID, $arFields, "N");
return $ORDER_ID;
}
} else {
return false;
}
}