Ejemplo n.º 1
0
 public function onPrepareComponentParams($arParams)
 {
     $arParams["CACHE_TIME"] = isset($arParams["CACHE_TIME"]) ? $arParams["CACHE_TIME"] : 36000000;
     $arParams["IBLOCK_ID"] = (int) $arParams["IBLOCK_ID"];
     $arParams["SECTION_ID"] = (int) $arParams["SECTION_ID"];
     if ($arParams["SECTION_ID"] <= 0 && Loader::includeModule('iblock')) {
         $arParams["SECTION_ID"] = CIBlockFindTools::GetSectionID($arParams["SECTION_ID"], $arParams["SECTION_CODE"], array("GLOBAL_ACTIVE" => "Y", "IBLOCK_ID" => $arParams["IBLOCK_ID"]));
         if (!$arParams["SECTION_ID"] && strlen($arParams["SECTION_CODE_PATH"]) > 0) {
             $arParams["SECTION_ID"] = CIBlockFindTools::GetSectionIDByCodePath($arParams["IBLOCK_ID"], $arParams["SECTION_CODE_PATH"]);
         }
     }
     $arParams["PRICE_CODE"] = is_array($arParams["PRICE_CODE"]) ? $arParams["PRICE_CODE"] : array();
     foreach ($arParams["PRICE_CODE"] as $k => $v) {
         if ($v === null || $v === '' || $v === false) {
             unset($arParams["PRICE_CODE"][$k]);
         }
     }
     $arParams["SAVE_IN_SESSION"] = $arParams["SAVE_IN_SESSION"] == "Y";
     $arParams["CACHE_GROUPS"] = $arParams["CACHE_GROUPS"] !== "N";
     $arParams["INSTANT_RELOAD"] = $arParams["INSTANT_RELOAD"] === "Y";
     $arParams["SECTION_TITLE"] = trim($arParams["SECTION_TITLE"]);
     $arParams["SECTION_DESCRIPTION"] = trim($arParams["SECTION_DESCRIPTION"]);
     $arParams["FILTER_NAME"] = isset($arParams["FILTER_NAME"]) ? (string) $arParams["FILTER_NAME"] : '';
     if ($arParams["FILTER_NAME"] == '' || !preg_match("/^[A-Za-z_][A-Za-z01-9_]*\$/", $arParams["FILTER_NAME"])) {
         $arParams["FILTER_NAME"] = "arrFilter";
     }
     $arParams["CONVERT_CURRENCY"] = $arParams["CONVERT_CURRENCY"] === "Y";
     $arParams["CURRENCY_ID"] = trim($arParams["CURRENCY_ID"]);
     if ($arParams["CURRENCY_ID"] == "") {
         $arParams["CONVERT_CURRENCY"] = false;
     } elseif (!$arParams["CONVERT_CURRENCY"]) {
         $arParams["CURRENCY_ID"] = "";
     }
     return $arParams;
 }
Ejemplo n.º 2
0
 protected function prepareData()
 {
     if ($this->arParams['ID'] <= 0) {
         CIBlockFindTools::getElementID($this->arParams["ID"], $this->arParams["CODE"], false, false, array("IBLOCK_ID" => $this->arParams["IBLOCK_ID"], "IBLOCK_LID" => SITE_ID, "IBLOCK_ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "ACTIVE" => "Y", "CHECK_PERMISSIONS" => "Y", "MIN_PERMISSION" => 'R'));
     }
     if ($this->arParams['ID'] <= 0) {
         throw new SystemException(Loc::getMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_PRODUCT_ID_REQUIRED"));
     }
     parent::prepareData();
 }
Ejemplo n.º 3
0
 public static function resolveComponentEngine(CComponentEngine $engine, $pageCandidates, &$arVariables)
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION, $CACHE_MANAGER;
     $component = $engine->GetComponent();
     if ($component) {
         $iblock_id = intval($component->arParams["IBLOCK_ID"]);
     } else {
         $iblock_id = 0;
     }
     $requestURL = $APPLICATION->GetCurPage(true);
     $cacheId = $requestURL . implode("|", array_keys($pageCandidates));
     $cache = new CPHPCache();
     if ($cache->startDataCache(3600, $cacheId, "iblock_find")) {
         if (defined("BX_COMP_MANAGED_CACHE")) {
             $CACHE_MANAGER->StartTagCache("iblock_find");
             CIBlock::registerWithTagCache($iblock_id);
         }
         foreach ($pageCandidates as $pageID => $arVariablesTmp) {
             if ($arVariablesTmp["SECTION_CODE_PATH"] != "" && (isset($arVariablesTmp["ELEMENT_ID"]) || isset($arVariablesTmp["ELEMENT_CODE"]))) {
                 if (CIBlockFindTools::checkElement($iblock_id, $arVariablesTmp)) {
                     $arVariables = $arVariablesTmp;
                     if (defined("BX_COMP_MANAGED_CACHE")) {
                         $CACHE_MANAGER->EndTagCache();
                     }
                     $cache->endDataCache(array($pageID, $arVariablesTmp));
                     return $pageID;
                 }
             }
         }
         foreach ($pageCandidates as $pageID => $arVariablesTmp) {
             if ($arVariablesTmp["SECTION_CODE_PATH"] != "" && (!isset($arVariablesTmp["ELEMENT_ID"]) && !isset($arVariablesTmp["ELEMENT_CODE"]))) {
                 if (CIBlockFindTools::checkSection($iblock_id, $arVariablesTmp)) {
                     $arVariables = $arVariablesTmp;
                     if (defined("BX_COMP_MANAGED_CACHE")) {
                         $CACHE_MANAGER->EndTagCache();
                     }
                     $cache->endDataCache(array($pageID, $arVariablesTmp));
                     return $pageID;
                 }
             }
         }
         if (defined("BX_COMP_MANAGED_CACHE")) {
             $CACHE_MANAGER->AbortTagCache();
         }
         $cache->abortDataCache();
     } else {
         $vars = $cache->getVars();
         $pageID = $vars[0];
         $arVariables = $vars[1];
         return $pageID;
     }
     list($pageID, $arVariables) = each($pageCandidates);
     return $pageID;
 }
Ejemplo n.º 4
0
 protected function executeMainElements()
 {
     // todo Move to getFilterParams()
     if ($this->arParams['SECTION_CODE'] && !$this->arParams['SECTION_ID']) {
         $this->arParams['SECTION_ID'] = \CIBlockFindTools::GetSectionID(0, $this->arParams['SECTION_CODE'], []);
     }
     if ($this->arParams['ELEMENT_CODE'] && !$this->arParams['ELEMENT_ID']) {
         $this->arParams['ELEMENT_ID'] = \CIBlockFindTools::GetElementID(0, $this->arParams['ELEMENT_CODE'], $this->arParams['SECTION_ID'], $this->arParams['SECTION_CODE'], []);
     }
     $this->readInheritedProps();
     $this->readSectionParams();
     $this->readOgDatas();
 }
Ejemplo n.º 5
0
 /**
  * @param $params
  * @override
  * @return array
  */
 public function onPrepareComponentParams($params)
 {
     if (Loader::includeModule("catalog")) {
         $catalogIterator = CCatalog::getList(array("IBLOCK_ID" => "ASC"));
         while ($row = $catalogIterator->fetch()) {
             $params['SHOW_PRODUCTS_' . $row['IBLOCK_ID']] = true;
         }
     }
     $params = parent::onPrepareComponentParams($params);
     if (!isset($params["CACHE_TIME"])) {
         $params["CACHE_TIME"] = 86400;
     }
     $params["DETAIL_URL"] = trim($params["DETAIL_URL"]);
     $params["MIN_BUYES"] = IntVal($params["MIN_BUYES"]);
     if ($params["MIN_BUYES"] <= 0) {
         $params["MIN_BUYES"] = 2;
     }
     if (isset($params['ID'])) {
         $params['ID'] = (int) $params["ID"];
     } else {
         $params['ID'] = -1;
     }
     if (isset($params['CODE'])) {
         $params['CODE'] = trim($params['CODE']);
     } else {
         $params['CODE'] = '';
     }
     if (isset($params['IBLOCK_ID'])) {
         $params['IBLOCK_ID'] = (int) $params['IBLOCK_ID'];
     } else {
         $params['IBLOCK_ID'] = -1;
     }
     $params['ID'] = CIBlockFindTools::getElementID($params["ID"], $params["CODE"], false, false, array("IBLOCK_ID" => $params["IBLOCK_ID"], "IBLOCK_LID" => SITE_ID, "IBLOCK_ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "CHECK_PERMISSIONS" => "Y"));
     if ($params["ID"] <= 0) {
         $this->errors[] = Loc::getMessage("SRP_PRODUCT_ID_REQUIRED");
     }
     return $params;
 }
Ejemplo n.º 6
0
    return 0;
}
/*************************************************************************
			Start caching
*************************************************************************/
if ($arParams["SHOW_WORKFLOW"] || $this->StartResultCache(false, $arParams["CACHE_GROUPS"] === "N" ? false : $USER->GetGroups())) {
    if (!CModule::IncludeModule("iblock")) {
        $this->AbortResultCache();
        ShowError(GetMessage("IBLOCK_MODULE_NOT_INSTALLED"));
        return;
    }
    if ($arParams["ELEMENT_ID"] > 0) {
        $ELEMENT_ID = $arParams["ELEMENT_ID"];
    } else {
        //Handle case when ELEMENT_CODE used
        $ELEMENT_ID = CIBlockFindTools::GetElementID($arParams["ELEMENT_ID"], $arParams["ELEMENT_CODE"], false, false, array("IBLOCK_ACTIVE" => "Y", "IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE_DATE" => "Y", "ACTIVE" => "Y", "CHECK_PERMISSIONS" => "Y"));
    }
    if ($ELEMENT_ID) {
        $WF_SHOW_HISTORY = "N";
        if ($arParams["SHOW_WORKFLOW"] && CModule::IncludeModule("workflow")) {
            $WF_ELEMENT_ID = CIBlockElement::WF_GetLast($ELEMENT_ID);
            $WF_STATUS_ID = CIBlockElement::WF_GetCurrentStatus($WF_ELEMENT_ID, $WF_STATUS_TITLE);
            $WF_STATUS_PERMISSION = CIBlockElement::WF_GetStatusPermission($WF_STATUS_ID);
            if ($WF_STATUS_ID == 1 || $WF_STATUS_PERMISSION < 1) {
                $WF_ELEMENT_ID = $ELEMENT_ID;
            } else {
                $WF_SHOW_HISTORY = "Y";
            }
            $ELEMENT_ID = $WF_ELEMENT_ID;
        }
        //SELECT
Ejemplo n.º 7
0
     $rsSection = CIBlockSection::GetList(array(), $arFilter, false, $arSelect);
     $rsSection->SetUrlTemplates("", $arParams["SECTION_URL"]);
     $arResult = $rsSection->GetNext();
     if ($arResult) {
         $bSectionFound = true;
     }
 } elseif (strlen($arParams["SECTION_CODE"]) > 0) {
     $arFilter["=CODE"] = $arParams["SECTION_CODE"];
     $rsSection = CIBlockSection::GetList(array(), $arFilter, false, $arSelect);
     $rsSection->SetUrlTemplates("", $arParams["SECTION_URL"]);
     $arResult = $rsSection->GetNext();
     if ($arResult) {
         $bSectionFound = true;
     }
 } elseif (strlen($arParams["SECTION_CODE_PATH"]) > 0) {
     $sectionId = CIBlockFindTools::GetSectionIDByCodePath($arParams["IBLOCK_ID"], $arParams["SECTION_CODE_PATH"]);
     if ($sectionId) {
         $arFilter["ID"] = $sectionId;
         $rsSection = CIBlockSection::GetList(array(), $arFilter, false, $arSelect);
         $rsSection->SetUrlTemplates("", $arParams["SECTION_URL"]);
         $arResult = $rsSection->GetNext();
         if ($arResult) {
             $bSectionFound = true;
         }
     }
 } else {
     //Root section (no section filter)
     $arResult = array("ID" => 0, "IBLOCK_ID" => $arParams["IBLOCK_ID"]);
     $bSectionFound = true;
 }
 if (!$bSectionFound) {
Ejemplo n.º 8
0
 public static function resolveComponentEngine(CComponentEngine $engine, $pageCandidates, &$arVariables)
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION, $CACHE_MANAGER;
     static $aSearch = array("&lt;", "&gt;", "&quot;", "&#039;");
     static $aReplace = array("<", ">", "\"", "'");
     $component = $engine->GetComponent();
     if ($component) {
         $iblock_id = intval($component->arParams["IBLOCK_ID"]);
     } else {
         $iblock_id = 0;
     }
     //To fix GetPagePath security hack for SMART_FILTER_PATH
     foreach ($pageCandidates as $pageID => $arVariablesTmp) {
         foreach ($arVariablesTmp as $variableName => $variableValue) {
             if ($variableName === "SMART_FILTER_PATH") {
                 $pageCandidates[$pageID][$variableName] = str_replace($aSearch, $aReplace, $variableValue);
             }
         }
     }
     $requestURL = $APPLICATION->GetCurPage(true);
     $cacheId = $requestURL . implode("|", array_keys($pageCandidates)) . "|" . SITE_ID;
     $cache = new CPHPCache();
     if ($cache->startDataCache(3600, $cacheId, "iblock_find")) {
         if (defined("BX_COMP_MANAGED_CACHE")) {
             $CACHE_MANAGER->StartTagCache("iblock_find");
             CIBlock::registerWithTagCache($iblock_id);
         }
         foreach ($pageCandidates as $pageID => $arVariablesTmp) {
             if ($arVariablesTmp["SECTION_CODE_PATH"] != "" && (isset($arVariablesTmp["ELEMENT_ID"]) || isset($arVariablesTmp["ELEMENT_CODE"]))) {
                 if (CIBlockFindTools::checkElement($iblock_id, $arVariablesTmp)) {
                     $arVariables = $arVariablesTmp;
                     if (defined("BX_COMP_MANAGED_CACHE")) {
                         $CACHE_MANAGER->EndTagCache();
                     }
                     $cache->endDataCache(array($pageID, $arVariablesTmp));
                     return $pageID;
                 }
             }
         }
         foreach ($pageCandidates as $pageID => $arVariablesTmp) {
             if ($arVariablesTmp["SECTION_CODE_PATH"] != "" && (!isset($arVariablesTmp["ELEMENT_ID"]) && !isset($arVariablesTmp["ELEMENT_CODE"]))) {
                 if (CIBlockFindTools::checkSection($iblock_id, $arVariablesTmp)) {
                     $arVariables = $arVariablesTmp;
                     if (defined("BX_COMP_MANAGED_CACHE")) {
                         $CACHE_MANAGER->EndTagCache();
                     }
                     $cache->endDataCache(array($pageID, $arVariablesTmp));
                     return $pageID;
                 }
             }
         }
         if (defined("BX_COMP_MANAGED_CACHE")) {
             $CACHE_MANAGER->AbortTagCache();
         }
         $cache->abortDataCache();
     } else {
         $vars = $cache->getVars();
         $pageID = $vars[0];
         $arVariables = $vars[1];
         return $pageID;
     }
     reset($pageCandidates);
     list($pageID, $arVariables) = each($pageCandidates);
     return $pageID;
 }
Ejemplo n.º 9
0
	$arFilter = array(
		"IBLOCK_LID" 			=> SITE_ID,
		"IBLOCK_ACTIVE"			=> "Y",
		"ACTIVE"				=> "Y",
		"CHECK_PERMISSIONS"		=> "Y",
		"IBLOCK_TYPE"			=> $arParams["IBLOCK_TYPE"],
		"SHOW_HISTORY"			=> $arParams["SHOW_WORKFLOW"]? "Y": "N",
	);
	if(intval($arParams["IBLOCK_ID"]) > 0)
		$arFilter["IBLOCK_ID"] = $arParams["IBLOCK_ID"];

	if($arParams["ELEMENT_ID"] <= 0):
		$arParams["ELEMENT_ID"] = CIBlockFindTools::GetElementID(
			$arParams["ELEMENT_ID"],
			$arParams["ELEMENT_CODE"],
			false,
			false,
			$arFilter
		);
	endif;
	
	$arFilter["ID"] = $arParams["ELEMENT_ID"];

	$WF_SHOW_HISTORY = "N";
	if ($arParams["SHOW_WORKFLOW"] && CModule::IncludeModule("workflow"))
	{
		$WF_ELEMENT_ID = CIBlockElement::WF_GetLast($arParams["ELEMENT_ID"]);

		$WF_STATUS_ID = CIBlockElement::WF_GetCurrentStatus($WF_ELEMENT_ID, $WF_STATUS_TITLE);
		$WF_STATUS_PERMISSION = CIBlockElement::WF_GetStatusPermission($WF_STATUS_ID);
Ejemplo n.º 10
0
			$arSelect[]="PROPERTY_*";
		//WHERE
		$arFilter = array (
			"IBLOCK_ID" => $arResult["ID"],
			"IBLOCK_LID" => SITE_ID,
			"ACTIVE" => "Y",
			"CHECK_PERMISSIONS" => "Y",
		);

		if($arParams["CHECK_DATES"])
			$arFilter["ACTIVE_DATE"] = "Y";

		$arParams["PARENT_SECTION"] = CIBlockFindTools::GetSectionID(
			$arParams["PARENT_SECTION"],
			$arParams["PARENT_SECTION_CODE"],
			array(
				"GLOBAL_ACTIVE" => "Y",
				"IBLOCK_ID" => $arResult["ID"],
			)
		);

		if($arParams["PARENT_SECTION"]>0)
		{
			$arFilter["SECTION_ID"] = $arParams["PARENT_SECTION"];
			if($arParams["INCLUDE_SUBSECTIONS"])
				$arFilter["INCLUDE_SUBSECTIONS"] = "Y";

			$arResult["SECTION"]= array("PATH" => array());
			$rsPath = CIBlockSection::GetNavChain($arResult["ID"], $arParams["PARENT_SECTION"]);
			$rsPath->SetUrlTemplates("", $arParams["SECTION_URL"], $arParams["IBLOCK_URL"]);
			while($arPath = $rsPath->GetNext())
			{
Ejemplo n.º 11
0
}
if ($verticalGrid) {
    ?>
<div class="bx_content_section"><?php 
}
?>

<?php 
$APPLICATION->IncludeComponent("bitrix:catalog.section.list", "", array("IBLOCK_TYPE" => $arParams["IBLOCK_TYPE"], "IBLOCK_ID" => $arParams["IBLOCK_ID"], "SECTION_ID" => $arResult["VARIABLES"]["SECTION_ID"], "SECTION_CODE" => $arResult["VARIABLES"]["SECTION_CODE"], "CACHE_TYPE" => $arParams["CACHE_TYPE"], "CACHE_TIME" => $arParams["CACHE_TIME"], "CACHE_GROUPS" => $arParams["CACHE_GROUPS"], "COUNT_ELEMENTS" => $arParams["SECTION_COUNT_ELEMENTS"], "TOP_DEPTH" => $arParams["SECTION_TOP_DEPTH"], "SECTION_URL" => $arResult["FOLDER"] . $arResult["URL_TEMPLATES"]["section"], "VIEW_MODE" => $arParams["SECTIONS_VIEW_MODE"], "SHOW_PARENT_NAME" => $arParams["SECTIONS_SHOW_PARENT_NAME"], "HIDE_SECTION_NAME" => isset($arParams["SECTIONS_HIDE_SECTION_NAME"]) ? $arParams["SECTIONS_HIDE_SECTION_NAME"] : "N", "ADD_SECTIONS_CHAIN" => isset($arParams["ADD_SECTIONS_CHAIN"]) ? $arParams["ADD_SECTIONS_CHAIN"] : ''), $component, array("HIDE_ICONS" => "Y"));
?>
<div class="divider" id="secdetsdiv"></div>


<?php 
//If there's no subcategories, let's roll out main categories
$secid = CIBlockFindTools::GetSectionID($secid, $arResult["VARIABLES"]["SECTION_CODE"], $arFlt);
$arFlt = array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "SECTION_ID" => $secid);
if (CIBlockSection::GetCount($arFlt) <= 0) {
    $APPLICATION->IncludeComponent("bitrix:catalog.section.list", "", array("IBLOCK_TYPE" => $arParams["IBLOCK_TYPE"], "IBLOCK_ID" => $arParams["IBLOCK_ID"], "CACHE_TYPE" => $arParams["CACHE_TYPE"], "CACHE_TIME" => $arParams["CACHE_TIME"], "CACHE_GROUPS" => $arParams["CACHE_GROUPS"], "COUNT_ELEMENTS" => $arParams["SECTION_COUNT_ELEMENTS"], "TOP_DEPTH" => $arParams["SECTION_TOP_DEPTH"], "SECTION_URL" => $arResult["FOLDER"] . $arResult["URL_TEMPLATES"]["section"], "VIEW_MODE" => $arParams["SECTIONS_VIEW_MODE"], "SHOW_PARENT_NAME" => $arParams["SECTIONS_SHOW_PARENT_NAME"], "HIDE_SECTION_NAME" => isset($arParams["SECTIONS_HIDE_SECTION_NAME"]) ? $arParams["SECTIONS_HIDE_SECTION_NAME"] : "N", "ADD_SECTIONS_CHAIN" => isset($arParams["ADD_SECTIONS_CHAIN"]) ? $arParams["ADD_SECTIONS_CHAIN"] : ''), $component, array("HIDE_ICONS" => "Y"));
}
?>


<?php 
if ($arParams["USE_COMPARE"] == "Y") {
    $APPLICATION->IncludeComponent("bitrix:catalog.compare.list", "", array("IBLOCK_TYPE" => $arParams["IBLOCK_TYPE"], "IBLOCK_ID" => $arParams["IBLOCK_ID"], "NAME" => $arParams["COMPARE_NAME"], "DETAIL_URL" => $arResult["FOLDER"] . $arResult["URL_TEMPLATES"]["element"], "COMPARE_URL" => $arResult["FOLDER"] . $arResult["URL_TEMPLATES"]["compare"], "ACTION_VARIABLE" => $arParams["ACTION_VARIABLE"], "PRODUCT_ID_VARIABLE" => $arParams["PRODUCT_ID_VARIABLE"], 'POSITION_FIXED' => isset($arParams['COMPARE_POSITION_FIXED']) ? $arParams['COMPARE_POSITION_FIXED'] : '', 'POSITION' => isset($arParams['COMPARE_POSITION']) ? $arParams['COMPARE_POSITION'] : ''), $component, array("HIDE_ICONS" => "Y"));
}
if (isset($arParams['USE_COMMON_SETTINGS_BASKET_POPUP']) && $arParams['USE_COMMON_SETTINGS_BASKET_POPUP'] == 'Y') {
    $basketAction = isset($arParams['COMMON_ADD_TO_BASKET_ACTION']) ? $arParams['COMMON_ADD_TO_BASKET_ACTION'] : '';
} else {
    $basketAction = isset($arParams['SECTION_ADD_TO_BASKET_ACTION']) ? $arParams['SECTION_ADD_TO_BASKET_ACTION'] : '';