本文整理汇总了PHP中CSaleUser::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleUser::GetList方法的具体用法?PHP CSaleUser::GetList怎么用?PHP CSaleUser::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleUser
的用法示例。
在下文中一共展示了CSaleUser::GetList方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: transferBasket
/**
* Transfers basket from one user to another one
*
* @param integer $from
* @param integer $to
* @global object $DB
* @return boolean
*/
public static function transferBasket($from, $to)
{
global $DB;
$from = intval($from);
$to = intval($to);
CModule::IncludeModule('sale');
if ($to > 0 && CSaleUser::GetList(array("ID" => $to))) {
$deleteQuery = "DELETE FROM b_sale_basket WHERE FUSER_ID = " . $to . " ";
$updateQuery = "UPDATE b_sale_basket SET " . " FUSER_ID = " . $to . " " . "WHERE FUSER_ID = " . $from . " ";
$DB->Query($deleteQuery, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$DB->Query($updateQuery, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
return true;
}
return false;
}
示例2: array
if (!isset($str_TAX_VALUE) OR $str_TAX_VALUE == "")
$str_TAX_VALUE = 0;
if (intval($str_PERSON_TYPE_ID) <= 0)
{
$str_PERSON_TYPE_ID = 0;
$arFilter = array();
$arFilter["ACTIVE"] = "Y";
if(strlen($LID) > 0)
$arFilter["LID"] = $LID;
$dbPersonType = CSalePersonType::GetList(array("SORT" => "ASC", "NAME" => "ASC"), $arFilter, false, array('nTopCount' => 1), array('ID'));
if($arPersonType = $dbPersonType->Fetch())
$str_PERSON_TYPE_ID = $arPersonType["ID"];
}
$arFuserItems = CSaleUser::GetList(array("USER_ID" => intval($str_USER_ID)));
$FUSER_ID = $arFuserItems["ID"];
/*
* form select site
*/
if ((!isset($LID) OR $LID == "") AND (defined('BX_PUBLIC_MODE') OR BX_PUBLIC_MODE == 1) )
{
$arSitesShop = array();
$arSitesTmp = array();
$rsSites = CSite::GetList($by="id", $order="asc", array("ACTIVE" => "Y"));
while ($arSite = $rsSites->Fetch())
{
$site = COption::GetOptionString("sale", "SHOP_SITE_".$arSite["ID"], "");
if ($arSite["ID"] == $site)
{
示例3: count
$arRecommendedResult = CSaleProduct::GetRecommendetProduct($arOrder["USER_ID"], $arOrder["LID"], $arFilterRecomendet);
$recomCnt = count($arRecommendedResult);
if ($recomCnt > 2)
{
$arTmp = array();
$arTmp[] = $arRecommendedResult[0];
$arTmp[] = $arRecommendedResult[1];
$arRecommendedResult = $arTmp;
}
if ($recomCnt <= 0)
$displayNone = "none";
$arErrors = array();
$arFuserItems = CSaleUser::GetList(array("USER_ID" => intval($arOrder["USER_ID"])));
$arCartWithoutSetItems = array();
$arTmpShoppingCart = CSaleBasket::DoGetUserShoppingCart($arOrder["LID"], $arOrder["USER_ID"], $arFuserItems["ID"], $arErrors, array());
if (is_array($arTmpShoppingCart))
{
foreach ($arTmpShoppingCart as $arCartItem)
{
if (CSaleBasketHelper::isSetItem($arCartItem))
continue;
$arCartWithoutSetItems[] = $arCartItem;
}
}
$basketCnt = count($arCartWithoutSetItems);
if ($basketCnt > 2)
示例4: __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"],
//.........这里部分代码省略.........
示例5: OnUserDelete
function OnUserDelete($userID)
{
if ($userID <= 0) {
return false;
}
$arSUser = CSaleUser::GetList(array("USER_ID" => $userID));
if (!empty($arSUser)) {
if (!CSaleBasket::DeleteAll($arSUser["ID"])) {
return false;
}
if (!CSaleUser::Delete($arSUser["ID"])) {
return false;
}
}
return true;
}
示例6: NextPayment
/**
* <p>Метод осуществляет продление подписки с кодом ID.</p> <p><b>Примечание</b>. Метод использует внутреннюю транзакцию. Если у вас используется <b>MySQL</b> и <b>InnoDB</b>, и ранее была открыта транзакция, то ее необходимо закрыть до подключения метода.</p>
*
*
*
*
* @param int $ID Код записи с информацией о продлении.
*
*
*
* @return bool <p>Метод возвращает <i>true</i> в случае успешного продления или <i>false</i>
* в случае ошибки.</p><br><br>
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/sale/classes/csalerecurring/csalerecurring.nextpayment.php
* @author Bitrix
*/
public static function NextPayment($ID)
{
global $DB;
global $USER;
$ID = IntVal($ID);
if ($ID <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGR_NO_RECID"), "NO_RECORD_ID");
return False;
}
$arRecur = CSaleRecurring::GetByID($ID);
if (!$arRecur)
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $ID, GetMessage("SKGR_NO_RECID1")), "NO_RECORD");
return False;
}
$arOrder = CSaleOrder::GetByID($arRecur["ORDER_ID"]);
if (!$arOrder)
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arRecur["ORDER_ID"], GetMessage("SKGR_NO_ORDER1")), "NO_ORDER");
return False;
}
$bSuccess = True;
$newOrderID = IntVal($arRecur["ORDER_ID"]);
/** @var $productProvider IBXSaleProductProvider */
if ($productProvider = CSaleBasket::GetProductProvider($arRecur))
{
$arProduct = $productProvider::RecurringOrderProduct(array(
"PRODUCT_ID" => $arRecur["PRODUCT_ID"],
"USER_ID" => $arOrder["USER_ID"]
));
}
else
{
$arProduct = CSaleRecurring::ExecuteCallbackFunction(
$arRecur["CALLBACK_FUNC"],
$arRecur["MODULE"],
$arRecur["PRODUCT_ID"],
$arOrder["USER_ID"]
);
}
if (!$arProduct || !is_array($arProduct) || count($arProduct) <= 0)
{
CSaleRecurring::CancelRecurring($arRecur["ID"], "Y", "Product is not found");
/*
$arFields = array(
"CANCELED" => "Y",
"DATE_CANCELED" => Date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL", LANG))),
"CANCELED_REASON" => "Product is not found"
);
CSaleRecurring::Update($arRecur["ID"], $arFields);
*/
//CSaleRecurring::Delete($arRecur["ID"]);
return True;
}
if ($arProduct["WITHOUT_ORDER"] == "Y" || $arRecur["SUCCESS_PAYMENT"] == "Y")
{
$baseSiteCurrency = CSaleLang::GetLangCurrency($arOrder["LID"]);
$productPrice = roundEx(CCurrencyRates::ConvertCurrency($arProduct["PRICE"], $arProduct["CURRENCY"], $baseSiteCurrency), SALE_VALUE_PRECISION);
// Delivery
$deliveryPrice = 0;
$deliveryID = 0;
$arOrder["DELIVERY_ID"] = IntVal($arOrder["DELIVERY_ID"]);
if ($arOrder["DELIVERY_ID"] > 0)
{
$deliveryLocation = 0;
$dbOrderPropValues = CSaleOrderPropsValue::GetList(
array(),
array(
"ORDER_ID" => $arRecur["ORDER_ID"],
"PROP_IS_LOCATION" => "Y"
),
//.........这里部分代码省略.........
示例7: Add
/**
* The function add viewed product
*
* @param array $arFields - params for add
* @return true false
*/
public static function Add($arFields)
{
global $DB;
global $USER;
global $APPLICATION;
foreach (GetModuleEvents("sale", "OnBeforeViewedAdd", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array(&$arFields)) === false) {
return false;
}
}
if (isset($arFields["ID"])) {
unset($arFields["ID"]);
}
$arFields["PRODUCT_ID"] = IntVal($arFields["PRODUCT_ID"]);
$arFields["USER_ID"] = IntVal($arFields["USER_ID"]);
$arFields["FUSER_ID"] = IntVal($arFields["FUSER_ID"]);
$arFields["IBLOCK_ID"] = IntVal($arFields["IBLOCK_ID"]);
if (strlen($arFields["CALLBACK_FUNC"]) <= 0) {
$arFields["CALLBACK_FUNC"] = "CatalogViewedProductCallback";
}
if (strlen($arFields["MODULE"]) <= 0) {
$arFields["MODULE"] = "catalog";
}
if (strlen($arFields["PRODUCT_PROVIDER_CLASS"]) <= 0 && $arFields["MODULE"] == "catalog") {
$arFields["PRODUCT_PROVIDER_CLASS"] = "CCatalogProductProvider";
}
if ($arFields["PRODUCT_ID"] <= 0) {
return false;
}
if (strlen($arFields["LID"]) <= 0) {
return false;
}
if (\Bitrix\Main\Loader::includeModule("catalog")) {
if (\Bitrix\Main\Config\Option::get("sale", "viewed_capability", "") == "Y") {
return \Bitrix\Catalog\CatalogViewedProductTable::refresh($arFields["PRODUCT_ID"], CSaleBasket::GetBasketUserID(), $arFields["LID"]);
}
}
$arFilter = array();
$arFilter["PRODUCT_ID"] = $arFields["PRODUCT_ID"];
if ($arFields["USER_ID"] > 0) {
$arFuserItems = CSaleUser::GetList(array("USER_ID" => $arFields["USER_ID"]));
$FUSER_ID = $arFuserItems["ID"];
} elseif (IntVal($arFields["FUSER_ID"]) > 0) {
$FUSER_ID = $arFields["FUSER_ID"];
} else {
$FUSER_ID = CSaleBasket::GetBasketUserID();
}
$arFilter["FUSER_ID"] = $FUSER_ID;
$arFields["FUSER_ID"] = $FUSER_ID;
$db_res = CSaleViewedProduct::GetList(array(), $arFilter, false, false, array('ID'));
if (!($arItems = $db_res->Fetch())) {
if (CModule::IncludeModule('catalog')) {
/** @var $productProvider IBXSaleProductProvider */
if ($productProvider = CSaleBasket::GetProductProvider($arFields)) {
$arResultTmp = $productProvider::ViewProduct(array("PRODUCT_ID" => $arFields["PRODUCT_ID"], "USER_ID" => $arFields["USER_ID"], "SITE_ID" => $arFields["LID"]));
} else {
$arResultTmp = CSaleBasket::ExecuteCallbackFunction($arFields["CALLBACK_FUNC"], $arFields["MODULE"], $arFields["PRODUCT_ID"], $arFields["USER_ID"], $arFields["LID"]);
}
if ($arResultTmp && count($arResultTmp) > 0) {
$arFields = array_merge($arFields, $arResultTmp);
}
if (strlen($arFields["NAME"]) <= 0) {
return false;
}
$arInsert = $DB->PrepareInsert("b_sale_viewed_product", $arFields);
//chance deleted
$rnd = mt_rand(0, 1000);
if ($rnd < 100) {
$db_res = CSaleViewedProduct::GetList(array(), array("FUSER_ID" => $FUSER_ID), array("COUNT" => "ID"), false);
$arCount = $db_res->Fetch();
$viewedCount = COption::GetOptionString("sale", "viewed_count", "100");
if ($arCount["ID"] > IntVal($viewedCount)) {
$limit = $arCount["ID"] - $viewedCount + $viewedCount * 0.2;
CSaleViewedProduct::DeleteForUser($FUSER_ID, $limit);
}
}
$strSql = "INSERT INTO b_sale_viewed_product (" . $arInsert[0] . ", DATE_VISIT) VALUES(" . $arInsert[1] . ", " . $DB->GetNowFunction() . ")";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$ID = IntVal($DB->LastID());
}
} else {
$ID = IntVal($arItems["ID"]);
$arFields["DATE_VISIT"] = $DB->GetNowFunction();
$arInsert = $DB->PrepareInsert("b_sale_viewed_product", $arFields);
CSaleViewedProduct::Update($ID, $arFields);
}
foreach (GetModuleEvents("sale", "OnViewedAdd", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($arFields));
}
return $ID;
}
示例8: GetMessage
}
}
$lAdmin_tab4->AddGroupActionTable(array("order_basket" => GetMessage("BUYER_PD_ORDER"), "delay_y" => GetMessage("BUYER_PD_DELAY_Y"), "delay_n" => GetMessage("BUYER_PD_DELAY_N"), "delete_basket" => GetMessage("BUYER_PD_DELETE")));
if ($_REQUEST["table_id"] == $sTableID_tab4) {
$lAdmin_tab4->CheckListMode();
}
//END BUYERS BASKET
//BUYERS VIEWED PRODUCT
$sTableID_tab5 = "t_stat_list_tab5";
$oSort_tab5 = new CAdminSorting($sTableID_tab5);
$lAdmin_tab5 = new CAdminList($sTableID_tab5, $oSort_tab5);
//FILTER VIEWED
$arFilterFields = array("filter_viewed_date_visit", "filter_date_visit_from", "filter_date_visit_to", "filter_viewed_lid");
$lAdmin_tab5->InitFilter($arFilterFields);
$arFilter = array();
$arFuserItems = CSaleUser::GetList(array("USER_ID" => $ID));
$arFilter["FUSER_ID"] = $arFuserItems["ID"];
if (strlen($filter_viewed_lid) > 0) {
$arFilter["LID"] = trim($filter_viewed_lid);
}
if (strlen(trim($filter_date_visit_from)) > 0) {
$arFilter["DATE_FROM"] = FmtDate($filter_date_visit_from, "D.M.Y");
}
if (strlen(trim($filter_date_visit_to)) > 0) {
if ($arDate = ParseDateTime($filter_date_visit_to, CSite::GetDateFormat("FULL", SITE_ID))) {
if (StrLen($filter_date_visit_to) < 11) {
$arDate["HH"] = 23;
$arDate["MI"] = 59;
$arDate["SS"] = 59;
}
$filter_date_visit_to = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL", SITE_ID)), mktime($arDate["HH"], $arDate["MI"], $arDate["SS"], $arDate["MM"], $arDate["DD"], $arDate["YYYY"]));
示例9: Add
public static function Add()
{
global $DB, $USER;
$arFields = array("=DATE_INSERT" => $DB->GetNowFunction(), "=DATE_UPDATE" => $DB->GetNowFunction(), "USER_ID" => is_object($USER) && $USER->IsAuthorized() ? IntVal($USER->GetID()) : False, "CODE" => md5(time() . randString(10)));
$ID = CSaleUser::_Add($arFields);
$ID = IntVal($ID);
$secure = false;
if (COption::GetOptionString("sale", "use_secure_cookies", "N") == "Y" && CMain::IsHTTPS()) {
$secure = 1;
}
if (COption::GetOptionString("sale", "encode_fuser_id", "N") == "Y") {
$arRes = CSaleUser::GetList(array("ID" => $ID));
if (!empty($arRes)) {
$GLOBALS["APPLICATION"]->set_cookie("SALE_UID", $arRes["CODE"], false, "/", false, $secure, "Y", false);
}
} else {
$GLOBALS["APPLICATION"]->set_cookie("SALE_UID", $ID, false, "/", false, $secure, "Y", false);
}
return $ID;
}
示例10: __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(), array("IBLOCK_TYPE" => "offers", "IBLOCK_SITE_ID" => WIZARD_SITE_ID, "PROPERTY_NEWPRODUCT" => false), false, array("nTopCount" => 100), array("ID", "IBLOCK_ID", "XML_ID", "NAME", "DETAIL_PAGE_URL", "IBLOCK_XML_ID"));
while ($arItem = $dbItem->GetNext()) {
$arPrd[] = $arItem;
}
if (!empty($arPrd)) {
$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"]);
$fuserID = 0;
$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"]);
$fuserID = CSaleUser::_Add($arFields);
} else {
$fuserID = $dbFUserListTmp['ID'];
}
$orderID = CSaleOrder::Add($arOrder);
CCatalogProduct::setPriceVatIncludeMode(true);
CCatalogProduct::setUsedCurrency(CSaleLang::GetLangCurrency(WIZARD_SITE_ID));
CCatalogProduct::setUseDiscount(true);
for ($i = 0; $i < $prdCnt; $i++) {
$prdID = $arPrd[mt_rand(20, 99)];
$arProduct = CCatalogProduct::GetByID($prdID["ID"]);
$arPrice = CCatalogProduct::GetOptimalPrice($prdID["ID"], 1, array(2), 'N', array(), WIZARD_SITE_ID, array());
$arFields = array("IGNORE_CALLBACK_FUNC" => "Y", "PRODUCT_ID" => $prdID["ID"], "PRODUCT_PRICE_ID" => $arPrice['PRICE']['ID'], "BASE_PRICE" => $arPrice['RESULT_PRICE']['BASE_PRICE'], "PRICE" => $arPrice['RESULT_PRICE']['DISCOUNT_PRICE'], "VAT_RATE" => $arPrice['PRICE']['VAT_RATE'], "CURRENCY" => $arPrice['RESULT_PRICE']['CURRENCY'], "WEIGHT" => $arProduct["WEIGHT"], "DIMENSIONS" => serialize(array("WIDTH" => $arProduct["WIDTH"], "HEIGHT" => $arProduct["HEIGHT"], "LENGTH" => $arProduct["LENGTH"])), "QUANTITY" => 1, "LID" => WIZARD_SITE_ID, "DELAY" => "N", "CAN_BUY" => "Y", "NAME" => $prdID["NAME"], "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"], "NOTES" => $arPrice["PRICE"]["CATALOG_GROUP_NAME"], "FUSER_ID" => $fuserID, "ORDER_ID" => $orderID);
$addres = CSaleBasket::Add($arFields);
}
$dbBasketItems = CSaleBasket::GetList(array(), array("ORDER_ID" => $orderID), false, false, array("ID", "QUANTITY", "PRICE"));
$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"]);
CSaleOrderPropsValue::Add($arFields);
}
return $orderID;
}
}
示例11: realpath
<?php
$_SERVER["DOCUMENT_ROOT"] = realpath(dirname(__FILE__) . "/..");
$DOCUMENT_ROOT = $_SERVER["DOCUMENT_ROOT"];
define("NO_KEEP_STATISTIC", true);
define("NOT_CHECK_PERMISSIONS", true);
define('CHK_EVENT', true);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
@set_time_limit(0);
@ignore_user_abort(true);
CModule::IncludeModule('sale');
$arBasketItemsToUser = array();
$dbBasketItems = CSaleBasket::GetList(array(), array(">DATE_INSERT" => date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT")), mktime() - 60 * 60 * 24 * 30), ">USER_ID" => 0, "DELAY" => "Y"));
//get list of positions inserted in 30 days
while ($arItem = $dbBasketItems->Fetch()) {
$arUser = CSaleUser::GetList(array('ID' => $arItem['FUSER_ID']));
$arItem["USER_ID"] = $arUser["USER_ID"];
$dbBasketItemsCheck = CSaleBasket::GetList(array(), array("PRODUCT_ID" => $arItem["PRODUCT_ID"], "USER_ID" => $arItem["USER_ID"], ">ORDER_ID" => 0));
if (!$dbBasketItemsCheck->Fetch()) {
$arBasketItemsToUser[$arItem["USER_ID"]][] = $arItem;
//filling array with list of positions to user
}
}
$ORDERLIST = '';
$arEventFields = array();
//Parameters for post template
foreach ($arBasketItemsToUser as $USER_ID => $basketItems) {
$rsUser = CUser::GetByID($USER_ID);
if ($arUser = $rsUser->Fetch()) {
foreach ($basketItems as $basketItem) {
$ORDERLIST .= $basketItem["NAME"] . ' - ' . $basketItem["PRICE"] . " " . $basketItem["CURRENCY"] . "<br />";