本文整理汇总了PHP中CSaleBasket::DeleteAll方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleBasket::DeleteAll方法的具体用法?PHP CSaleBasket::DeleteAll怎么用?PHP CSaleBasket::DeleteAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleBasket
的用法示例。
在下文中一共展示了CSaleBasket::DeleteAll方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: foreach
foreach ($arRes as $key => $value) {
$arResult[$key] = $value;
}
unset($_SESSION["SALE_BASKET_NUM_PRODUCTS"][SITE_ID]);
if (!empty($_REQUEST["BasketOrder"]) && empty($arResult["WARNING_MESSAGE"])) {
if (!(strlen($_POST['paypalbutton']) > 0)) {
LocalRedirect($arParams["PATH_TO_ORDER"]);
}
} else {
unset($_REQUEST["BasketRefresh"], $_REQUEST["BasketOrder"]);
if (!empty($arResult["WARNING_MESSAGE"])) {
$_SESSION["SALE_BASKET_MESSAGE"] = $arResult["WARNING_MESSAGE"];
}
LocalRedirect($APPLICATION->GetCurPage());
}
}
} elseif (!empty($_REQUEST['DeleteAll']) && $_REQUEST['DeleteAll'] == 'Y') {
CSaleBasket::DeleteAll(CSaleBasket::GetBasketUserID());
LocalRedirect($APPLICATION->GetCurPage());
}
$basketData = $this->getBasketItems();
$arResult = array_merge($arResult, $basketData);
$arResult["GRID"]["HEADERS"] = $headersData;
if (is_array($_SESSION["SALE_BASKET_MESSAGE"])) {
foreach ($_SESSION["SALE_BASKET_MESSAGE"] as $message) {
$arResult["WARNING_MESSAGE"][] = $message;
}
unset($_SESSION["SALE_BASKET_MESSAGE"]);
}
CJSCore::Init(array('ajax'));
$this->IncludeComponentTemplate();
示例3: DeleteOld
public static function DeleteOld($nDays)
{
global $DB;
$nDays = IntVal($nDays);
$strSql = "SELECT f.ID " . "FROM b_sale_fuser f " . "LEFT JOIN b_sale_order o ON (o.USER_ID = f.USER_ID) " . "WHERE " . "\tTO_DAYS(f.DATE_UPDATE)<(TO_DAYS(NOW())-" . $nDays . ") " . "\tAND o.ID is null " . "\tAND f.USER_ID is null " . "LIMIT 300";
$db_res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
while ($ar_res = $db_res->Fetch()) {
CSaleBasket::DeleteAll($ar_res["ID"], false);
CSaleUser::Delete($ar_res["ID"]);
}
return true;
}
示例4: 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;
}
}
示例5: orderHistory
//.........这里部分代码省略.........
$arProduct['DISCOUNT_VALUE'] = $item['discountPercent'];
$newPrice = round($arProduct['PRICE'] / 100 * (100 - $arProduct['DISCOUNT_VALUE']), 2);
$arProduct['DISCOUNT_PRICE'] = $arProduct['DISCOUNT_PRICE'] + $arProduct['PRICE'] - $newPrice;
}
if (isset($item['discount']) || isset($item['discountPercent'])) {
$arProduct['PRICE'] -= $arProduct['DISCOUNT_PRICE'];
}
if (isset($item['offer']['name']) && $item['offer']['name']) {
$arProduct['NAME'] = self::fromJSON($item['offer']['name']);
}
$arProduct = self::updateCancelProp($arProduct, 0);
} elseif (isset($item['isCanceled'])) {
$arProduct['PRICE'] = 0;
$arProduct = self::updateCancelProp($arProduct, 1);
}
if (isset($item['created']) && $item['created'] == true) {
if (!Add2BasketByProductID($item['offer']['externalId'], $item['quantity'], $arProduct, $p['PROPS'])) {
self::eventLog('ICrmOrderActions::orderHistory', 'Add2BasketByProductID', 'Error element add');
}
continue;
}
if (count($p['PROPS']) > 0) {
$arProduct['PROPS'] = $p['PROPS'];
}
if (isset($item['quantity']) && $item['quantity']) {
$arProduct['QUANTITY'] = $item['quantity'];
}
if (isset($item['offer']['name']) && $item['offer']['name']) {
$arProduct['NAME'] = self::fromJSON($item['offer']['name']);
}
if (!CSaleBasket::Update($p['ID'], $arProduct)) {
self::eventLog('ICrmOrderActions::orderHistory', 'CSaleBasket::Update', 'Error element update');
}
CSaleBasket::DeleteAll($userId);
} else {
$arProduct = array();
if (isset($item['created']) && $item['created'] == true) {
$arProduct = array('FUSER_ID' => $userId, 'ORDER_ID' => $order['externalId'], 'LID' => $LID, 'NOTES' => $item['comment']);
}
if (isset($item['isCanceled']) == false) {
if (isset($item['initialPrice']) && $item['initialPrice']) {
$arProduct['PRICE'] = (double) $item['initialPrice'];
}
if (isset($item['discount'])) {
$arProduct['DISCOUNT_PRICE'] = $item['discount'];
}
if (isset($item['discountPercent'])) {
$arProduct['DISCOUNT_VALUE'] = $item['discountPercent'];
$newPrice = round($arProduct['PRICE'] / 100 * (100 - $arProduct['DISCOUNT_VALUE']), 2);
$arProduct['DISCOUNT_PRICE'] = $arProduct['DISCOUNT_PRICE'] + $arProduct['PRICE'] - $newPrice;
}
if (isset($item['discount']) || isset($item['discountPercent'])) {
$arProduct['PRICE'] -= $arProduct['DISCOUNT_PRICE'];
}
if (isset($item['offer']['name']) && $item['offer']['name']) {
$arProduct['NAME'] = self::fromJSON($item['offer']['name']);
}
$arProduct = self::updateCancelProp($arProduct, 0);
} elseif (isset($item['isCanceled'])) {
$arProduct['PRICE'] = 0;
$arProduct = self::updateCancelProp($arProduct, 1);
}
if (isset($item['quantity']) && $item['quantity']) {
$arProduct['QUANTITY'] = $item['quantity'];
}
if (isset($item['offer']['name']) && $item['offer']['name']) {
示例6: resetBasket
/**
* Delete all products from current user's basket
* @return boolean
*/
public static function resetBasket()
{
CSaleBasket::DeleteAll(CSaleBasket::GetBasketUserID());
return true;
}