本文整理汇总了PHP中CCatalogProduct::saleIncluded方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogProduct::saleIncluded方法的具体用法?PHP CCatalogProduct::saleIncluded怎么用?PHP CCatalogProduct::saleIncluded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogProduct
的用法示例。
在下文中一共展示了CCatalogProduct::saleIncluded方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Update
public function Update($ID, $arFields)
{
global $DB;
$ID = (int) $ID;
if ($ID <= 0) {
return false;
}
foreach (GetModuleEvents("catalog", "OnBeforeProductUpdate", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($ID, &$arFields)) === false) {
return false;
}
}
if (array_key_exists('ID', $arFields)) {
unset($arFields['ID']);
}
if (!CCatalogProduct::CheckFields("UPDATE", $arFields, $ID)) {
return false;
}
$strUpdate = $DB->PrepareUpdate("b_catalog_product", $arFields);
$boolSubscribe = false;
if (!empty($strUpdate)) {
if (isset($arFields["QUANTITY"]) && $arFields["QUANTITY"] > 0) {
if (!isset($arFields["OLD_QUANTITY"])) {
$strQuery = 'select ID, QUANTITY from b_catalog_product where ID = ' . $ID;
$rsProducts = $DB->Query($strQuery, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($arProduct = $rsProducts->Fetch()) {
$arFields["OLD_QUANTITY"] = doubleval($arProduct['QUANTITY']);
}
}
if (isset($arFields["OLD_QUANTITY"])) {
$boolSubscribe = $arFields["OLD_QUANTITY"] <= 0;
}
}
$strSql = "update b_catalog_product set " . $strUpdate . " where ID = " . $ID;
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if (CBXFeatures::IsFeatureEnabled('CatCompleteSet') && (isset($arFields['QUANTITY']) || isset($arFields['QUANTITY_TRACE']) || isset($arFields['CAN_BUY_ZERO']) || isset($arFields['WEIGHT']))) {
CCatalogProductSet::recalculateSetsByProduct($ID);
}
if (isset(self::$arProductCache[$ID])) {
unset(self::$arProductCache[$ID]);
if (defined('CATALOG_GLOBAL_VARS') && 'Y' == CATALOG_GLOBAL_VARS) {
/** @var array $CATALOG_PRODUCT_CACHE */
global $CATALOG_PRODUCT_CACHE;
$CATALOG_PRODUCT_CACHE = self::$arProductCache;
}
}
}
foreach (GetModuleEvents("catalog", "OnProductUpdate", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
}
//call subscribe
if ($boolSubscribe) {
if (self::$saleIncluded === null) {
self::$saleIncluded = Loader::includeModule('sale');
}
if (self::$saleIncluded) {
CSaleBasket::ProductSubscribe($ID, 'catalog');
}
}
return true;
}