本文整理汇总了PHP中CCatalog::LinkSKUIBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalog::LinkSKUIBlock方法的具体用法?PHP CCatalog::LinkSKUIBlock怎么用?PHP CCatalog::LinkSKUIBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalog
的用法示例。
在下文中一共展示了CCatalog::LinkSKUIBlock方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CIBlock
}*/
if ($IBLOCK_OFFERS_ID) {
$iblockCodeOffers = "clothes_offers_" . WIZARD_SITE_ID;
//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();
示例2: ImportMetaData
//.........这里部分代码省略.........
if($bUpdateIBlock && (!$this->next_step["bOffer"] || $this->use_offers))
{
if($obIBlock->Update($ar["ID"], $arIBlock))
$arIBlock["ID"] = $ar["ID"];
else
return $obIBlock->LAST_ERROR;
}
else
{
$arIBlock["ID"] = $ar["ID"];
}
}
else
{
$arIBlock["IBLOCK_TYPE_ID"] = $this->CheckIBlockType($IBLOCK_TYPE);
if(!$arIBlock["IBLOCK_TYPE_ID"])
return GetMessage("IBLOCK_XML2_TYPE_ADD_ERROR");
$arIBlock["GROUP_ID"] = array(2=>"R");
$arIBlock["LID"] = $this->CheckSites($IBLOCK_LID);
$arIBlock["ACTIVE"] = "Y";
$arIBlock["WORKFLOW"] = "N";
$arIBlock["ID"] = $obIBlock->Add($arIBlock);
if(!$arIBlock["ID"])
return $obIBlock->LAST_ERROR;
}
//Make this catalog
if($this->bCatalog && $this->next_step["bOffer"])
{
$obCatalog = new CCatalog();
$intParentID = $this->GetIBlockByXML_ID($arIBlock["CATALOG_XML_ID"]);
if (0 < intval($intParentID) && $this->use_offers)
{
$mxSKUProp = $obCatalog->LinkSKUIBlock($intParentID,$arIBlock["ID"]);
if (!$mxSKUProp)
{
if ($ex = $APPLICATION->GetException())
{
$result = $ex->GetString();
return $result;
}
}
else
{
$rs = CCatalog::GetList(array(),array("IBLOCK_ID"=>$arIBlock["ID"]));
if($arOffer = $rs->Fetch())
{
$boolFlag = $obCatalog->Update($arIBlock["ID"],array('PRODUCT_IBLOCK_ID' => $intParentID,'SKU_PROPERTY_ID' => $mxSKUProp));
}
else
{
$boolFlag = $obCatalog->Add(array("IBLOCK_ID"=>$arIBlock["ID"], "YANDEX_EXPORT"=>"N", "SUBSCRIPTION"=>"N",'PRODUCT_IBLOCK_ID' => $intParentID,'SKU_PROPERTY_ID' => $mxSKUProp));
}
if (!$boolFlag)
{
if ($ex = $APPLICATION->GetException())
{
$result = $ex->GetString();
return $result;
}
}
}
}
else
{
$rs = CCatalog::GetList(array(),array("IBLOCK_ID"=>$arIBlock["ID"]));
示例3: ImportMetaData
//.........这里部分代码省略.........
}
if ($ar) {
if ($bUpdateIBlock && (!$this->next_step["bOffer"] || $this->use_offers)) {
if ($obIBlock->Update($ar["ID"], $arIBlock)) {
$arIBlock["ID"] = $ar["ID"];
} else {
return $obIBlock->LAST_ERROR;
}
} else {
$arIBlock["ID"] = $ar["ID"];
}
} else {
$arIBlock["IBLOCK_TYPE_ID"] = $this->CheckIBlockType($IBLOCK_TYPE);
if (!$arIBlock["IBLOCK_TYPE_ID"]) {
return GetMessage("IBLOCK_XML2_TYPE_ADD_ERROR");
}
$arIBlock["GROUP_ID"] = array(2 => "R");
$arIBlock["LID"] = $this->CheckSites($IBLOCK_LID);
$arIBlock["ACTIVE"] = "Y";
$arIBlock["WORKFLOW"] = "N";
if ($this->translit_on_add && !array_key_exists("CODE", $arIBlock)) {
$arIBlock["FIELDS"] = array("CODE" => array("DEFAULT_VALUE" => array("TRANSLITERATION" => "Y", "TRANS_LEN" => $this->translit_on_add["max_len"], "TRANS_CASE" => $this->translit_on_add["change_case"], "TRANS_SPACE" => $this->translit_on_add["replace_space"], "TRANS_OTHER" => $this->translit_on_add["replace_other"], "TRANS_EAT" => $this->translit_on_add["delete_repeat_replace"] ? "Y" : "N")), "SECTION_CODE" => array("DEFAULT_VALUE" => array("TRANSLITERATION" => "Y", "TRANS_LEN" => $this->translit_on_add["max_len"], "TRANS_CASE" => $this->translit_on_add["change_case"], "TRANS_SPACE" => $this->translit_on_add["replace_space"], "TRANS_OTHER" => $this->translit_on_add["replace_other"], "TRANS_EAT" => $this->translit_on_add["delete_repeat_replace"] ? "Y" : "N")));
}
$arIBlock["ID"] = $obIBlock->Add($arIBlock);
if (!$arIBlock["ID"]) {
return $obIBlock->LAST_ERROR;
}
}
//Make this catalog
if ($this->bCatalog && $this->next_step["bOffer"]) {
$obCatalog = new CCatalog();
$intParentID = $this->GetIBlockByXML_ID($arIBlock["CATALOG_XML_ID"]);
if (0 < intval($intParentID) && $this->use_offers) {
$mxSKUProp = $obCatalog->LinkSKUIBlock($intParentID, $arIBlock["ID"]);
if (!$mxSKUProp) {
if ($ex = $APPLICATION->GetException()) {
$result = $ex->GetString();
return $result;
}
} else {
$rs = CCatalog::GetList(array(), array("IBLOCK_ID" => $arIBlock["ID"]));
if ($arOffer = $rs->Fetch()) {
$boolFlag = $obCatalog->Update($arIBlock["ID"], array('PRODUCT_IBLOCK_ID' => $intParentID, 'SKU_PROPERTY_ID' => $mxSKUProp));
} else {
$boolFlag = $obCatalog->Add(array("IBLOCK_ID" => $arIBlock["ID"], "YANDEX_EXPORT" => "N", "SUBSCRIPTION" => "N", 'PRODUCT_IBLOCK_ID' => $intParentID, 'SKU_PROPERTY_ID' => $mxSKUProp));
}
if (!$boolFlag) {
if ($ex = $APPLICATION->GetException()) {
$result = $ex->GetString();
return $result;
}
}
}
} else {
$rs = CCatalog::GetList(array(), array("IBLOCK_ID" => $arIBlock["ID"]));
if (!$rs->Fetch()) {
$boolFlag = $obCatalog->Add(array("IBLOCK_ID" => $arIBlock["ID"], "YANDEX_EXPORT" => "N", "SUBSCRIPTION" => "N"));
if (!$boolFlag) {
if ($ex = $APPLICATION->GetException()) {
$result = $ex->GetString();
return $result;
}
}
}
}
}
示例4: CIBlock
if ($arGroup = $dbGroup->Fetch()) {
$permissions[$arGroup["ID"]] = 'W';
}
$IBLOCK_OFFERS_ID = WizardServices::ImportIBlockFromXML($iblockXMLFile, "furniture_offers", $iblockType, WIZARD_SITE_ID, $permissions);
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"];