protected function _beforeToHtml() { $toolbar = $this->getToolbarBlock(); // called prepare sortable parameters $collection = $this->getLoadedProductCollection(); // use sortable parameters if ($orders = $this->getAvailableOrders()) { $toolbar->setAvailableOrders($orders); } if ($sort = $this->getSortBy()) { $toolbar->setDefaultOrder($sort); } if ($dir = $this->getDefaultDirection()) { $toolbar->setDefaultDirection($dir); } if ($modes = $this->getModes()) { $toolbar->setModes($modes); } // set collection to toolbar and apply sort if ($collection == '') { echo "null"; } echo "hell"; $toolbar->setCollection($collection); $this->setChild('toolbar', $toolbar); Mage::dispatchEvent('extension_block_product_list_collection', array('collection' => $this->getLoadedProductCollection())); $this->getLoadedProductCollection()->load(); return parent::_beforeToHtml(); }
protected function _beforeToHtml() { parent::_beforeToHtml(); $toolbar = $this->getToolbarBlock(); $toolbar->removeOrderFromAvailableOrders('position'); return $this; }
protected function _beforeToHtml() { $collection = Mage::getSingleton('catalogsale/layer')->getProductCollection(); $collection->setPageSize($this->getProductsCount())->setCurPage(1); $collection->getSelect()->order('rand()'); $this->setProductCollection($collection); return parent::_beforeToHtml(); }
protected function _beforeToHtml() { $blockName = $this->getToolbarBlockName(); if (!$blockName) { $blockName = 'product_list_toolbar'; $this->setToolbarBlockName($blockName); $this->getLayout()->createBlock($this->_defaultToolbarBlock, $blockName, array('show_toolbar' => $this->getData('show_toolbar'), 'list_mode' => $this->getData('list_mode'), '_current_limit' => $this->getData('limit')))->setChild($blockName . '_pager', $this->getLayout()->createBlock('page/html_pager', $blockName . '_pager')); } return parent::_beforeToHtml(); }
protected function _beforeToHtml() { $blockName = $this->getToolbarBlockName(); if (!$blockName) { $blockName = 'product_list_toolbar'; $this->setToolbarBlockName($blockName); $this->getLayout()->createBlock($this->_defaultToolbarBlock, $blockName)->setTemplate('catalog/product/list/toolbar.phtml')->setChild($blockName . '_pager', $this->getLayout()->createBlock('page/html_pager', $blockName . '_pager')); } return parent::_beforeToHtml(); }
protected function _beforeToHtml() { $collection = $this->_getProductCollection(); $numProducts = $this->getNumProducts(); if ($numProducts) { $collection->setPageSize($numProducts)->load(); } $this->setCollection($collection); return parent::_beforeToHtml(); }
protected function _beforeToHtml() { parent::_beforeToHtml(); if ($this->getMode() == 'grid') { $this->setTemplate('auction/grid.phtml'); } else { $this->setTemplate('auction/list.phtml'); } $this->setTemplate('auction/grid.phtml'); return $this; }
/** * Need use as _prepareLayout - but problem in declaring collection from * another block (was problem with search result) */ protected function _beforeToHtml() { $catId = ''; if (Mage::registry('current_category')) { $catId = Mage::registry('current_category')->getId(); } $toolbar = $this->getToolbarBlock(); // called prepare sortable parameters $collection = $this->_getProductCollection(); if ($catId == '539') { // 539 stands for live Schedule category $curr_date = Mage::getModel('core/date')->date('Y-m-d H:i:s'); $collection->addAttributeToFilter('event_date', array('gteq' => $curr_date)); } // use sortable parameters if ($orders = $this->getAvailableOrders()) { $toolbar->setAvailableOrders($orders); } if ($sort = $this->getSortBy()) { $toolbar->setDefaultOrder($sort); } if ($dir = $this->getDefaultDirection()) { $toolbar->setDefaultDirection($dir); } if ($modes = $this->getModes()) { $toolbar->setModes($modes); } // fix for POSITION sorting by ASC but all other sortings are by DESC $current_sort = Mage::app()->getRequest()->getParam('order'); // set collection to toolbar and apply sort $toolbar->setCollection($collection); $this->setChild('toolbar', $toolbar); Mage::dispatchEvent('catalog_block_product_list_collection', array('collection' => $this->_getProductCollection())); $store_parameter = Mage::app()->getRequest()->getParam('___store'); if ($current_sort == 'position') { $collection->getSelect()->reset(Zend_Db_Select::ORDER); $collection->setOrder('position', 'asc'); } elseif (empty($current_sort) && !isset($store_parameter)) { $collection->getSelect()->reset(Zend_Db_Select::ORDER); $collection->setOrder('position', 'asc'); } $this->_getProductCollection()->load(); return parent::_beforeToHtml(); }
protected function _beforeToHtml() { $return = parent::_beforeToHtml(); $toolbar = $this->getToolbarBlock(); $current_category = Mage::registry("current_category"); if ($current_category) { $dir = $this->getRequest()->getParam($toolbar->getDirectionVarName()); $sort_direction = $current_category->getSortDirection(); if (!$dir and $sort_direction) { if ($sort_direction == 2) { $sort_direction = "desc"; } else { $sort_direction = "asc"; } $toolbar->setData('_current_grid_direction', $sort_direction); } } return $return; }
protected function _beforeToHtml() { parent::_beforeToHtml(); $toolbar = $this->getToolbarBlock(); $toolbar->removeOrderFromAvailableOrders('position'); if (!$this->_getProductCollection()->count()) { return ''; } $this->assign('FeaturedProductCollection', $this->_getProductCollection()); $_columnCount = (int) $this->params['column_count']; if (!$_columnCount || $_columnCount == 0 || empty($_columnCount)) { $_columnCount = 3; } $size_width = 100 / $_columnCount; $this->assign('item_width', $size_width); $this->assign('_columnCount', $_columnCount); $this->setData('column_count', $_columnCount); /* assign variables in the parameters */ foreach ($this->params as $_para => $value) { $this->assign($_para, $value); } return $this; }
protected function _beforeToHtml() { $catid = Mage::app()->getRequest()->getParam('catid'); if ($catid != '') { $this->setTemplate('vt/productsconfig/item.phtml'); } else { if (!($template = $this->getTemplate())) { $this->setTemplate($this->defaultTemplate); } } /*$toolbar = $this->getToolbarBlock(); $collection = $this->_getProductCollection(); // use sortable parameters if ($orders = $this->getAvailableOrders()) { $toolbar->setAvailableOrders($orders); } if ($sort = $this->getSortBy()) { $toolbar->setDefaultOrder($sort); } if ($dir = $this->getDefaultDirection()) { $toolbar->setDefaultDirection($dir); } if ($modes = $this->getModes()) { $toolbar->setModes($modes); } $toolbar->setCollection($collection); $this->setChild('toolbar', $toolbar); Mage::dispatchEvent('catalog_block_product_list_collection', array( 'collection' => $this->_getProductCollection() ));*/ $this->_getProductCollection()->load(); return parent::_beforeToHtml(); }
protected function _beforeToHtml() { parent::_beforeToHtml(); $this->setTemplate('bubble/instant/product/list.phtml'); }
/** * Need use as _prepareLayout - but problem in declaring collection from * another block (was problem with search result) */ protected function _beforeToHtml() { /*$toolbar = $this->getLayout()->createBlock('catalog/product_list_toolbar', microtime()); if ($toolbarTemplate = $this->getToolbarTemplate()) { $toolbar->setTemplate($toolbarTemplate); }*/ $toolbar = $this->getToolbarBlock(); // called prepare sortable parameters $collection = $this->_getProductCollection(); // use sortable parameters if ($orders = $this->getAvailableOrders()) { $toolbar->setAvailableOrders($orders); } if ($sort = $this->getSortBy()) { $toolbar->setDefaultOrder($sort); } if ($dir = $this->getDefaultDirection()) { $toolbar->setDefaultDirection($dir); } if ($modes = $this->getModes()) { $toolbar->setModes($modes); } // set collection to tollbar and apply sort $toolbar->setCollection($collection); $this->setChild('toolbar', $toolbar); Mage::dispatchEvent('catalog_block_product_list_collection', array('collection' => $this->_getProductCollection())); $this->_getProductCollection()->load(); Mage::getModel('review/review')->appendSummary($this->_getProductCollection()); return parent::_beforeToHtml(); }
protected function _beforeToHtml() { $toolbar = $this->getToolbarBlock(); $collection = $this->_getProductCollection(); // use sortable parameters if ($orders = $this->getAvailableOrders()) { $toolbar->setAvailableOrders($orders); } if ($sort = $this->getSortBy()) { $toolbar->setDefaultOrder($sort); } if ($dir = $this->getDefaultDirection()) { $toolbar->setDefaultDirection($dir); } // set collection to toolbar and apply sort $toolbar->setCollection($collection); $this->setChild('toolbar', $toolbar); Mage::dispatchEvent('catalog_block_product_list_collection', array('collection' => $this->_getProductCollection())); $this->_getProductCollection()->load(); return parent::_beforeToHtml(); }