示例#1
0
$strSaveWithoutPrice = '';
$boolCatalogRead = false;
$boolCatalogPrice = false;
$boolCatalogPurchasInfo = false;
$boolCatalogSet = false;
$arProductTypeList = array();
$showCatalogWithOffers = false;
if ($bCatalog)
{
	$strUseStoreControl = COption::GetOptionString("catalog", "default_use_store_control");
	$strSaveWithoutPrice = COption::GetOptionString('catalog','save_product_without_price','N');
	$boolCatalogRead = $USER->CanDoOperation('catalog_read');
	$boolCatalogPrice = $USER->CanDoOperation('catalog_price');
	$boolCatalogPurchasInfo = $USER->CanDoOperation('catalog_purchas_info');
	$boolCatalogSet = CBXFeatures::IsFeatureEnabled('CatCompleteSet');
	$arCatalog = CCatalogSKU::GetInfoByIBlock($arIBlock["ID"]);
	if (empty($arCatalog))
	{
		$bCatalog = false;
	}
	else
	{
		if (CCatalogSKU::TYPE_PRODUCT == $arCatalog['CATALOG_TYPE'] || CCatalogSKU::TYPE_FULL == $arCatalog['CATALOG_TYPE'])
		{
			if (CIBlockRights::UserHasRightTo($arCatalog['IBLOCK_ID'], $arCatalog['IBLOCK_ID'], "iblock_admin_display"))
			{
				$boolSKU = true;
				$strSKUName = GetMessage('IBLIST_A_OFFERS');
			}
		}
		if (CCatalogSKU::TYPE_PRODUCT == $arCatalog['CATALOG_TYPE'])
示例#2
0
     $rsPath->SetUrlTemplates("", $arParams["SECTION_URL"]);
     while ($arPath = $rsPath->GetNext()) {
         $ipropValues = new \Bitrix\Iblock\InheritedProperty\SectionValues($arParams["IBLOCK_ID"], $arPath["ID"]);
         $arPath["IPROPERTY_VALUES"] = $ipropValues->getValues();
         $arResult["PATH"][] = $arPath;
     }
 }
 $bIBlockCatalog = false;
 $bOffersIBlockExist = false;
 $arCatalog = false;
 $boolNeedCatalogCache = false;
 $bCatalog = Loader::includeModule('catalog');
 if ($bCatalog) {
     $arResultModules['catalog'] = true;
     $arResultModules['currency'] = true;
     $arCatalog = CCatalogSKU::GetInfoByIBlock($arParams["IBLOCK_ID"]);
     if (!empty($arCatalog) && is_array($arCatalog)) {
         $bIBlockCatalog = $arCatalog['CATALOG_TYPE'] != CCatalogSKU::TYPE_PRODUCT;
         $bOffersIBlockExist = $arCatalog['CATALOG_TYPE'] == CCatalogSKU::TYPE_PRODUCT || $arCatalog['CATALOG_TYPE'] == CCatalogSKU::TYPE_FULL;
         $boolNeedCatalogCache = true;
     }
 }
 $arResult['CATALOG'] = $arCatalog;
 //This function returns array with prices description and access rights
 //in case catalog module n/a prices get values from element properties
 $arResult["PRICES"] = CIBlockPriceTools::GetCatalogPrices($arParams["IBLOCK_ID"], $arParams["PRICE_CODE"]);
 $arResult['PRICES_ALLOW'] = CIBlockPriceTools::GetAllowCatalogPrices($arResult["PRICES"]);
 if ($bCatalog && $boolNeedCatalogCache && !empty($arResult['PRICES_ALLOW'])) {
     $boolNeedCatalogCache = CIBlockPriceTools::SetCatalogDiscountCache($arResult['PRICES_ALLOW'], $USER->GetUserGroupArray());
 }
 $arResult['CONVERT_CURRENCY'] = $arConvertParams;
示例#3
0
            $rsSections = CIBlockSection::GetList(array(), array('IBLOCK_ID' => $IBLOCK_ID, 'ID' => $arSections), false, array('ID'));
            while ($arOneSection = $rsSections->Fetch()) {
                $arCheckSections[] = $arOneSection['ID'];
            }
            $arSections = $arCheckSections;
        }
        if (!$bAllSections && empty($arSections)) {
            $arSetupErrors[] = GetMessage("CET_ERROR_NO_GROUPS");
            $V = array();
        }
    }
    if (is_array($V)) {
        $V = array_unique(array_values($V));
        $_REQUEST['V'] = $V;
    }
    $arCatalog = CCatalogSKU::GetInfoByIBlock($IBLOCK_ID);
    if (CCatalogSKU::TYPE_PRODUCT == $arCatalog['CATALOG_TYPE'] || CCatalogSKU::TYPE_FULL == $arCatalog['CATALOG_TYPE']) {
        if (strlen($XML_DATA) <= 0) {
            $arSetupErrors[] = GetMessage('YANDEX_ERR_SKU_SETTINGS_ABSENT');
        }
    }
    if (!isset($USE_HTTPS) || $USE_HTTPS != 'Y') {
        $USE_HTTPS = 'N';
    }
    if (($ACTION == "EXPORT_SETUP" || $ACTION == "EXPORT_EDIT" || $ACTION == "EXPORT_COPY") && strlen($SETUP_PROFILE_NAME) <= 0) {
        $arSetupErrors[] = GetMessage("CET_ERROR_NO_PROFILE_NAME");
    }
    if (!empty($arSetupErrors)) {
        $STEP = 1;
    }
}
示例#4
0
 public static function GetByIDExt($ID)
 {
     $arResult = CCatalogSKU::GetInfoByIBlock($ID);
     if (!empty($arResult)) {
         $arResult['OFFERS_IBLOCK_ID'] = 0;
         $arResult['OFFERS_PROPERTY_ID'] = 0;
         $arResult['OFFERS'] = 'N';
         if (CCatalogSKU::TYPE_PRODUCT == $arResult['CATALOG_TYPE'] || CCatalogSKU::TYPE_FULL == $arResult['CATALOG_TYPE']) {
             $arResult['OFFERS_IBLOCK_ID'] = $arResult['IBLOCK_ID'];
             $arResult['OFFERS_PROPERTY_ID'] = $arResult['SKU_PROPERTY_ID'];
             $arResult['OFFERS'] = 'Y';
         }
         if (CCatalogSKU::TYPE_PRODUCT != $arResult['CATALOG_TYPE']) {
             $arResult['ID'] = $arResult['IBLOCK_ID'];
             $arResult['IBLOCK_TYPE_ID'] = '';
             $arResult['NAME'] = '';
             $arResult['LID'] = '';
             $arIBlock = CIBlock::GetArrayByID($arResult['IBLOCK_ID']);
             if (is_array($arIBlock)) {
                 $arResult['IBLOCK_TYPE_ID'] = $arIBlock['IBLOCK_TYPE_ID'];
                 $arResult['NAME'] = $arIBlock['NAME'];
                 $arResult['LID'] = $arIBlock['LID'];
             }
         }
     }
     return $arResult;
 }
示例#5
0
	function makeFilter($FILTER_NAME)
	{
		$bOffersIBlockExist = false;
		if (self::$catalogIncluded === null)
			self::$catalogIncluded = Loader::includeModule('catalog');
		if (self::$catalogIncluded)
		{
			$arCatalog = CCatalogSKU::GetInfoByIBlock($this->IBLOCK_ID);
			if (!empty($arCatalog))
			{
				$bOffersIBlockExist = (
					$arCatalog['CATALOG_TYPE'] == CCatalogSKU::TYPE_PRODUCT
					|| $arCatalog['CATALOG_TYPE'] == CCatalogSKU::TYPE_FULL
				);
			}
		}

		$gFilter = $GLOBALS[$FILTER_NAME];

		$arFilter = array(
			"IBLOCK_ID" => $this->IBLOCK_ID,
			"IBLOCK_LID" => SITE_ID,
			"IBLOCK_ACTIVE" => "Y",
			"ACTIVE_DATE" => "Y",
			"ACTIVE" => "Y",
			"CHECK_PERMISSIONS" => "Y",
			"MIN_PERMISSION" => "R",
			"INCLUDE_SUBSECTIONS" => "Y", //($arParams["INCLUDE_SUBSECTIONS"] != 'N' ? 'Y' : 'N'),
			"SECTION_ID" => $this->SECTION_ID,
		);

		if ('Y' == $this->arParams['HIDE_NOT_AVAILABLE'])
			$arFilter['CATALOG_AVAILABLE'] = 'Y';

		if(self::$catalogIncluded && $bOffersIBlockExist)
		{
			$arPriceFilter = array();
			foreach($gFilter as $key => $value)
			{
				if(preg_match('/^(>=|<=|><)CATALOG_PRICE_/', $key))
				{
					$arPriceFilter[$key] = $value;
					unset($gFilter[$key]);
				}
			}

			if(!empty($gFilter["OFFERS"]))
			{
				if (empty($arPriceFilter))
					$arSubFilter = $gFilter["OFFERS"];
				else
					$arSubFilter = array_merge($gFilter["OFFERS"], $arPriceFilter);

				$arSubFilter["IBLOCK_ID"] = $this->SKU_IBLOCK_ID;
				$arSubFilter["ACTIVE_DATE"] = "Y";
				$arSubFilter["ACTIVE"] = "Y";
				if ('Y' == $this->arParams['HIDE_NOT_AVAILABLE'])
					$arSubFilter['CATALOG_AVAILABLE'] = 'Y';
				$arFilter["=ID"] = CIBlockElement::SubQuery("PROPERTY_".$this->SKU_PROPERTY_ID, $arSubFilter);
			}
			elseif(!empty($arPriceFilter))
			{
				$arSubFilter = $arPriceFilter;

				$arSubFilter["IBLOCK_ID"] = $this->SKU_IBLOCK_ID;
				$arSubFilter["ACTIVE_DATE"] = "Y";
				$arSubFilter["ACTIVE"] = "Y";
				$arFilter[] = array(
					"LOGIC" => "OR",
					array($arPriceFilter),
					"=ID" => CIBlockElement::SubQuery("PROPERTY_".$this->SKU_PROPERTY_ID, $arSubFilter),
				);
			}

			unset($gFilter["OFFERS"]);
		}

		return array_merge($gFilter, $arFilter);
	}
示例#6
0
 public static function GetInheritedPropertyTemplateElementMenuItems($iblock_id, $action_function, $menuID, $inputID = "")
 {
     $result = array();
     $result["this"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_ELEMENT"), "MENU" => array(array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_ELEMENT_NAME"), "ONCLICK" => "{$action_function}('{=this.Name}', '{$menuID}', '{$inputID}')"), array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_ELEMENT_LOWER_NAME"), "ONCLICK" => "{$action_function}('{=lower this.Name}', '{$menuID}', '{$inputID}')"), array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_ELEMENT_CODE"), "ONCLICK" => "{$action_function}('{=this.Code}', '{$menuID}', '{$inputID}')"), array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_ELEMENT_PREVIEW_TEXT"), "ONCLICK" => "{$action_function}('{=this.PreviewText}', '{$menuID}', '{$inputID}')"), array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_ELEMENT_DETAIL_TEXT"), "ONCLICK" => "{$action_function}('{=this.DetailText}', '{$menuID}', '{$inputID}')")));
     if ($iblock_id > 0) {
         $result["properties"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_PROPERTIES"), "MENU" => array());
         foreach (self::getIblockElementProperties($iblock_id) as $property) {
             if ($property["PROPERTY_TYPE"] != "F") {
                 $result["properties"]["MENU"][] = array("TEXT" => $property["NAME"], "ONCLICK" => "{$action_function}('{=this.property." . ($property["CODE"] != "" ? $property["CODE"] : $property["ID"]) . "}', '{$menuID}', '{$inputID}')");
             }
         }
     }
     $result["parent"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_PARENT"), "MENU" => array(array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_PARENT_NAME"), "ONCLICK" => "{$action_function}('{=parent.Name}', '{$menuID}', '{$inputID}')"), array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_PARENT_CODE"), "ONCLICK" => "{$action_function}('{=parent.Code}', '{$menuID}', '{$inputID}')"), array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_PARENT_TEXT"), "ONCLICK" => "{$action_function}('{=parent.PreviewText}', '{$menuID}', '{$inputID}')")));
     $result["iblock"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_IBLOCK"), "MENU" => array(array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_IBLOCK_NAME"), "ONCLICK" => "{$action_function}('{=iblock.Name}', '{$menuID}', '{$inputID}')"), array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_IBLOCK_CODE"), "ONCLICK" => "{$action_function}('{=iblock.Code}', '{$menuID}', '{$inputID}')"), array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_IBLOCK_TEXT"), "ONCLICK" => "{$action_function}('{=iblock.PreviewText}', '{$menuID}', '{$inputID}')")));
     $arCatalog = false;
     $showCatalogSeo = false;
     if (self::$catalogIncluded === null) {
         self::$catalogIncluded = Loader::includeModule('catalog');
     }
     if (self::$catalogIncluded) {
         if ($iblock_id > 0) {
             $arCatalog = \CCatalogSKU::GetInfoByIBlock($iblock_id);
         }
         if (is_array($arCatalog)) {
             $showCatalogSeo = $arCatalog['CATALOG_TYPE'] != \CCatalogSKU::TYPE_PRODUCT;
             if ($arCatalog['CATALOG_TYPE'] == \CCatalogSKU::TYPE_PRODUCT || $arCatalog['CATALOG_TYPE'] == \CCatalogSKU::TYPE_FULL) {
                 $result["sku_properties"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_SKU_PROPERTIES"), "MENU" => array());
                 $rsProperty = CIBlockProperty::GetList(array(), array("IBLOCK_ID" => $arCatalog["IBLOCK_ID"]));
                 while ($property = $rsProperty->fetch()) {
                     if ($property["PROPERTY_TYPE"] != "F") {
                         $result["sku_properties"]["MENU"][] = array("TEXT" => $property["NAME"], "ONCLICK" => "{$action_function}('{=concat {=distinct this.catalog.sku.property." . ($property["CODE"] != "" ? $property["CODE"] : $property["ID"]) . " \", \"}}', '{$menuID}', '{$inputID}')");
                     }
                 }
                 $result["sku_price"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_SKU_PRICE"), "MENU" => array());
                 foreach (self::getCatalogPrices() as $price) {
                     if (preg_match("/^[a-zA-Z0-9]+\$/", $price["NAME"])) {
                         $result["sku_price"]["MENU"][] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_MIN_PRICE") . " " . $price["NAME"], "ONCLICK" => "{$action_function}('{=min this.catalog.sku.price." . $price["NAME"] . "}', '{$menuID}', '{$inputID}')");
                         $result["sku_price"]["MENU"][] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_MAX_PRICE") . " " . $price["NAME"], "ONCLICK" => "{$action_function}('{=max this.catalog.sku.price." . $price["NAME"] . "}', '{$menuID}', '{$inputID}')");
                     } else {
                         $result["sku_price"]["MENU"][] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_MIN_PRICE") . " " . $price["NAME"], "ONCLICK" => "{$action_function}('{=min this.catalog.sku.price." . $price["ID"] . "}', '{$menuID}', '{$inputID}')");
                         $result["sku_price"]["MENU"][] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_MAX_PRICE") . " " . $price["NAME"], "ONCLICK" => "{$action_function}('{=max this.catalog.sku.price." . $price["ID"] . "}', '{$menuID}', '{$inputID}')");
                     }
                 }
             }
             if ($showCatalogSeo) {
                 $result["catalog"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_CATALOG"), "MENU" => array(array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_CATALOG_WEIGHT"), "ONCLICK" => "{$action_function}('{=this.catalog.weight}', '{$menuID}', '{$inputID}')"), array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_CATALOG_MEASURE"), "ONCLICK" => "{$action_function}('{=this.catalog.measure}', '{$menuID}', '{$inputID}')")));
                 $result["price"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_PRICE"), "MENU" => array());
                 foreach (self::getCatalogPrices() as $price) {
                     if (preg_match("/^[a-zA-Z0-9]+\$/", $price["NAME"])) {
                         $result["price"]["MENU"][] = array("TEXT" => $price["NAME"], "ONCLICK" => "{$action_function}('{=this.catalog.price." . $price["NAME"] . "}', '{$menuID}', '{$inputID}')");
                     } else {
                         $result["price"]["MENU"][] = array("TEXT" => $price["NAME"], "ONCLICK" => "{$action_function}('{=this.catalog.price." . $price["ID"] . "}', '{$menuID}', '{$inputID}')");
                     }
                 }
                 $result["store"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_STORE"), "MENU" => array());
                 foreach (self::getCatalogStores() as $store) {
                     $result["store"]["MENU"][] = array("TEXT" => $store["TITLE"] != '' ? $store["TITLE"] : $store["ADDRESS"], "ONCLICK" => "{$action_function}('{=catalog.store." . $store["ID"] . ".name}', '{$menuID}', '{$inputID}')");
                 }
             }
         }
     }
     $result["misc"] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_MISC"), "MENU" => array());
     $result["misc"]["MENU"][] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_SECTIONS_PATH"), "ONCLICK" => "{$action_function}('{=concat this.sections.name \" / \"}', '{$menuID}', '{$inputID}')");
     if (self::$catalogIncluded) {
         if ($showCatalogSeo) {
             $result["misc"]["MENU"][] = array("TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_STORE_LIST"), "ONCLICK" => "{$action_function}('{=concat catalog.store \", \"}', '{$menuID}', '{$inputID}')");
         }
     }
     $r = array();
     foreach ($result as $category) {
         if (!empty($category) && !empty($category["MENU"])) {
             $r[] = $category;
         }
     }
     return $r;
 }
示例#7
0
 public static function changeTabs($intIBlockID, $intID, &$arCatalog)
 {
     $result = false;
     $intIBlockID = (int) $intIBlockID;
     $intID = (int) $intID;
     if ($intIBlockID <= 0 || $intID <= 0) {
         return $result;
     }
     if (empty($arCatalog)) {
         $arCatalog = CCatalogSKU::GetInfoByIBlock($intIBlockID);
     }
     if (empty($arCatalog)) {
         return $result;
     }
     if ($arCatalog['CATALOG'] != 'Y') {
         return $result;
     }
     $intProductID = CIBlockElement::GetRealElement($intID);
     $boolFeatureSet = CBXFeatures::IsFeatureEnabled('CatCompleteSet');
     if ($boolFeatureSet) {
         if (isset($_REQUEST['groupdel']) && 'Y' == $_REQUEST['groupdel']) {
             $result = CCatalogProductSet::deleteAllSetsByProduct($intProductID, CCatalogProductSet::TYPE_GROUP);
         } elseif (isset($_REQUEST['setdel']) && 'Y' == $_REQUEST['setdel']) {
             $result = CCatalogProductSet::deleteAllSetsByProduct($intProductID, CCatalogProductSet::TYPE_SET);
         }
     }
     return $result;
 }