本文整理匯總了PHP中CSaleBasketHelper::isSetDeducted方法的典型用法代碼示例。如果您正苦於以下問題:PHP CSaleBasketHelper::isSetDeducted方法的具體用法?PHP CSaleBasketHelper::isSetDeducted怎麽用?PHP CSaleBasketHelper::isSetDeducted使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CSaleBasketHelper
的用法示例。
在下文中一共展示了CSaleBasketHelper::isSetDeducted方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: OrderDeduction
//.........這裏部分代碼省略.........
}
if (!$bRealDeductionAllowed) {
break;
}
}
}
// real deduction
if ($bRealDeductionAllowed) {
$bProductsDeductedSuccessfully = true;
$arDeductedItems = array();
foreach ($arItems as $arItem) {
/** @var $productProvider IBXSaleProductProvider */
if ($productProvider = CSaleBasket::GetProductProvider($arItem)) {
$arItem["FIELDS"]["EMULATE"] = "N";
if (defined("SALE_DEBUG") && SALE_DEBUG) {
CSaleHelper::WriteToLog("Call ::DeductProduct", array("fields" => $arItem["FIELDS"]), "OD10");
}
// finally real deduction
$res = $productProvider::DeductProduct($arItem["FIELDS"]);
if ($res["RESULT"]) {
$arDeductedItems[] = $arItem;
if (!$bUndoDeduction && $storesCount > 0) {
if ($bAutoDeduction) {
$arStoreBarcodeFields = array("BASKET_ID" => $arItem["ID"], "BARCODE" => "", "STORE_ID" => array_pop(array_keys($res["STORES"])), "QUANTITY" => $arItem["QUANTITY"], "CREATED_BY" => intval($GLOBALS["USER"]->GetID()) > 0 ? IntVal($GLOBALS["USER"]->GetID()) : "", "MODIFIED_BY" => intval($GLOBALS["USER"]->GetID()) > 0 ? IntVal($GLOBALS["USER"]->GetID()) : "");
if (defined("SALE_DEBUG") && SALE_DEBUG) {
CSaleHelper::WriteToLog("Call CSaleStoreBarcode::Add (auto deduction = true)", array("arStoreBarcodeFields" => $arStoreBarcodeFields), "OD11");
}
CSaleStoreBarcode::Add($arStoreBarcodeFields);
}
}
if ($bUndoDeduction) {
$dbStoreBarcode = CSaleStoreBarcode::GetList(array(), array("BASKET_ID" => $arItem["ID"]), false, false, array("ID", "BASKET_ID"));
while ($arStoreBarcode = $dbStoreBarcode->GetNext()) {
CSaleStoreBarcode::Delete($arStoreBarcode["ID"]);
}
}
$tmpRes = $bUndoDeduction ? "N" : "Y";
CSaleBasket::Update($arItem["ID"], array("DEDUCTED" => $tmpRes));
// set parent deducted status
if ($bUndoDeduction) {
if (CSaleBasketHelper::isSetItem($arItem)) {
CSaleBasket::Update($arItem["SET_PARENT_ID"], array("DEDUCTED" => "N"));
}
} else {
if (CSaleBasketHelper::isSetItem($arItem) && CSaleBasketHelper::isSetDeducted($arItem["SET_PARENT_ID"])) {
CSaleBasket::Update($arItem["SET_PARENT_ID"], array("DEDUCTED" => "Y"));
}
}
if (defined("SALE_DEBUG") && SALE_DEBUG) {
CSaleHelper::WriteToLog("Call ::DeductProduct - Success (DEDUCTED = " . $tmpRes . ")", array(), "OD11");
}
} else {
CSaleBasket::Update($arItem["ID"], array("DEDUCTED" => "N"));
$bProductsDeductedSuccessfully = false;
if ($ex = $APPLICATION->GetException()) {
$arResult["ERROR"]["MESSAGE"] = $ex->GetString();
$arResult["ERROR"]["CODE"] = $ex->GetID();
}
if (defined("SALE_DEBUG") && SALE_DEBUG) {
CSaleHelper::WriteToLog("Call ::DeductProduct - Error (DEDUCTED = N)", array(), "OD12");
}
break;
}
}
}
if ($bProductsDeductedSuccessfully) {
$arResult["RESULT"] = true;
} else {
$arFields = array();
foreach ($arDeductedItems as $arItem) {
/** @var $productProvider IBXSaleProductProvider */
if ($productProvider = CSaleBasket::GetProductProvider($arItem)) {
if ($storesCount > 0) {
$arFields = array("PRODUCT_ID" => $arItem["PRODUCT_ID"], "QUANTITY" => $arItem["QUANTITY"], "UNDO_DEDUCTION" => "Y", "EMULATE" => "N", "PRODUCT_RESERVED" => $arItem["FIELDS"]["PRODUCT_RESERVED"], "STORE_DATA" => $arItem["FIELDS"]["STORE_DATA"]);
} else {
$arFields = array("PRODUCT_ID" => $arItem["PRODUCT_ID"], "QUANTITY" => $arItem["QUANTITY"], "UNDO_DEDUCTION" => "Y", "PRODUCT_RESERVED" => $arItem["FIELDS"]["PRODUCT_RESERVED"], "EMULATE" => "N");
}
if (defined("SALE_DEBUG") && SALE_DEBUG) {
CSaleHelper::WriteToLog("Call ::DeductProduct - Revert deduction", array("storesCount" => $storesCount, "arFields" => $arFields), "OD13");
}
$res = $productProvider::DeductProduct($arFields);
if ($res["RESULT"]) {
CSaleBasket::Update($arItem["ID"], array("DEDUCTED" => "N"));
if (CSaleBasketHelper::isSetItem($arItem)) {
// todo - possibly not all the time, but once
CSaleBasket::Update($arItem["SET_PARENT_ID"], array("DEDUCTED" => "N"));
}
}
}
}
$arResult["RESULT"] = false;
}
} else {
$arResult["RESULT"] = false;
}
if (defined("SALE_DEBUG") && SALE_DEBUG) {
CSaleHelper::WriteToLog("OrderDeduction - result", array("arResult" => $arResult), "OD14");
}
return $arResult;
}