protected function _prepareLayout() { if (!$this->_loadCache()) { return parent::_prepareLayout(); } return $this; }
/** * Sets parameters for tempalte * * @return Celebros_Conversionpro_Block_Analytics_View */ protected function _prepareLayout() { //running simulated search, to have the log handle down the page. //Mage::helper('conversionpro')->getCurrentLayer()->getProductCollection()->getFacetedData(''); $this->setCustomerId(Mage::getStoreConfig('conversionpro/anlx_settings/cid')); $this->setHost(Mage::getStoreConfig('conversionpro/anlx_settings/host')); $product = $this->getProduct(); //Set product click tracking params if (isset($product)) { $this->setProductSku($product->getSku()); $this->setProductName(str_replace("'", "\\'", $product->getName())); $this->setProductPrice($product->getFinalPrice()); $webSessionId = isset($_SESSION['core']['visitor_data']['session_id']) ? $_SESSION['core']['visitor_data']['session_id'] : session_id(); $this->setWebsessionId($webSessionId); } else { $pageReferrer = Mage::getModel('core/url')->getBaseUrl() . $_SERVER['PHP_SELF']; $this->setPageReferrer($pageReferrer); //$this->setQwiserSearchSessionId(Mage::getSingleton('conversionpro/session')->getSearchSessionId()); $this->setQwiserSearchSessionId($this->_generateGUID()); $webSessionId = isset($_SESSION['core']['visitor_data']['session_id']) ? $_SESSION['core']['visitor_data']['session_id'] : session_id(); $this->setWebsessionId($webSessionId); if (Mage::Helper('conversionpro')->hasSearchResults()) { $this->setQwiserSearchLogHandle(Mage::Helper('conversionpro')->getSearchResults()->GetLogHandle()); } } return parent::_prepareLayout(); }
public function getCacheTags() { if (!$this->_isCacheActive()) { return parent::getCacheTags(); } $cacheTags = array(Mage_Catalog_Model_Category::CACHE_TAG, Mage_Catalog_Model_Category::CACHE_TAG . '_' . $this->_category->getId()); return $cacheTags; }
/** * Check availability display layer block * * @return bool */ public function canShowBlock() { $availableResCount = (int) Mage::app()->getStore()->getConfig(Mage_CatalogSearch_Model_Layer::XML_PATH_DISPLAY_LAYER_COUNT); if (!$availableResCount || $availableResCount >= $this->getLayer()->getProductCollection()->getSize()) { return parent::canShowBlock(); } return false; }
public function getFilters() { $filters = parent::getFilters(); if ($saleFilter = $this->_getSaleFilter()) { // Insert sale filter to the self::SALE_FILTER_POSITION position $filters = array_merge(array_slice($filters, 0, self::SALE_FILTER_POSITION - 1), array($saleFilter), array_slice($filters, self::SALE_FILTER_POSITION - 1, count($filters) - 1)); } return $filters; }
protected function _initBlocks() { parent::_initBlocks(); $this->_stateBlockName = 'catalog/layer_state'; $this->_categoryBlockName = 'solr/layer_filter_category'; $this->_attributeFilterBlockName = 'solr/layer_filter_attribute'; $this->_priceFilterBlockName = 'solr/layer_filter_price'; $this->_decimalFilterBlockName = 'solr/layer_filter_decimal'; }
/** * Set custom template for filter * * @return string */ protected function _toHtml() { // set custom template for filter $filterableAttributes = $this->_getFilterableAttributes(); foreach ($filterableAttributes as $attribute) { $this->getChild($attribute->getAttributeCode() . '_filter')->setTemplate($this->_getFilterTemplate($attribute->getAttributeCode())); } return parent::_toHtml(); }
/** * Modifies default block names to specific ones if engine is active. * @todo add blocks */ protected function _initBlocks() { parent::_initBlocks(); $this->_categoryBlockName = 'elasticgento_catalog/catalog_layer_filter_category'; $this->_attributeFilterBlockName = 'elasticgento_catalog/catalog_layer_filter_attribute'; $this->_priceFilterBlockName = 'elasticgento_catalog/catalog_layer_filter_price'; $this->_decimalFilterBlockName = 'elasticgento_catalog/catalog_layer_filter_decimal'; $this->_booleanFilterBlockName = 'elasticgento_catalog/catalog_layer_filter_boolean'; }
/** * Get all layer filters * * @return array */ public function getFilters() { $filters = parent::getFilters(); foreach ($this->_layeredCategories as $layeredCatConfig) { $categoryId = $layeredCatConfig['category']; $position = $layeredCatConfig['position']; if ($categoryFilter = $this->_getLayeredCategoryFilter($categoryId)) { $filters = array_merge(array_slice($filters, 0, $position), array($categoryFilter), array_slice($filters, $position, count($filters))); } } return $filters; }
/** * Check availability display layer block * * @return bool */ public function canShowBlock() { $_isLNAllowedByEngine = Mage::helper('catalogsearch')->getEngine()->isLeyeredNavigationAllowed(); if (!$_isLNAllowedByEngine) { return false; } $availableResCount = (int) Mage::app()->getStore()->getConfig(Mage_CatalogSearch_Model_Layer::XML_PATH_DISPLAY_LAYER_COUNT); if (!$availableResCount || $availableResCount >= $this->getLayer()->getProductCollection()->getSize()) { return parent::canShowBlock(); } return false; }
/** * Get all layer filters * * @return array */ public function getFilters() { $options = $this->_getCustomOptions(); $filters = parent::getFilters(); $params = Mage::app()->getRequest()->getParams(); foreach ($options as $option) { $option_code = $option->getOptionCode(); $option_filter = $this->getChild('option_' . $option_code . '_filter'); if (isset($option_filter) && !array_key_exists($option_code, $params)) { $filters[] = $option_filter; } } return $filters; }
/** * Add layerd navigation filters on current layer block * * @param Mage_Catalog_Block_Layer_View $block * * @return $this */ protected function _addLayeredNavigation($block) { $stateBlock = $block->getLayout()->createBlock('catalog/layer_state')->setLayer($block->getLayer()); $block->setChild('layer_state', $stateBlock); $filterableAttributes = Mage::getResourceModel('factfinder_asn/product_attribute_collection'); foreach ($filterableAttributes as $index => $attribute) { $filter = $block->getLayout()->createBlock('factfinder_asn/catalog_layer_factfinder')->setAttributeModel($attribute)->setLayer($block->getLayer())->init(); $block->setChild($attribute->getAttributeCode() . '_filter', $filter); // remove category filter - it's enough to add it as a child if ($attribute->getAttributeCode() == 'category') { $filterableAttributes->removeItemByKey($index); } } $block->setData('_filterable_attributes', $filterableAttributes); return $this; }
/** * Prepare child blocks * * @return Mage_Catalog_Block_Layer_View */ protected function _prepareLayout() { if (!$this->helper('elasticsearch')->isActiveEngine()) { return parent::_prepareLayout(); } $stateBlock = $this->getLayout()->createBlock($this->_stateBlockName)->setLayer($this->getLayer()); $categoryBlock = $this->getLayout()->createBlock($this->_categoryBlockName)->setLayer($this->getLayer())->init(); $filterableAttributes = $this->_getFilterableAttributes(); $filters = $this->_getFiltersArray($filterableAttributes); $this->setChild('layer_state', $stateBlock); $this->setChild('category_filter', $categoryBlock->addFacetCondition()); $this->_addFacetConditionToFilters($filters); $this->getLayer()->apply(); return $this; }
/** * Ensure the default Magento blocks are used * * @return $this */ protected function _initBlocks() { parent::_initBlocks(); $this->_stateBlockName = 'Mage_Catalog_Block_Layer_State'; $this->_categoryBlockName = 'Mage_Catalog_Block_Layer_Filter_Category'; $this->_attributeFilterBlockName = 'Mage_Catalog_Block_Layer_Filter_Attribute'; $this->_priceFilterBlockName = 'Mage_Catalog_Block_Layer_Filter_Price'; $this->_decimalFilterBlockName = 'Mage_Catalog_Block_Layer_Filter_Decimal'; if (Mage::helper('attributeSplash')->isFishPigSeoInstalledAndActive()) { $this->_categoryBlockName = 'Fishpig_FSeo_Block_Catalog_Layer_Filter_Category'; $this->_attributeFilterBlockName = 'Fishpig_FSeo_Block_Catalog_Layer_Filter_Attribute'; $this->_priceFilterBlockName = 'Fishpig_FSeo_Block_Catalog_Layer_Filter_Price'; $this->_decimalFilterBlockName = 'Fishpig_FSeo_Block_Catalog_Layer_Filter_Decimal'; } return $this; }
protected function _construct() { parent::_construct(); $this->setTemplate('itoris/layerednavigation/layer/view.phtml'); if ($this->getSettings()->getMulticategoryEnabled()) { $this->_categoryBlockName = 'itoris_layerednavigation/layer_multiFilter_category_tree'; } else { $this->_categoryBlockName = 'itoris_layerednavigation/layer_filter_category_links'; } if ($this->getSettings()->getGraphicalPriceEnabled()) { $this->_priceFilterBlockName = 'itoris_layerednavigation/layer_filter_price_range'; $this->_priceBlockNameInLayout = 'layer_filter_price_range'; } else { $this->_priceFilterBlockName = 'itoris_layerednavigation/layer_multiFilter_price'; } $this->_attributeFilterBlockName = 'itoris_layerednavigation/layer_multiFilter_attribute'; $this->_decimalFilterBlockName = 'itoris_layerednavigation/layer_multiFilter_decimal'; }
/** * Get layer object * * @return Mage_Catalog_Model_Layer */ public function getLayer() { if (Mage::helper('enterprise_search')->getIsEngineAvailableForNavigation()) { return Mage::getSingleton('enterprise_search/catalog_layer'); } return parent::getLayer(); }
protected function _construct() { parent::_construct(); }
/** * Returns current catalog layer. * * @return JR_Search_Model_Catalog_Layer|Mage_Catalog_Model_Layer */ public function getLayer() { /** @var $helper JR_Search_Helper_Data */ $helper = Mage::helper('jr_search'); if ($helper->isActiveEngine()) { return Mage::getSingleton('jr_search/catalog_layer'); } return parent::getLayer(); }
protected function _prepareLayout() { if (!Mage::getStoreConfigFlag('customer/startup/redirect_dashboard')) { $url = Mage::helper('amshopby/url')->getFullUrl($_GET); Mage::getSingleton('customer/session')->setBeforeAuthUrl($url); } $head = $this->getLayout()->getBlock('head'); if ($head) { $head->addItem('skin_js', 'js/amshopby.js'); } return parent::_prepareLayout(); }
protected function _toHtml() { $html = parent::_toHtml(); if (!Mage::app()->getRequest()->isXmlHttpRequest()) { $html = '<div id="catalog-filters">' . $html . '</div>'; } return $html; }
/** * Remove the price filter options from the filterable attributes * * @param Mage_Catalog_Block_Layer_View $oBlock */ protected function removePriceFilter($oBlock) { $aFilterableAttributes = $oBlock->getData('_filterable_attributes'); $aNewFilterableAttributes = array(); foreach ($aFilterableAttributes as $oFilterableAttribute) { if ($oFilterableAttribute->getAttributeCode() != 'price') { $aNewFilterableAttributes[] = $oFilterableAttribute; } } $oBlock->setData('_filterable_attributes', $aNewFilterableAttributes); }
protected function _prepareLayout() { if (Mage::registry('amshopby_layout_prepared')) { return parent::_prepareLayout(); } else { Mage::register('amshopby_layout_prepared', true); } if (!Mage::getStoreConfigFlag('customer/startup/redirect_dashboard')) { $url = Mage::helper('amshopby/url')->getFullUrl($_GET); Mage::getSingleton('customer/session')->setBeforeAuthUrl($url); } $head = $this->getLayout()->getBlock('head'); if ($head) { $head->addItem('skin_js', 'js/amshopby.js'); if (Mage::getStoreConfigFlag('amshopby/block/ajax') && !$this->getIsProductPage()) { $head->addItem('skin_js', 'js/amshopby-ajax.js'); } } return parent::_prepareLayout(); }
protected function _getCategoryFilter() { if (Mage::helper('amshopby')->isVersionLessThan(1, 4, 2)) { $pos = Mage::getStoreConfig('amshopby/block/categories_pos'); if ($this->_notInBlock($pos)) { $this->_categoryBlockName = 'amshopby/catalog_layer_filter_empty'; $categryBlock = $this->getLayout()->createBlock($this->_categoryBlockName)->setLayer($this->getLayer())->init(); return $categryBlock; } } return parent::_getCategoryFilter(); }
/** * Initialize blocks names */ protected function _initBlocks() { parent::_initBlocks(); $this->_categoryBlockName = 'holoflek_filters/layer_filter_category'; }
protected function _construct() { parent::_construct(); Mage::register('current_layer', $this->getLayer(), true); }
/** * Returns the current catalog layer. * * @return NanoWebG_ElasticSearch_Model_Catalog_Layer|Mage_Catalog_Model_Layer */ public function getLayer() { /** @var $helper NanoWebG_ElasticSearch_Helper_Data */ $helper = Mage::helper('nanowebg_elasticsearch'); if (!$helper->useElasticSearch()) { return parent::getLayer(); } else { return Mage::getSingleton('nanowebg_elasticsearch/catalog_layer'); } }
protected function _construct() { parent::_construct(); /* To get picked up by Mage_Catalog_Product_List::getLayer() */ Mage::register('current_layer', $this->getLayer(), true); }
/** * Layered navigation block, clears on changed associated category ID * * @param Mage_Catalog_Block_Layer_View $block */ public function applyCatalogLayerView(Mage_Catalog_Block_Layer_View $block) { // Set cache tags $tags = $block->getLayer()->getStateTags(); $block->setData('cache_tags', $tags); $keys = $this->_getBasicKeys($block); $keys[] = $block->getLayer()->getStateKey(); foreach (Mage::app()->getRequest()->getParams() as $key => $value) { $value = Mage::helper('cache')->paramValueToCacheKey($value); $keys[] = $key . '_' . $value; } $block->setData('cache_key', $this->_getCacheKey($keys)); }
/** * Custom template handling for children blocks (filters) before to display theme * * @return Smile_ElasticSearch_Model_Catalog_Layer Self reference */ protected function _beforeToHtml() { if (Mage::helper('smile_elasticsearch')->isActiveEngine()) { foreach ($this->_filterTemplates as $filterName => $template) { $block = $this->getChild($filterName . '_filter'); if ($block) { $block->setTemplate($template); } } } return parent::_beforeToHtml(); }
/** * Initialize blocks names */ protected function _initBlocks() { parent::_initBlocks(); $this->_brandsFilterBlockName = 'vc_shopbybrands/catalog_layer_filter_brands'; }