本文整理汇总了PHP中CCatalogSKU::ClearCache方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogSKU::ClearCache方法的具体用法?PHP CCatalogSKU::ClearCache怎么用?PHP CCatalogSKU::ClearCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogSKU
的用法示例。
在下文中一共展示了CCatalogSKU::ClearCache方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UnLinkSKUIBlock
public static function UnLinkSKUIBlock($ID)
{
global $APPLICATION;
$arMsg = array();
$boolResult = true;
$ID = (int) $ID;
if (0 >= $ID) {
$arMsg[] = array('id' => 'PRODUCT_IBLOCK_ID', 'text' => Loc::getMessage('BT_MOD_CATALOG_ERR_PRODUCT_ID_INVALID'));
$boolResult = false;
}
if ($boolResult) {
$rsCatalog = CCatalog::GetList(array(), array('PRODUCT_IBLOCK_ID' => $ID), false, false, array('IBLOCK_ID'));
if ($arCatalog = $rsCatalog->Fetch()) {
$arCatalog['IBLOCK_ID'] = (int) $arCatalog['IBLOCK_ID'];
$arFields = array('PRODUCT_IBLOCK_ID' => 0, 'SKU_PROPERTY_ID' => 0);
if (!CCatalog::Update($arCatalog['IBLOCK_ID'], $arFields)) {
return false;
}
}
}
if (!$boolResult) {
$obError = new CAdminException($arMsg);
$APPLICATION->ResetException();
$APPLICATION->ThrowException($obError);
} else {
CCatalogSKU::ClearCache();
}
return $boolResult;
}
示例2: LinkSKUIBlock
public static function LinkSKUIBlock($ID, $SKUID)
{
global $APPLICATION;
global $DB;
$arMsg = array();
$boolResult = true;
$intSKUPropID = 0;
$ibp = new CIBlockProperty();
$ID = (int) $ID;
if (0 >= $ID) {
$arMsg[] = array('id' => 'PRODUCT_IBLOCK_ID', 'text' => Loc::getMessage('BT_MOD_CATALOG_ERR_PRODUCT_ID_INVALID'));
$boolResult = false;
}
$SKUID = (int) $SKUID;
if (0 >= $SKUID) {
$arMsg[] = array('id' => 'OFFERS_IBLOCK_ID', 'text' => Loc::getMessage('BT_MOD_CATALOG_ERR_OFFERS_ID_INVALID'));
$boolResult = false;
}
if ($ID == $SKUID) {
$arMsg[] = array('id' => 'OFFERS_IBLOCK_ID', 'text' => Loc::getMessage('BT_MOD_CATALOG_ERR_PRODUCT_ID_SELF'));
$boolResult = false;
}
if ($boolResult) {
$arSKUProp = false;
$rsProps = CIBlockProperty::GetList(array(), array('IBLOCK_ID' => $SKUID, 'PROPERTY_TYPE' => 'E', 'LINK_IBLOCK_ID' => $ID, 'ACTIVE' => 'Y'));
while ($arProp = $rsProps->Fetch()) {
if (is_array($arProp) && 'N' == $arProp['MULTIPLE']) {
$arSKUProp = $arProp;
break;
}
}
if (false === $arSKUProp || is_array($arSKUProp) && 'N' != $arSKUProp['MULTIPLE']) {
$arOFProperty = array('NAME' => Loc::getMessage('BT_MOD_CATALOG_MESS_SKU_PROP_NAME'), 'IBLOCK_ID' => $SKUID, 'PROPERTY_TYPE' => 'E', 'USER_TYPE' => 'SKU', 'LINK_IBLOCK_ID' => $ID, 'ACTIVE' => 'Y', 'SORT' => '5', 'MULTIPLE' => 'N', 'CODE' => 'CML2_LINK', 'XML_ID' => 'CML2_LINK', "FILTRABLE" => "Y", "SEARCHABLE" => "N");
$intSKUPropID = $ibp->Add($arOFProperty);
if (!$intSKUPropID) {
$arMsg[] = array('id' => 'SKU_PROPERTY_ID', 'text' => str_replace('#ERROR#', $ibp->LAST_ERROR, Loc::getMessage('BT_MOD_CATALOG_ERR_CREATE_SKU_PROPERTY')));
$boolResult = false;
}
} elseif ('SKU' != $arSKUProp['USER_TYPE'] || 'CML2_LINK' != $arProp['XML_ID']) {
$arFields = array('USER_TYPE' => 'SKU', 'XML_ID' => 'CML2_LINK');
$boolFlag = $ibp->Update($arSKUProp['ID'], $arFields);
if (false === $boolFlag) {
$arMsg[] = array('id' => 'SKU_PROPERTY_ID', 'text' => str_replace('#ERROR#', $ibp->LAST_ERROR, Loc::getMessage('BT_MOD_CATALOG_ERR_UPDATE_SKU_PROPERTY')));
$boolResult = false;
} else {
$intSKUPropID = $arSKUProp['ID'];
}
} else {
$intSKUPropID = $arSKUProp['ID'];
}
}
if (!$boolResult) {
$obError = new CAdminException($arMsg);
$APPLICATION->ResetException();
$APPLICATION->ThrowException($obError);
return $boolResult;
} else {
CCatalogSKU::ClearCache();
return $intSKUPropID;
}
}