本文整理匯總了PHP中CCatalogProduct::ClearCache方法的典型用法代碼示例。如果您正苦於以下問題:PHP CCatalogProduct::ClearCache方法的具體用法?PHP CCatalogProduct::ClearCache怎麽用?PHP CCatalogProduct::ClearCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CCatalogProduct
的用法示例。
在下文中一共展示了CCatalogProduct::ClearCache方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Delete
public function Delete($ID)
{
global $DB;
$ID = (int) $ID;
foreach (GetModuleEvents("catalog", "OnBeforeCatalogDelete", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
return false;
}
}
foreach (GetModuleEvents("catalog", "OnCatalogDelete", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID));
}
$bSuccess = true;
$dbRes = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $ID));
while ($arRes = $dbRes->Fetch()) {
if (!CCatalogProduct::Delete($arRes["ID"])) {
$bSuccess = false;
}
}
if ($bSuccess) {
if (isset(self::$arCatalogCache[$ID])) {
unset(self::$arCatalogCache[$ID]);
if (defined('CATALOG_GLOBAL_VARS') && CATALOG_GLOBAL_VARS == 'Y') {
global $CATALOG_CATALOG_CACHE;
$CATALOG_CATALOG_CACHE = self::$arCatalogCache;
}
}
if (isset(self::$catalogVatCache[$ID])) {
unset(self::$catalogVatCache[$ID]);
}
CCatalogSKU::ClearCache();
CCatalogProduct::ClearCache();
return $DB->Query("DELETE FROM b_catalog_iblock WHERE IBLOCK_ID = " . $ID, true);
}
return false;
}