本文整理汇总了PHP中CCatalog::Update方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalog::Update方法的具体用法?PHP CCatalog::Update怎么用?PHP CCatalog::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalog
的用法示例。
在下文中一共展示了CCatalog::Update方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
).'<br />';
}
}
if ($boolFlag)
{
$boolExists = isset($arCatalogList[$intIBlockID]);
$arCurValues = ($boolExists ? $arCatalogList[$intIBlockID] : array());
if ($boolExists && ('Y' == $arIBlockInfo['CATALOG'] || 'Y' == $arIBlockInfo['SUBSCRIPTION'] || 0 < $arIBlockInfo['PRODUCT_IBLOCK_ID']))
{
$boolAttr = $obCatalog->Update(
$intIBlockID,
array(
'IBLOCK_ID' => $arIBlockInfo['ID'],
'YANDEX_EXPORT' => $arIBlockInfo['YANDEX_EXPORT'],
'SUBSCRIPTION' => $arIBlockInfo['SUBSCRIPTION'],
'VAT_ID' => $arIBlockInfo['VAT_ID'],
'PRODUCT_IBLOCK_ID' => $arIBlockInfo['PRODUCT_IBLOCK_ID'],
'SKU_PROPERTY_ID' => $arIBlockInfo['SKU_PROPERTY_ID']
)
);
if (!$boolAttr)
{
$ex = $APPLICATION->GetException();
$strError = $ex->GetString();
$strWarning .= Loc::getMessage(
'CAT_IBLOCK_OFFERS_ERR_CAT_UPDATE',
array(
'#PRODUCT#' => $arIBlockInfo['INFO'],
'#ERROR#' => $strError
)
示例2: CIBlock
//IBlock fields
$iblock = new CIBlock();
$arFields = array("ACTIVE" => "Y", "FIELDS" => array('IBLOCK_SECTION' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'ACTIVE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'Y'), 'ACTIVE_FROM' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'ACTIVE_TO' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SORT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'NAME' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => ''), 'PREVIEW_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('FROM_DETAIL' => 'N', 'SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95, 'DELETE_WITH_DETAIL' => 'N', 'UPDATE_WITH_DETAIL' => 'N')), 'PREVIEW_TEXT_TYPE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text'), 'PREVIEW_TEXT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'DETAIL_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95)), 'DETAIL_TEXT_TYPE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text'), 'DETAIL_TEXT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'XML_ID' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'CODE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('UNIQUE' => 'Y', 'TRANSLITERATION' => 'Y', 'TRANS_LEN' => 100, 'TRANS_CASE' => 'L', 'TRANS_SPACE' => '_', 'TRANS_OTHER' => '_', 'TRANS_EAT' => 'Y', 'USE_GOOGLE' => 'Y')), 'TAGS' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_NAME' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('FROM_DETAIL' => 'N', 'SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95, 'DELETE_WITH_DETAIL' => 'N', 'UPDATE_WITH_DETAIL' => 'N')), 'SECTION_DESCRIPTION_TYPE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => 'text'), 'SECTION_DESCRIPTION' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_DETAIL_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95)), 'SECTION_XML_ID' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_CODE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('UNIQUE' => 'Y', 'TRANSLITERATION' => 'Y', 'TRANS_LEN' => 100, 'TRANS_CASE' => 'L', 'TRANS_SPACE' => '_', 'TRANS_OTHER' => '_', 'TRANS_EAT' => 'Y', 'USE_GOOGLE' => 'Y'))), "CODE" => "clothes_offers", "XML_ID" => $iblockCodeOffers);
$iblock->Update($IBLOCK_OFFERS_ID, $arFields);
}
if ($IBLOCK_CATALOG_ID) {
$iblockCode = "clothes_" . WIZARD_SITE_ID;
//IBlock fields
$iblock = new CIBlock();
$arFields = array("ACTIVE" => "Y", "FIELDS" => array('IBLOCK_SECTION' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => ''), 'ACTIVE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'Y'), 'ACTIVE_FROM' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'ACTIVE_TO' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SORT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'NAME' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => ''), 'PREVIEW_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('FROM_DETAIL' => 'N', 'SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95, 'DELETE_WITH_DETAIL' => 'N', 'UPDATE_WITH_DETAIL' => 'N')), 'PREVIEW_TEXT_TYPE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text'), 'PREVIEW_TEXT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'DETAIL_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95)), 'DETAIL_TEXT_TYPE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text'), 'DETAIL_TEXT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'XML_ID' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'CODE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => array('UNIQUE' => 'Y', 'TRANSLITERATION' => 'Y', 'TRANS_LEN' => 100, 'TRANS_CASE' => 'L', 'TRANS_SPACE' => '_', 'TRANS_OTHER' => '_', 'TRANS_EAT' => 'Y', 'USE_GOOGLE' => 'Y')), 'TAGS' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_NAME' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => ''), 'SECTION_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('FROM_DETAIL' => 'N', 'SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95, 'DELETE_WITH_DETAIL' => 'N', 'UPDATE_WITH_DETAIL' => 'N')), 'SECTION_DESCRIPTION_TYPE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text'), 'SECTION_DESCRIPTION' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_DETAIL_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95)), 'SECTION_XML_ID' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_CODE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => array('UNIQUE' => 'Y', 'TRANSLITERATION' => 'Y', 'TRANS_LEN' => 100, 'TRANS_CASE' => 'L', 'TRANS_SPACE' => '_', 'TRANS_OTHER' => '_', 'TRANS_EAT' => 'Y', 'USE_GOOGLE' => 'Y'))), "CODE" => "clothes", "XML_ID" => $iblockCode);
$iblock->Update($IBLOCK_CATALOG_ID, $arFields);
if ($IBLOCK_OFFERS_ID) {
$ID_SKU = CCatalog::LinkSKUIBlock($IBLOCK_CATALOG_ID, $IBLOCK_OFFERS_ID);
$rsCatalogs = CCatalog::GetList(array(), array('IBLOCK_ID' => $IBLOCK_OFFERS_ID), false, false, array('IBLOCK_ID'));
if ($arCatalog = $rsCatalogs->Fetch()) {
CCatalog::Update($IBLOCK_OFFERS_ID, array('PRODUCT_IBLOCK_ID' => $IBLOCK_CATALOG_ID, 'SKU_PROPERTY_ID' => $ID_SKU));
} else {
CCatalog::Add(array('IBLOCK_ID' => $IBLOCK_OFFERS_ID, 'PRODUCT_IBLOCK_ID' => $IBLOCK_CATALOG_ID, 'SKU_PROPERTY_ID' => $ID_SKU));
}
//create facet index
$index = \Bitrix\Iblock\PropertyIndex\Manager::createIndexer($IBLOCK_CATALOG_ID);
$index->startIndex();
$index->continueIndex(0);
$index->endIndex();
$index = \Bitrix\Iblock\PropertyIndex\Manager::createIndexer($IBLOCK_OFFERS_ID);
$index->startIndex();
$index->continueIndex(0);
$index->endIndex();
\Bitrix\Iblock\PropertyIndex\Manager::checkAdminNotification();
}
//user fields for sections
示例3: ImportMetaData
function ImportMetaData($xml_root_id, $IBLOCK_TYPE, $IBLOCK_LID, $bUpdateIBlock = true)
{
global $APPLICATION;
$rs = $this->_xml_file->GetList(array("ID" => "asc"), array("ID" => $xml_root_id), array("ID", "NAME", "ATTRIBUTES"));
$ar = $rs->Fetch();
if ($ar) {
foreach (array(LANGUAGE_ID, "en", "ru") as $lang) {
$mess = IncludeModuleLangFile(__FILE__, $lang, true);
if ($ar["NAME"] === $mess["IBLOCK_XML2_COMMERCE_INFO"]) {
$this->mess = $mess;
$this->next_step["lang"] = $lang;
}
}
$xml_root_id = $ar["ID"];
}
if ($ar && strlen($ar["ATTRIBUTES"]) > 0) {
$info = unserialize($ar["ATTRIBUTES"]);
if (is_array($info) && array_key_exists($this->mess["IBLOCK_XML2_SUM_FORMAT"], $info)) {
if (preg_match("#" . $this->mess["IBLOCK_XML2_SUM_FORMAT_DELIM"] . "=(.);{0,1}#", $info[$this->mess["IBLOCK_XML2_SUM_FORMAT"]], $match)) {
$this->next_step["sdp"] = $match[1];
}
}
}
$meta_data_xml_id = false;
$XML_ELEMENTS_PARENT = false;
$XML_SECTIONS_PARENT = false;
$XML_PROPERTIES_PARENT = false;
$XML_SECTIONS_PROPERTIES_PARENT = false;
$XML_PRICES_PARENT = false;
$XML_STORES_PARENT = false;
$XML_BASE_UNITS_PARENT = false;
$XML_SECTION_PROPERTIES = false;
$arIBlock = array();
$this->next_step["bOffer"] = false;
$rs = $this->_xml_file->GetList(array(), array("PARENT_ID" => $xml_root_id, "NAME" => $this->mess["IBLOCK_XML2_CATALOG"]), array("ID", "ATTRIBUTES"));
$ar = $rs->Fetch();
if (!$ar) {
$rs = $this->_xml_file->GetList(array(), array("PARENT_ID" => $xml_root_id, "NAME" => $this->mess["IBLOCK_XML2_OFFER_LIST"]), array("ID", "ATTRIBUTES"));
$ar = $rs->Fetch();
$this->next_step["bOffer"] = true;
}
if (!$ar) {
$rs = $this->_xml_file->GetList(array(), array("PARENT_ID" => $xml_root_id, "NAME" => $this->mess["IBLOCK_XML2_OFFERS_CHANGE"]), array("ID", "ATTRIBUTES"));
$ar = $rs->Fetch();
$this->next_step["bOffer"] = true;
$this->next_step["bUpdateOnly"] = true;
$bUpdateIBlock = false;
}
if ($this->next_step["bOffer"] && !$this->bCatalog) {
return GetMessage('IBLOCK_XML2_MODULE_CATALOG_IS_ABSENT');
}
if ($ar) {
if (strlen($ar["ATTRIBUTES"]) > 0) {
$attrs = unserialize($ar["ATTRIBUTES"]);
if (is_array($attrs)) {
if (array_key_exists($this->mess["IBLOCK_XML2_UPDATE_ONLY"], $attrs)) {
$this->next_step["bUpdateOnly"] = $attrs[$this->mess["IBLOCK_XML2_UPDATE_ONLY"]] == "true" || intval($attrs[$this->mess["IBLOCK_XML2_UPDATE_ONLY"]]) ? true : false;
}
}
}
$rs = $this->_xml_file->GetList(array("ID" => "asc"), array("PARENT_ID" => $ar["ID"]));
while ($ar = $rs->Fetch()) {
if (isset($ar["VALUE_CLOB"])) {
$ar["VALUE"] = $ar["VALUE_CLOB"];
}
if ($ar["NAME"] == $this->mess["IBLOCK_XML2_ID"]) {
$arIBlock["XML_ID"] = ($this->use_iblock_type_id ? $IBLOCK_TYPE . "-" : "") . $ar["VALUE"];
} elseif ($ar["NAME"] == $this->mess["IBLOCK_XML2_CATALOG_ID"]) {
$arIBlock["CATALOG_XML_ID"] = ($this->use_iblock_type_id ? $IBLOCK_TYPE . "-" : "") . $ar["VALUE"];
} elseif ($ar["NAME"] == $this->mess["IBLOCK_XML2_NAME"]) {
$arIBlock["NAME"] = $ar["VALUE"];
} elseif ($ar["NAME"] == $this->mess["IBLOCK_XML2_DESCRIPTION"]) {
$arIBlock["DESCRIPTION"] = $ar["VALUE"];
$arIBlock["DESCRIPTION_TYPE"] = "html";
} elseif ($ar["NAME"] == $this->mess["IBLOCK_XML2_POSITIONS"] || $ar["NAME"] == $this->mess["IBLOCK_XML2_OFFERS"]) {
$XML_ELEMENTS_PARENT = $ar["ID"];
} elseif ($ar["NAME"] == $this->mess["IBLOCK_XML2_PRICE_TYPES"]) {
$XML_PRICES_PARENT = $ar["ID"];
} elseif ($ar["NAME"] == $this->mess["IBLOCK_XML2_STORES"]) {
$XML_STORES_PARENT = $ar["ID"];
} elseif ($ar["NAME"] == $this->mess["IBLOCK_XML2_BASE_UNITS"]) {
$XML_BASE_UNITS_PARENT = $ar["ID"];
} elseif ($ar["NAME"] == $this->mess["IBLOCK_XML2_METADATA_ID"]) {
$meta_data_xml_id = $ar["VALUE"];
} elseif ($ar["NAME"] == $this->mess["IBLOCK_XML2_UPDATE_ONLY"]) {
$this->next_step["bUpdateOnly"] = $ar["VALUE"] == "true" || intval($ar["VALUE"]) ? true : false;
} elseif ($ar["NAME"] == $this->mess["IBLOCK_XML2_BX_CODE"]) {
$arIBlock["CODE"] = $ar["VALUE"];
} elseif ($ar["NAME"] == $this->mess["IBLOCK_XML2_BX_SORT"]) {
$arIBlock["SORT"] = $ar["VALUE"];
} elseif ($ar["NAME"] == $this->mess["IBLOCK_XML2_BX_LIST_URL"]) {
$arIBlock["LIST_PAGE_URL"] = $ar["VALUE"];
} elseif ($ar["NAME"] == $this->mess["IBLOCK_XML2_BX_DETAIL_URL"]) {
$arIBlock["DETAIL_PAGE_URL"] = $ar["VALUE"];
} elseif ($ar["NAME"] == $this->mess["IBLOCK_XML2_BX_SECTION_URL"]) {
$arIBlock["SECTION_PAGE_URL"] = $ar["VALUE"];
} elseif ($ar["NAME"] == $this->mess["IBLOCK_XML2_BX_CANONICAL_URL"]) {
$arIBlock["CANONICAL_PAGE_URL"] = $ar["VALUE"];
} elseif ($ar["NAME"] == $this->mess["IBLOCK_XML2_BX_INDEX_ELEMENTS"]) {
$arIBlock["INDEX_ELEMENT"] = $ar["VALUE"] == "true" || intval($ar["VALUE"]) ? "Y" : "N";
//.........这里部分代码省略.........
示例4: GetMessage
$strWarning .= GetMessage('IB_E_OF_ERR_USED_SKU') . '<br>';
}
if (!$bVarsFromForm) {
$IS_CATALOG = 'Y' == $IS_CATALOG ? 'Y' : 'N';
$SUBSCRIPTION = 'Y' == $SUBSCRIPTION ? 'Y' : 'N';
if (!CBXFeatures::IsFeatureEnabled('SaleRecurring')) {
$SUBSCRIPTION = 'N';
}
$YANDEX_EXPORT = 'Y' == $YANDEX_EXPORT ? 'Y' : 'N';
$VAT_ID = 0 < intval($VAT_ID) ? intval($VAT_ID) : 0;
//$SKU_RIGHTS = ('Y' == $SKU_RIGHTS ? 'Y' : 'N');
$SKU_RIGHTS = 'N';
if (is_array($arCatalog) && $arCatalog['CATALOG_TYPE'] == 'O') {
$IS_CATALOG = 'Y';
$arOffersFields = array('IBLOCK_ID' => $ID, 'SUBSCRIPTION' => $SUBSCRIPTION, 'YANDEX_EXPORT' => $YANDEX_EXPORT, 'VAT_ID' => $VAT_ID);
$boolFlag = $obCatalog->Update($ID, $arOffersFields);
if (false == $boolFlag) {
$bVarsFromForm = true;
if ($ex = $APPLICATION->GetException()) {
$strWarning .= $ex->GetString() . "<br>";
}
} else {
$boolNeedAgent = $YANDEX_EXPORT != $arCatalog['YANDEX_EXPORT'];
}
} else {
$arOffersFields = array('IBLOCK_ID' => $ID, 'SUBSCRIPTION' => $SUBSCRIPTION, 'YANDEX_EXPORT' => $YANDEX_EXPORT, 'VAT_ID' => $VAT_ID);
if (false == $arCatalog || 'P' == $arCatalog['CATALOG_TYPE']) {
if ($IS_CATALOG == 'Y') {
$boolFlag = $obCatalog->Add($arOffersFields);
}
if ($boolFlag && $arOffersFields['YANDEX_EXPORT'] == 'Y') {
示例5: ImportMetaData
function ImportMetaData($xml_root_id, $IBLOCK_TYPE, $IBLOCK_LID, $bUpdateIBlock = true)
{
global $APPLICATION;
$rs = $this->_xml_file->GetList(
array(),
array("ID" => $xml_root_id, "NAME" => GetMessage("IBLOCK_XML2_COMMERCE_INFO")),
array("ID", "ATTRIBUTES")
);
$ar = $rs->Fetch();
if($ar && (strlen($ar["ATTRIBUTES"]) > 0))
{
$info = unserialize($ar["ATTRIBUTES"]);
if(is_array($info) && array_key_exists(GetMessage("IBLOCK_XML2_SUM_FORMAT"), $info))
{
if(preg_match("#".GetMessage("IBLOCK_XML2_SUM_FORMAT_DELIM")."=(.);{0,1}#", $info[GetMessage("IBLOCK_XML2_SUM_FORMAT")], $match))
{
$this->next_step["sdp"] = $match[1];
}
}
}
$meta_data_xml_id = false;
$XML_ELEMENTS_PARENT = false;
$XML_SECTIONS_PARENT = false;
$XML_PROPERTIES_PARENT = false;
$XML_SECTIONS_PROPERTIES_PARENT = false;
$XML_PRICES_PARENT = false;
$XML_STORES_PARENT = false;
$XML_SECTION_PROPERTIES = false;
$arIBlock = array();
$this->next_step["bOffer"] = false;
$rs = $this->_xml_file->GetList(
array(),
array("PARENT_ID" => $xml_root_id, "NAME" => GetMessage("IBLOCK_XML2_CATALOG")),
array("ID", "ATTRIBUTES")
);
$ar = $rs->Fetch();
if(!$ar)
{
$rs = $this->_xml_file->GetList(
array(),
array("PARENT_ID" => $xml_root_id, "NAME" => GetMessage("IBLOCK_XML2_OFFER_LIST")),
array("ID", "ATTRIBUTES")
);
$ar = $rs->Fetch();
$this->next_step["bOffer"] = true;
}
if($ar)
{
if(strlen($ar["ATTRIBUTES"]) > 0)
{
$attrs = unserialize($ar["ATTRIBUTES"]);
if(is_array($attrs))
{
if(array_key_exists(GetMessage("IBLOCK_XML2_UPDATE_ONLY"), $attrs))
$this->next_step["bUpdateOnly"] = ($attrs[GetMessage("IBLOCK_XML2_UPDATE_ONLY")]=="true") || intval($attrs["IBLOCK_XML2_UPDATE_ONLY"])? true: false;
}
}
$rs = $this->_xml_file->GetList(
array("ID" => "asc"),
array("PARENT_ID" => $ar["ID"])
);
while($ar = $rs->Fetch())
{
if(isset($ar["VALUE_CLOB"]))
$ar["VALUE"] = $ar["VALUE_CLOB"];
if($ar["NAME"] == GetMessage("IBLOCK_XML2_ID"))
$arIBlock["XML_ID"] = ($this->use_iblock_type_id? $IBLOCK_TYPE."-": "").$ar["VALUE"];
elseif($ar["NAME"] == GetMessage("IBLOCK_XML2_CATALOG_ID"))
$arIBlock["CATALOG_XML_ID"] = ($this->use_iblock_type_id? $IBLOCK_TYPE."-": "").$ar["VALUE"];
elseif($ar["NAME"] == GetMessage("IBLOCK_XML2_NAME"))
$arIBlock["NAME"] = $ar["VALUE"];
elseif($ar["NAME"] == GetMessage("IBLOCK_XML2_DESCRIPTION"))
{
$arIBlock["DESCRIPTION"] = $ar["VALUE"];
$arIBlock["DESCRIPTION_TYPE"] = "html";
}
elseif($ar["NAME"] == GetMessage("IBLOCK_XML2_POSITIONS") || $ar["NAME"] == GetMessage("IBLOCK_XML2_OFFERS"))
$XML_ELEMENTS_PARENT = $ar["ID"];
elseif($ar["NAME"] == GetMessage("IBLOCK_XML2_PRICE_TYPES"))
$XML_PRICES_PARENT = $ar["ID"];
elseif($ar["NAME"] == GetMessage("IBLOCK_XML2_STORES"))
$XML_STORES_PARENT = $ar["ID"];
elseif($ar["NAME"] == GetMessage("IBLOCK_XML2_METADATA_ID"))
$meta_data_xml_id = $ar["VALUE"];
elseif($ar["NAME"] == GetMessage("IBLOCK_XML2_UPDATE_ONLY"))
$this->next_step["bUpdateOnly"] = ($ar["VALUE"]=="true") || intval($ar["VALUE"])? true: false;
elseif($ar["NAME"] == GetMessage("IBLOCK_XML2_BX_CODE"))
$arIBlock["CODE"] = $ar["VALUE"];
elseif($ar["NAME"] == GetMessage("IBLOCK_XML2_BX_SORT"))
$arIBlock["SORT"] = $ar["VALUE"];
elseif($ar["NAME"] == GetMessage("IBLOCK_XML2_BX_LIST_URL"))
$arIBlock["LIST_PAGE_URL"] = $ar["VALUE"];
elseif($ar["NAME"] == GetMessage("IBLOCK_XML2_BX_DETAIL_URL"))
$arIBlock["DETAIL_PAGE_URL"] = $ar["VALUE"];
//.........这里部分代码省略.........
示例6: 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;
}
示例7: CIBlock
if ($IBLOCK_OFFERS_ID < 1) {
return;
}
//IBlock fields
$iblock = new CIBlock();
$arFields = array("ACTIVE" => "Y", "FIELDS" => array('IBLOCK_SECTION' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'ACTIVE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'Y'), 'ACTIVE_FROM' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'ACTIVE_TO' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SORT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'NAME' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => ''), 'PREVIEW_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('FROM_DETAIL' => 'N', 'SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95, 'DELETE_WITH_DETAIL' => 'N', 'UPDATE_WITH_DETAIL' => 'N')), 'PREVIEW_TEXT_TYPE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text'), 'PREVIEW_TEXT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'DETAIL_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95)), 'DETAIL_TEXT_TYPE' => array('IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text'), 'DETAIL_TEXT' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'XML_ID' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'CODE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('UNIQUE' => 'Y', 'TRANSLITERATION' => 'Y', 'TRANS_LEN' => 100, 'TRANS_CASE' => 'L', 'TRANS_SPACE' => '_', 'TRANS_OTHER' => '_', 'TRANS_EAT' => 'Y', 'USE_GOOGLE' => 'Y')), 'TAGS' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_NAME' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('FROM_DETAIL' => 'N', 'SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95, 'DELETE_WITH_DETAIL' => 'N', 'UPDATE_WITH_DETAIL' => 'N')), 'SECTION_DESCRIPTION_TYPE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => 'text'), 'SECTION_DESCRIPTION' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_DETAIL_PICTURE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', 'METHOD' => 'resample', 'COMPRESSION' => 95)), 'SECTION_XML_ID' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => ''), 'SECTION_CODE' => array('IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array('UNIQUE' => 'Y', 'TRANSLITERATION' => 'Y', 'TRANS_LEN' => 100, 'TRANS_CASE' => 'L', 'TRANS_SPACE' => '_', 'TRANS_OTHER' => '_', 'TRANS_EAT' => 'Y', 'USE_GOOGLE' => 'Y'))), "CODE" => "furniture_offers", "XML_ID" => $iblockCode);
$iblock->Update($IBLOCK_OFFERS_ID, $arFields);
$iblockCodeFur = "furniture_" . WIZARD_SITE_ID;
$iblockTypeFur = "catalog";
$rsIBlockFur = CIBlock::GetList(array(), array("XML_ID" => $iblockCodeFur, "TYPE" => $iblockTypeFur));
if ($arIBlockFur = $rsIBlockFur->Fetch()) {
$ID_SKU = CCatalog::LinkSKUIBlock($arIBlockFur["ID"], $IBLOCK_OFFERS_ID);
}
$arCatalog = CCatalog::GetByID($IBLOCK_OFFERS_ID);
if ($arCatalog) {
CCatalog::Update($IBLOCK_OFFERS_ID, array('PRODUCT_IBLOCK_ID' => $arIBlockFur["ID"], 'SKU_PROPERTY_ID' => $ID_SKU));
} else {
CCatalog::Add(array('IBLOCK_ID' => $IBLOCK_OFFERS_ID, 'PRODUCT_IBLOCK_ID' => $arIBlockFur["ID"], 'SKU_PROPERTY_ID' => $ID_SKU));
}
$dbOfferProps = CIblock::GetProperties($IBLOCK_OFFERS_ID, array(), array());
while ($arOfferProps = $dbOfferProps->Fetch()) {
$arProps[$arOfferProps["XML_ID"]] = $arOfferProps["ID"];
}
$property_enums = CIBlockPropertyEnum::GetList(array(), array("IBLOCK_ID" => $IBLOCK_OFFERS_ID, "CODE" => "WIDTH"));
$arEnumIds = array();
while ($enum_fields = $property_enums->GetNext()) {
$arEnumIds[] = $enum_fields["ID"];
}
$dbElement = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $arIBlockFur["ID"], "XML_ID" => 56), false);
$arElement = $dbElement->Fetch();
$arOfferElements[] = array("PRODUCT" => array("IBLOCK_ID" => $IBLOCK_OFFERS_ID, "NAME" => GetMessage("CAT_OFFER_NAME_1"), "ACTIVE" => "Y", "PROPERTY_VALUES" => array($arProps["CML2_LINK"] => $arElement["ID"], $arProps["327"] => $arEnumIds[0], $arProps["329"] => GetMessage("CAT_OFFER_COLOR_1"))), "PRICE" => GetMessage("CAT_OFFER_PRICE_11"));
示例8: UnLinkSKUIBlock
function UnLinkSKUIBlock($ID)
{
global $APPLICATION;
global $DB;
$arMsg = array();
$boolResult = true;
$ID = intval($ID);
if (0 >= $ID) {
$arMsg[] = array('id' => 'PRODUCT_IBLOCK_ID', 'text' => GetMessage('BT_MOD_CATALOG_ERR_PRODUCT_ID_INVALID'));
$boolResult = false;
}
if ($boolResult) {
$rsCatalog = CCatalog::GetList(array(), array('PRODUCT_IBLOCK_ID' => $ID));
if ($arCatalog = $rsCatalog->Fetch()) {
$arFields = $arCatalog;
$arFields['PRODUCT_IBLOCK_ID'] = 0;
$arFields['SKU_PROPERTY_ID'] = 0;
CCatalog::Update($arCatalog['IBLOCK_ID'], $arFields);
if (is_set($GLOBALS["CATALOG_CATALOG_CACHE"], $arCatalog['IBLOCK_ID'])) {
unset($GLOBALS["CATALOG_CATALOG_CACHE"][$arCatalog['IBLOCK_ID']]);
}
}
}
if (!$boolResult) {
$obError = new CAdminException($arMsg);
$APPLICATION->ResetException();
$APPLICATION->ThrowException($obError);
}
return $boolResult;
}
示例9: dirname
}
//Library
include_once dirname(__FILE__) . "/iblock_tools.php";
__IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", "/" . basename(__FILE__)));
//Parameters
if (!is_array($arParams)) {
$arParams = array();
}
if (strlen($arParams["site_id"]) <= 0) {
$arParams["site_id"] = "s1";
}
//Import XML
if ($IBLOCK_ID = DEMO_IBlock_ImportXML("110_paid_paid-articles_" . LANGUAGE_ID . ".xml", $arParams["site_id"], false, true)) {
$_SESSION["DEMO_IBLOCK_PAID"] = CIBlockCMLImport::GetIBlockByXML_ID("paid-subscribe");
if ($SUBSCR_ID = DEMO_IBlock_ImportXML("120_paid_paid-subscribe_" . LANGUAGE_ID . ".xml", $arParams["site_id"], false, true)) {
$SUBSCR_GROUP_ID = DEMO_IBlock_AddUserGroup("subscribers", GetMessage("DEMO_IBLOCK_ESTORE_PAID_GROUP_NAME"), GetMessage("DEMO_IBLOCK_ESTORE_PAID_GROUP_DESC"));
//Create directory and copy files
$search = array("#IBLOCK.ID(XML_ID=paid-articles)#", "#IBLOCK.ID(XML_ID=paid-subscribe)#", "#USER_GROUP.ID(STRING_ID=subscribers)#");
$replace = array($IBLOCK_ID, $SUBSCR_ID, $SUBSCR_GROUP_ID);
DEMO_IBlock_CopyFiles("/public/e-store/paid/", "/e-store/paid/", false, $search, $replace);
CopyDirFiles(dirname(__FILE__) . "/public/language/" . LANGUAGE_ID . "/e-store/paid/", $_SERVER["DOCUMENT_ROOT"] . "/e-store/paid", false, true);
//Add menu item
DEMO_IBlock_AddMenuItem("/e-store/.left.menu.php", array(GetMessage("DEMO_IBLOCK_ESTORE_PAID_MENU"), "/e-store/paid/", array(), array(), ""));
if ($_SESSION["DEMO_IBLOCK_PAID"] === false) {
DEMO_IBlock_ImportXML("120_paid_paid-subscribe-offers_" . LANGUAGE_ID . ".xml", $arParams["site_id"], true, false);
if (CModule::IncludeModule('catalog')) {
CCatalog::Update($SUBSCR_ID, array("SUBSCRIPTION" => "Y"));
}
}
}
}