Exemplo n.º 1
0
 public function setChild($alias, $block)
 {
     if ($alias == $this->_pagerAlias && $this->getChild($this->_pagerAlias) instanceof Amasty_Shopby_Block_Catalog_Pager) {
         return $this;
     }
     return parent::setChild($alias, $block);
 }
Exemplo n.º 2
0
 public function setCollection($collection)
 {
     parent::setCollection($collection);
     if ($this->getCurrentOrder()) {
         $this->_collection->getSelect()->order("{$this->getCurrentOrder()} {$this->getCurrentDirection()}");
     }
     return $this;
 }
Exemplo n.º 3
0
 public function setCollection($collection)
 {
     parent::setCollection($collection);
     if ($this->getCurrentOrder() && $this->getCurrentDirection()) {
         $this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
     }
     return $this;
 }
Exemplo n.º 4
0
 protected function _toHtml()
 {
     if (!Mage::registry('subdomain')) {
         if (Mage::helper('gomage_navigation')->isGomageNavigationAjax()) {
             $this->setTemplate('gomage/navigation/catalog/product/list/toolbar.phtml');
         }
     }
     return parent::_toHtml();
 }
Exemplo n.º 5
0
 /**
  * Overwritten method. Does not use the _current-method of URL models anymore. Retrieves a speaking filter url from
  * own model.
  * 
  * @see Mage_Catalog_Block_Product_List_Toolbar::getPagerUrl($params)
  * @param array $params The params to be added to current url
  * @return string The resulting speaking url to be used in toolbar.
  */
 public function getPagerUrl($params = array())
 {
     $category = Mage::registry('current_category');
     if (!is_object($category)) {
         return parent::getPagerUrl($params);
     }
     $url = Mage::getModel('filterurls/catalog_layer_filter_item')->getSpeakingFilterUrl(FALSE, TRUE, $params);
     return $url;
 }
Exemplo n.º 6
0
 public function _construct()
 {
     parent::_construct();
     $this->disableParamsMemorizing();
     // Remove params that may have been memorized before this fix was active.
     Mage::getSingleton('catalog/session')->unsSortOrder();
     Mage::getSingleton('catalog/session')->unsSortDirection();
     Mage::getSingleton('catalog/session')->unsDisplayMode();
     Mage::getSingleton('catalog/session')->unsLimitPage();
 }
Exemplo n.º 7
0
 public function getPagerUrl($params = array())
 {
     if (!$this->helper('sm_shopby')->isEnabled()) {
         return parent::getPagerUrl($params);
     }
     if ($this->helper('sm_shopby')->isCatalogSearch()) {
         $params['isLayerAjax'] = null;
         return parent::getPagerUrl($params);
     }
     return $this->helper('sm_shopby')->getPagerUrl($params);
 }
 public function getLimit()
 {
     if (Mage::helper('adjnav')->isPageAutoload()) {
         $mode = $this->getCurrentMode();
         $limit = Mage::getStoreConfig('design/adjnav_endless_page/products_on_' . $mode . '_page');
         if ($limit) {
             $this->setData('_current_limit', $limit);
             return $limit;
         }
     }
     return parent::getLimit();
 }
Exemplo n.º 9
0
 public function getPagerUrl($params = array())
 {
     if (Mage::getStoreConfig('mageworx_seo/seosuite/disable_layered_rewrites')) {
         return parent::getPagerUrl($params);
     }
     $urlParams = array();
     $urlParams['_current'] = true;
     $urlParams['_escape'] = true;
     $urlParams['_use_rewrite'] = true;
     $urlParams['_query'] = $params;
     return Mage::helper('seosuite')->getLayerFilterUrl($urlParams);
 }
Exemplo n.º 10
0
 public function getCacheKey()
 {
     if (!$this->_isCacheActive()) {
         parent::getCacheKey();
     }
     $this->_category = Mage::getSingleton('catalog/layer')->getCurrentCategory();
     $total = $this->_getProductCollection()->getSize();
     Mage::getSingleton('core/session')->setSizeValue('');
     $toolbar = new Mage_Catalog_Block_Product_List_Toolbar();
     $cacheKey = 'ProductList_' . $this->_category->getId() . '_' . $toolbar->getCurrentOrder() . '_' . $toolbar->getCurrentDirection() . '_' . $toolbar->getCurrentMode() . '_' . $toolbar->getCurrentPage() . '_' . $toolbar->getLimit() . '_' . $total . '_' . Mage::App()->getStore()->getCode();
     foreach (Mage::app()->getRequest()->getParams() as $key => $value) {
         if (is_array($value)) {
             $value = implode('_', $value);
         }
         $realValue = '';
         $valueArray = array();
         $valueArray = explode('_', $value);
         asort($valueArray);
         $value = implode('_', $valueArray);
         if (is_array($value)) {
             foreach ($value as $k => $v) {
                 $realValue .= '_' . $v;
             }
         } else {
             $realValue = $value;
         }
         if (!in_array(strtolower($key), array('utm_source', 'utm_content', 'utm_campaign', 'utm_medium', 'utm_term', 'gclid'))) {
             $cacheKey .= "_" . $key . '-' . $realValue;
         }
     }
     return $cacheKey;
 }
 public function getTotalNum()
 {
     if (Mage::helper('cataloginventory')->isShowOutOfStock()) {
         return parent::getTotalNum();
     }
     if (is_null($this->_totalRecords)) {
         $collection = clone $this->getCollection();
         $collection->getSelect()->reset(Zend_Db_Select::ORDER)->reset(Zend_Db_Select::LIMIT_COUNT)->reset(Zend_Db_Select::LIMIT_OFFSET);
         $collection->setCurPage(false)->setPageSize(false);
         $collection->clear()->load();
         $this->_totalRecords = count($collection);
     }
     return $this->_totalRecords;
 }
Exemplo n.º 12
0
 public function getPagerHtml()
 {
     if ($identifier = Mage::app()->getRequest()->getParam('am_landing')) {
         $alias = 'product_list_toolbar_pager';
         $oldPager = $this->getChild($alias);
         if ($oldPager instanceof Varien_Object) {
             $newPager = $this->getLayout()->createBlock('amlanding/catalog_pager')->setArea('frontend')->setTemplate($oldPager->getTemplate());
             $newPager->assign('_type', 'html')->assign('_section', 'body');
             $this->setChild($alias, $newPager);
         }
         return parent::getPagerHtml();
     }
     return parent::getPagerHtml();
 }
Exemplo n.º 13
0
 public function getPagerHtml()
 {
     if ($this->skip()) {
         return parent::getPagerHtml();
     }
     $alias = 'product_list_toolbar_pager';
     $oldPager = $this->getChild($alias);
     if ($oldPager instanceof Varien_Object) {
         $newPager = $this->getLayout()->createBlock('amshopby/catalog_pager')->setArea('frontend')->setTemplate($oldPager->getTemplate());
         //@todo assign other params if needed
         $newPager->assign('_type', 'html')->assign('_section', 'body');
         $this->setChild($alias, $newPager);
     }
     return parent::getPagerHtml();
 }
Exemplo n.º 14
0
 public function getPagerUrl($params = array())
 {
     $innerParams = $this->getRequest()->getParams();
     $identifier = $innerParams['identifier'];
     $moduelUrl = $this->getUrl();
     $parentPath = parent::getPagerUrl($params);
     if (strpos($parentPath, '?') !== false) {
         $parts = explode('?', $parentPath);
         if (count($parts) == 2) {
             $_helper = Mage::helper('brand');
             $moduelUrl .= $_helper->getRoute() . '/' . $identifier . '.html/';
             $moduelUrl .= '?' . $parts[1];
         }
     }
     return $moduelUrl;
 }
Exemplo n.º 15
0
 protected function _construct()
 {
     parent::_construct();
     $this->_orderField = 'created_at';
     //load avaiable limit
     /*$arr= explode(',','2,3');
     		$availableLimit = array();
     		foreach($arr as $value){
     			$value = trim($value,' ');
     			$this->_availableLimit['detail'][$value] =$value;
     			$this->_availableLimit['simple'][$value] = $value;
     		}*/
     $this->setDefaultDirection('desc');
     $this->_availableOrder = array('created_at' => $this->__('Time'), 'title' => $this->__('Name'), 'position' => $this->__('Position'));
     $this->_availableMode = array('detail' => $this->__('Detail'), 'simple' => $this->__('Simple'));
     $this->setPageVarName('page');
     $this->getCollection($this->getCollection());
     $this->setTemplate('em_blog/post/list/toolbar.phtml');
 }
Exemplo n.º 16
0
 protected function _construct()
 {
     parent::_construct();
     $this->_orderField = 'created_at';
     //load avaiable limit
     $arr = explode(',', Mage::getStoreConfig('blog/info/pagesize'));
     //$availableLimit = array();
     foreach ($arr as $value) {
         $value = trim($value, ' ');
         $this->_availableLimit['detail'][$value] = $value;
         $this->_availableLimit['simple'][$value] = $value;
     }
     $this->setDefaultDirection('desc');
     $this->_availableOrder = array('created_at' => $this->__('Time'), 'title' => $this->__('Name'));
     if (Mage::registry('current_cat')) {
         $this->_availableOrder['position'] = $this->__('Position');
     }
     $this->_availableMode = array('detail' => $this->__('Detail'), 'simple' => $this->__('Simple'));
     $this->setPageVarName('page');
     //$this->getCollection($this->getCollection());
     $this->setTemplate('em_blog/post/list/toolbar.phtml');
 }
Exemplo n.º 17
0
 public function getCacheKey()
 {
     if (!$this->_isCacheActive()) {
         parent::getCacheKey();
     }
     $_taxRateRequest = Mage::getModel('tax/calculation')->getRateRequest();
     $_customer = Mage::getSingleton('customer/session')->getCustomer();
     $this->_category = Mage::getSingleton('catalog/layer')->getCurrentCategory();
     $_page = $this->getPage();
     $toolbar = new Mage_Catalog_Block_Product_List_Toolbar();
     $cacheKey = 'ProductLayerView_' . $this->_category->getId() . '_' . $toolbar->getCurrentOrder() . '_' . $toolbar->getCurrentDirection() . '_' . $toolbar->getCurrentMode() . '_' . $toolbar->getCurrentPage() . '_' . $toolbar->getLimit() . '_' . Mage::App()->getStore()->getCode() . '_' . Mage::App()->getStore()->getCurrentCurrencyCode() . '_' . $_customer->getGroupId() . '_' . $_taxRateRequest->getCountryId() . "_" . $_taxRateRequest->getRegionId() . "_" . $_taxRateRequest->getPostcode() . "_" . $_taxRateRequest->getCustomerClassId() . "_" . Mage::registry('current_tag') . '_' . '';
     /* ... layern navigation + search */
     foreach (Mage::app()->getRequest()->getParams() as $key => $value) {
         $cacheKey .= $key . '-' . $value . '_';
     }
     return $cacheKey;
 }
Exemplo n.º 18
0
 public function getModeUrlParams($mode)
 {
     $url = parent::getModeUrl($mode);
     $clean_url = $url;
     if (strpos($url, "?") !== false) {
         $clean_url = substr($url, 0, strpos($url, '?'));
     }
     return str_replace($clean_url, "", $url);
 }
Exemplo n.º 19
0
 /**
  * Get var name for sorting direction
  *
  * @return string
  */
 public function getDirectionVarName()
 {
     if ($this->_handler) {
         return 'sort' . $this->getCurrentOrder();
     }
     return parent::getDirectionVarName();
 }
 public function _construct()
 {
     parent::_construct();
     $this->disableParamsMemorizing();
 }
Exemplo n.º 21
0
 /**
  * Init Toolbar
  *
  */
 protected function _construct()
 {
     parent::_construct();
     $this->_orderField = Mage::getStoreConfig(Mage_Catalog_Model_Config::XML_PATH_LIST_DEFAULT_SORT_BY);
     $this->_availableOrder = $this->_getConfig()->getAttributeUsedForSortByArray();
     switch (Mage::getStoreConfig('catalog/frontend/list_mode')) {
         case 'grid':
             $this->_availableMode = array('grid' => $this->__('Grid'));
             break;
         case 'list':
             $this->_availableMode = array('list' => $this->__('List'));
             break;
         case 'grid-list':
             $this->_availableMode = array('grid' => $this->__('Grid'), 'list' => $this->__('List'));
             break;
         case 'list-grid':
             $this->_availableMode = array('list' => $this->__('List'), 'grid' => $this->__('Grid'));
             break;
     }
     $this->setTemplate('catalog/product/list/toolbar.phtml');
 }
Exemplo n.º 22
0
 public function __construct()
 {
     parent::_construct();
     $this->_availableOrder = array('brand_position' => $this->__('Recommended'), 'name' => $this->__('Name'), 'price' => $this->__('Price'));
 }
Exemplo n.º 23
0
 public function setCollection($collection)
 {
     if (!Mage::helper('searchanise/ApiSe')->checkSearchaniseResult(true)) {
         return parent::setCollection($collection);
     }
     if (!method_exists($collection, 'checkSearchaniseResult') || !$collection->checkSearchaniseResult()) {
         return parent::setCollection($collection);
     }
     $this->_collection = $collection;
     $this->_collection->setCurPage($this->getCurrentPage());
     // we need to set pagination only if passed value integer and more that 0
     $limit = (int) $this->getLimit();
     if ($limit) {
         //~ $this->_collection->setPageSize($limit);
     }
     if ($this->getCurrentOrder()) {
         $this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
     }
     return $this;
 }
Exemplo n.º 24
0
 /**
  * Retrieve loaded category collection
  *
  * @return Mage_Catalog_Model_Resource_Collection_Abstract | null
  */
 protected function _getProductCollection()
 {
     /* For catalog list and search results
      * Expects getListBlock as Mage_Catalog_Block_Product_List
      */
     if (is_null($this->_productCollection)) {
         $this->_productCollection = $this->getListBlock()->getLoadedProductCollection();
     }
     /* For collections of cross/up-sells and related
      * Expects getListBlock as one of the following:
      * Enterprise_TargetRule_Block_Catalog_Product_List_Upsell | _linkCollection
      * Enterprise_TargetRule_Block_Catalog_Product_List_Related | _items
      * Enterprise_TargetRule_Block_Checkout_Cart_Crosssell | _items
      * Mage_Catalog_Block_Product_List_Related | _itemCollection
      * Mage_Catalog_Block_Product_List_Upsell | _itemCollection
      * Mage_Checkout_Block_Cart_Crosssell, | setter items
      */
     if ($this->_showCrossSells && is_null($this->_productCollection)) {
         $this->_productCollection = $this->getListBlock()->getItemCollection();
     }
     // Support for CE
     if (is_null($this->_productCollection) && ($this->getBlockName() == 'catalog.product.related' || $this->getBlockName() == 'checkout.cart.crosssell')) {
         $this->_productCollection = $this->getListBlock()->getItems();
     }
     //limit collection for page product
     $this->_productCollection->setCurPage($this->getCurrentPage());
     // we need to set pagination only if passed value integer and more that 0
     $limit = (int) Mage_Catalog_Block_Product_List_Toolbar::getLimit();
     if ($limit) {
         $this->_productCollection->setPageSize($limit);
     }
     return $this->_productCollection;
 }
Exemplo n.º 25
0
 public function getOrder2Url($order, $direction)
 {
     return str_replace('?', '?', parent::getOrder2Url($order, $direction));
 }