Exemple #1
0
 protected function _beforeToHtml()
 {
     $todayDate = AO::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
     $collection = $this->_addProductAttributesAndPrices(AO::getResourceModel('catalog/product_collection'))->addStoreFilter()->addAttributeToFilter('news_from_date', array('date' => true, 'to' => $todayDate))->addAttributeToFilter('news_to_date', array('or' => array(0 => array('date' => true, 'from' => $todayDate), 1 => array('is' => new Zend_Db_Expr('null')))), 'left')->addAttributeToSort('news_from_date', 'desc')->setPageSize($this->getProductsCount())->setCurPage(1);
     $this->setProductCollection($collection);
     return parent::_beforeToHtml();
 }
Exemple #2
0
 protected function _beforeToHtml()
 {
     if ($this->getTemplate() == 'dgt/widget/default.phtml') {
         switch ($this->getData('widget_type')) {
             case 'product':
                 switch ($this->getData('mode')) {
                     case 'related':
                         $this->setTemplate('dgt/widget/related.phtml');
                         break;
                     default:
                         $this->setTemplate('dgt/widget/product.phtml');
                         break;
                 }
                 switch ($this->getData('widget_tab')) {
                     case 'categories':
                     case 'collections':
                         $this->setTemplate('dgt/widget/tab.phtml');
                         break;
                 }
                 break;
             case 'attribute':
                 $this->setTemplate('dgt/widget/attribute.phtml');
                 break;
             case 'block':
                 $this->setTemplate('dgt/widget/block.phtml');
                 break;
             case 'category':
                 $this->setTemplate('dgt/widget/category.phtml');
                 break;
         }
     }
     return parent::_beforeToHtml();
 }
Exemple #3
0
 protected function _beforeToHtml()
 {
     $toolbar = $this->getToolbarBlock();
     // called prepare sortable parameters
     $collection = $this->getProductCollectionGroup();
     // 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
     $toolbar->setCollection($collection);
     $this->setChild('toolbar', $toolbar);
     Mage::dispatchEvent('catalog_block_product_list_collection', array('collection' => $this->getProductCollectionGroup()));
     $this->getProductCollectionGroup()->load();
     return parent::_beforeToHtml();
 }
Exemple #4
0
 protected function _beforeToHtml()
 {
     if (!$this->_configs['show']) {
         return;
     }
     //Handle data from call line in xml (custom design)
     foreach ($this->_configs as $key => $value) {
         $data = $this->getData($key);
         if ($data) {
             $this->_configs[$key] = $data;
         }
     }
     $detect = Mage::helper('joomlart_jmslideshow/mobiledetect');
     if ($detect->isTablet()) {
         if ($this->_configs["mainWidthtablet"]) {
             $this->_configs["mainWidth"] = $this->_configs["mainWidthtablet"];
         }
     } else {
         if ($detect->isMobile()) {
             if ($this->_configs["mainWidthmobile"]) {
                 $this->_configs["mainWidth"] = $this->_configs["mainWidthmobile"];
             }
         }
     }
     return parent::_beforeToHtml();
 }
Exemple #5
0
 protected function _beforeToHtml()
 {
     $collection = Mage::getResourceModel('catalog/product_collection');
     $collection->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
     $collection = $this->_addProductAttributesAndPrices($collection)->addStoreFilter()->addAttributeToSort('entity_id', 'desc')->setPageSize($this->getLimit())->setCurPage(1);
     $this->setProductCollection($collection);
     return parent::_beforeToHtml();
 }
 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();
 }
 /**
  * Need use as _prepareLayout - but problem in declaring collection from
  * another block (was problem with search result)
  */
 protected function _beforeToHtml()
 {
     foreach ($this->_config as $key => $value) {
         if ($this->getData($key)) {
             $this->_config[$key] = $this->getData($key);
         }
     }
     return parent::_beforeToHtml();
 }
Exemple #8
0
 /**
  * Prepare collection with new products and applied page limits.
  *
  * return Mage_Catalog_Block_Product_New
  */
 protected function _beforeToHtml()
 {
     $todayDate = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
     $collection = Mage::getResourceModel('catalog/product_collection');
     $collection->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
     $collection = $this->_addProductAttributesAndPrices($collection)->addStoreFilter()->addAttributeToFilter('special_from_date', array('or' => array(0 => array('date' => true, 'to' => $todayDate), 1 => array('is' => new Zend_Db_Expr('null')))), 'left')->addAttributeToFilter('special_to_date', array('or' => array(0 => array('date' => true, 'from' => $todayDate), 1 => array('is' => new Zend_Db_Expr('null')))), 'left')->addAttributeToFilter(array(array('attribute' => 'special_from_date', 'is' => new Zend_Db_Expr('not null')), array('attribute' => 'special_to_date', 'is' => new Zend_Db_Expr('not null'))))->addAttributeToSort('special_from_date', 'asc')->setPageSize($this->getProductsCount())->setCurPage(1);
     $this->setProductCollection($collection);
     return parent::_beforeToHtml();
 }
Exemple #9
0
 protected function _beforeToHtml()
 {
     $storeId = Mage::app()->getStore()->getId();
     $products = Mage::getResourceModel('reports/product_collection')->addOrderedQty()->addAttributeToSelect('*')->addAttributeToSelect(array('name', 'price', 'small_image'))->setStoreId($storeId)->addStoreFilter($storeId)->addViewsCount();
     Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
     Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
     $products->setPageSize($this->getModel()->getPopularCount())->setCurPage(1);
     $this->setProductCollection($products);
     return parent::_beforeToHtml();
 }
Exemple #10
0
 protected function _beforeToHtml()
 {
     $collection = Mage::getResourceModel('catalog/product_collection');
     $attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
     $collection->addAttributeToSelect($attributes)->addMinimalPrice()->addFinalPrice()->addTaxPercents()->addAttributeToFilter('inchoo_featured_product', 1, 'left')->addStoreFilter()->getSelect()->order($this->getSortBy())->limit($this->getLimit());
     Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
     Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
     $this->_productCollection = $collection;
     $this->setProductCollection($collection);
     return parent::_beforeToHtml();
 }
 /**
  * Prepare collection with new products and applied page limits.
  *
  * return Mage_Catalog_Block_Product_New
  */
 protected function _beforeToHtml()
 {
     $todayDate = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
     $collection = Mage::getResourceModel('catalog/product_collection');
     $collection->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
     $collection = $this->_addProductAttributesAndPrices($collection)->addStoreFilter();
     $collection->addAttributeToSelect('feature_product');
     $collection->addFieldToFilter(array(array('attribute' => 'feature_product', 'eq' => true)));
     $collection->addAttributeToSort('news_from_date', 'asc')->setPageSize($this->getProductsCount())->setCurPage(1);
     $this->setProductCollection($collection);
     return parent::_beforeToHtml();
 }
Exemple #12
0
 protected function _beforeToHtml()
 {
     $storeId = Mage::app()->getStore()->getId();
     $sellDate = $this->getModel()->getSellDate($this->getModel()->getHomepageDaysLimit());
     $collection = Mage::getResourceModel('reports/product_sold_collection')->addOrderedQty()->setStoreId($storeId)->addStoreFilter($storeId)->setDateRange($sellDate['startdate'], $sellDate['todaydate'])->addUrlRewrite()->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)->setOrder('ordered_qty', 'desc')->setPageSize($this->getModel()->getTopsellCount())->setCurPage(1)->setOrder('ordered_qty', 'desc');
     $catId = Mage::getStoreConfig('homepage/topsell/homecat');
     if ($catId > 0) {
         $category = $this->getModel()->getCategory($catId);
         $collection->addCategoryFilter($category);
     }
     $this->setProductCollection($collection);
     return parent::_beforeToHtml();
 }
Exemple #13
0
 protected function _beforeToHtml()
 {
     $todayDate = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
     $collection = Mage::getResourceModel('catalog/product_collection');
     Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
     Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
     $collection = $this->_addProductAttributesAndPrices($collection)->addStoreFilter()->addAttributeToFilter('news_from_date', array('date' => true, 'to' => $todayDate))->addAttributeToFilter('news_to_date', array('or' => array(0 => array('date' => true, 'from' => $todayDate), 1 => array('is' => new Zend_Db_Expr('null')))), 'left')->addAttributeToSort('news_from_date', 'desc')->setPageSize($this->getProductsCount())->setCurPage(1);
     if ($categoryId = $this->getRequest()->getParam('id')) {
         $category = Mage::getModel('catalog/category')->load($categoryId);
         $collection->addCategoryFilter($category);
     }
     $this->setProductCollection($collection);
     return parent::_beforeToHtml();
 }
 /**
  * Prepare collection with new products and applied page limits.
  *
  * return Mage_Catalog_Block_Product_New
  */
 protected function _beforeToHtml()
 {
     $todayDate = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
     $collection = Mage::getResourceModel('catalog/product_collection');
     $collection->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
     $collection = $this->_addProductAttributesAndPrices($collection)->addStoreFilter()->addAttributeToFilter('special_from_date', array('or' => array(0 => array('date' => true, 'to' => $todayDate), 1 => array('is' => new Zend_Db_Expr('null')))), 'left')->addAttributeToFilter('special_to_date', array('or' => array(0 => array('date' => true, 'from' => $todayDate), 1 => array('is' => new Zend_Db_Expr('null')))), 'left')->addAttributeToFilter(array(array('attribute' => 'special_from_date', 'is' => new Zend_Db_Expr('not null')), array('attribute' => 'special_to_date', 'is' => new Zend_Db_Expr('not null'))))->addAttributeToSort('special_from_date', 'asc')->setPageSize(8)->setCurPage(1);
     // Limit to a specific category
     $_cat_id = (int) Mage::getStoreConfig('milanoconfig/homeoptions/sale_products_cat_id');
     if ($_cat_id) {
         $collection->addCategoryFilter(Mage::getModel("catalog/category")->load($_cat_id));
     }
     $this->setProductCollection($collection);
     return parent::_beforeToHtml();
 }
 protected function _beforeToHtml()
 {
     $storeId = Mage::app()->getStore()->getId();
     $collection = Mage::getResourceModel('reports/product_collection')->addAttributeToSelect('*')->setStoreId($storeId)->addStoreFilter($storeId)->addViewsCount()->setPageSize($this->getModel()->getCatProductsLimit())->setCurPage(1)->setOrder('views_count', 'desc');
     Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
     Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
     $c = Mage::registry("current_category");
     $catId = $c->getData('entity_id');
     if ($catId > 0) {
         $category = $this->getModel()->getCategory($catId);
         $collection->addCategoryFilter($category);
     }
     $this->setProductCollection($collection);
     return parent::_beforeToHtml();
 }
Exemple #16
0
 protected function _beforeToHtml()
 {
     $this->assign('FeaturedProductCollection', $this->_getProductCollection());
     $_columnCount = $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', (int) $_columnCount);
     /* assign variables in the parameters */
     foreach ($this->params as $_para => $value) {
         $this->assign($_para, $value);
     }
     return parent::_beforeToHtml();
 }
 protected function _beforeToHtml()
 {
     $storeId = Mage::app()->getStore()->getId();
     $sellDate = $this->getModel()->getSellDate($this->getModel()->getHomepageDaysLimit());
     $collection = Mage::getResourceModel('reports/product_sold_collection')->addOrderedQty()->setStoreId($storeId)->addStoreFilter($storeId)->setDateRange($sellDate['startdate'], $sellDate['todaydate'])->addUrlRewrite()->setOrder('ordered_qty', 'desc')->setPageSize($this->getModel()->getHomepageProductsLimit())->setCurPage(1)->setOrder('ordered_qty', 'desc');
     if ($collection->isEnabledFlat()) {
         $collection->getSelect()->joinLeft(array('cpl' => $collection->getResource()->getFlatTableName()), "e.entity_id = cpl.entity_id")->where("cpl.visibility IN (?)", array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH));
     } else {
         $collection->addAttributeToFilter('cpl.visibility', array('in' => array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH)));
     }
     $catId = $this->getModel()->getHomepageCatID();
     if ($catId > 0) {
         $category = $this->getModel()->getCategory($catId);
         $collection->addCategoryFilter($category);
     }
     $this->setProductCollection($collection);
     return parent::_beforeToHtml();
 }
Exemple #18
0
 protected function _beforeToHtml()
 {
     $collection = Mage::getResourceModel('catalog/product_collection');
     Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
     Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
     $collection = $this->_addProductAttributesAndPrices($collection)->addStoreFilter(Mage::app()->getStore()->getId())->setPageSize($this->getProductsCount())->setCurPage(1);
     try {
         if (!$collection->getAttribute("featured")) {
             // Mage 1.6.0.0 fix
             throw new Exception("Attribute featured not found");
         }
         $collection->addAttributeToFilter("featured", array('Yes' => true));
     } catch (Exception $e) {
         $collection = false;
     }
     $this->addPriceBlockType('bundle', 'bundle/catalog_product_price', 'bundle/catalog/product/price.phtml');
     $this->setProductCollection($collection);
     return parent::_beforeToHtml();
 }
Exemple #19
0
 protected function _beforeToHtml()
 {
     $currentCategory = Mage::registry('current_category');
     if ($currentCategory) {
         $catid = $currentCategory->getId();
     }
     if (isset($catid)) {
         $category = Mage::getModel('catalog/category')->load($catid);
         $collection = $category->getProductCollection();
     } else {
         $collection = Mage::getResourceModel('catalog/product_collection');
     }
     $attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
     $collection->addAttributeToSelect($attributes)->addMinimalPrice()->addFinalPrice()->addTaxPercents()->addAttributeToFilter('inchoo_seller_product', 1, 'left')->addStoreFilter()->getSelect()->order($this->getSortBy())->limit($this->getLimit());
     Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
     Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
     $this->_productCollection = $collection;
     $this->setProductCollection($collection);
     return parent::_beforeToHtml();
 }
 protected function _beforeToHtml()
 {
     $ids = $this->getData('ids');
     if ($ids) {
         $ids = explode('}{', $ids);
         $cleanIds = array();
         foreach ($ids as $id) {
             $id = str_replace('{', '', $id);
             $id = str_replace('}', '', $id);
             $cleanIds[] = $id;
         }
         if (count($cleanIds)) {
             $products = $this->_getProductsByIDs($cleanIds);
             if ($products) {
                 $this->setProductCollection($products);
             }
         }
     }
     return parent::_beforeToHtml();
 }
Exemple #21
0
 /**
  * Need use as _prepareLayout - but problem in declaring collection from
  * another block (was problem with search result)
  */
 protected function _beforeToHtml()
 {
     //assign some settings from block attributes
     if ($this->getData("quanlity")) {
         $this->_config['qty'] = $this->getData("quanlity");
     }
     if ($this->getData("perrow")) {
         $this->_config['perrow'] = $this->getData("perrow");
     }
     if ($this->getData("mode")) {
         $this->_config['mode'] = $this->getData("mode");
     }
     $collection = $this->getListProducts();
     $toolbar = $this->getToolbarBlock();
     // 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->addPagerLimit("grid", $this->_config['qtyperpage']);
     $toolbar->addPagerLimit("list", $this->_config['qtyperpage']);
     // set collection to toolbar and apply sort
     if (is_object($collection)) {
         $toolbar->setCollection($collection);
         $this->setChild('toolbar', $toolbar);
         Mage::dispatchEvent('catalog_block_product_list_collection', array('collection' => $collection));
     }
     return parent::_beforeToHtml();
 }
 protected function _beforeToHtml()
 {
     $toolbar = $this->getToolbarBlock();
     $todayDate = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
     $collection = Mage::getResourceModel('catalog/product_collection');
     Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
     Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
     $collection = $this->_addProductAttributesAndPrices($collection)->addStoreFilter()->addAttributeToFilter('special_price', array('gt' => 0), 'left')->addAttributeToFilter('special_from_date', array('date' => true, 'to' => $todayDate))->addAttributeToFilter('special_to_date', array('or' => array(0 => array('date' => true, 'from' => $todayDate), 1 => array('is' => new Zend_Db_Expr('null')))), 'left')->addAttributeToSort('special_from_date', 'desc')->setPageSize($this->getProductsCount())->setCurPage(1);
     $this->setProductCollection($collection);
     if ($orders = $this->getAvailableOrders()) {
         $toolbar->setAvailableOrders($orders);
     }
     if ($sort = $this->getSortBy()) {
         $toolbar->setDefaultOrder($sort);
     }
     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' => $collection));
     return parent::_beforeToHtml();
 }
Exemple #23
0
 protected function _beforeToHtml()
 {
     $this->_prepareData();
     return parent::_beforeToHtml();
 }
Exemple #24
0
 /**
  * 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();
     if ($orders = $this->getAvailableOrders()) {
         $toolbar->setAvailableOrders($orders);
     }
     if ($modes = $this->getModes()) {
         $toolbar->setModes($modes);
     }
     $toolbar->setCollection($this->_getProductCollection());
     $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();
 }
 /**
  * Need use as _prepareLayout - but problem in declaring collection from
  * another block (was problem with search result)
  */
 protected function _beforeToHtml()
 {
     if (!$this->_config['show']) {
         return;
     }
     $toolbar = $this->getToolbarBlock();
     $viewall = $this->getData("viewall") ? $this->getData("viewall") : false;
     $filter = $this->getData("filter") ? $this->getData("filter") : false;
     // called prepare sortable parameters
     //assign some settings from block attributes
     if ($this->getData("quanlity")) {
         $this->_config['qty'] = $this->getData("quanlity");
     }
     if ($this->getData("catsid")) {
         $this->_config['catsid'] = $this->getData("catsid");
     }
     if ($this->getData("perrow")) {
         $this->_config['perrow'] = $this->getData("perrow");
     }
     if ($this->getData("mode")) {
         $this->_config['mode'] = $this->getData("mode");
     }
     if ($this->getData("title")) {
         $this->_config['title'] = $this->getData("title");
     }
     if ($this->getData("qtyperpage")) {
         $this->_config['qtyperpage'] = $this->getData("qtyperpage");
     }
     $detect = Mage::helper('joomlart_jmproducts/mobiledetect');
     if ($detect->isTablet()) {
         //assign some settings from block attributes
         if ($this->getData("quanlitytable")) {
             $this->_config['qty'] = $this->getData("quanlitytable");
         }
         if ($this->getData("perrowtablet")) {
             $this->_config['perrow'] = $this->getData("perrowtablet");
         }
         if ($this->getData("qtyperpagetable")) {
             $this->_config['qtyperpagetable'] = $this->getData("qtyperpagetable");
         }
     } elseif ($detect->isMobile()) {
         //assign some settings from block attributes
         if ($this->getData("quanlitymobile")) {
             $this->_config['qty'] = $this->getData("quanlitymobile");
         }
         if ($this->getData("perrowmobile")) {
             $this->_config['perrow'] = $this->getData("perrowmobile");
         }
         if ($this->getData("qtyperpage")) {
             $this->_config['qtyperpagemobile'] = $this->getData("qtyperpagemobile");
         }
     }
     $collection = $this->getListProducts();
     // 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);
     }
     if ($this->_config['qtyperpage']) {
         $toolbar->addPagerLimit("grid", $this->_config['qtyperpage']);
         $toolbar->addPagerLimit("list", $this->_config['qtyperpage']);
     }
     // set collection to toolbar and apply sort
     // set collection to toolbar and apply sort
     if (is_object($collection) && (method_exists($collection, "setMaxSize") || $viewall || $filter)) {
         $toolbar->setCollection($collection);
         $this->setChild('toolbar', $toolbar);
         Mage::dispatchEvent('catalog_block_product_list_collection', array('collection' => $collection));
     }
     return parent::_beforeToHtml();
 }
Exemple #26
0
 protected function _beforeToHtml()
 {
     if (!$this->_config['show']) {
         return;
     }
     //Handle data from call line in xml (custom design)
     foreach ($this->_config as $key => $value) {
         $data = $this->getData($key);
         if ($data) {
             $this->_config[$key] = $data;
             //if has template input from call line. This only use for old theme.
             if ($key == 'template') {
                 $this->setTemplate($data);
             }
         }
     }
     if ($this->_config['catsid']) {
         // This for old theme
         $this->_config['category_ids'] = $this->_config['catsid'];
     }
     if ($this->_config["ajaxloadmore"]) {
         $this->_config["accordionslider"] = 0;
     }
     if ($this->_config["accordionslider"]) {
         $this->_config["ajaxloadmore"] = 0;
     }
     //get product collection
     $collection = $this->getProductCollection();
     $tmpl = $this->getTemplate();
     if ($tmpl == "joomlart/jmproducts/list.phtml" || $tmpl == 'joomlart/jmproducts/viewall.phtml') {
         $toolbar = $this->getToolbarBlock();
         // 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->addPagerLimit("grid", $this->_config['qtyperpage']);
         $toolbar->addPagerLimit("list", $this->_config['qtyperpage']);
         // set collection to toolbar and apply sort
         if (is_object($collection)) {
             $toolbar->setCollection($collection);
             $this->setChild('toolbar', $toolbar);
             Mage::dispatchEvent('catalog_block_product_list_collection', array('collection' => $collection));
         }
     }
     return parent::_beforeToHtml();
 }
 protected function _beforeToHtml()
 {
     parent::_beforeToHtml();
     $this->getCollection()->setPageSize($this->getPs())->setCurPage(1);
     return $this;
 }
Exemple #28
0
 /**
  * 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 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();
     Mage::getModel('review/review')->appendSummary($this->_getProductCollection());
     return parent::_beforeToHtml();
 }
Exemple #29
0
 /**
  * Need use as _prepareLayout - but problem in declaring collection from
  * another block (was problem with search result)
  */
 protected function _beforeToHtml()
 {
     $toolbar = $this->getToolbarBlock();
     $collection = $this->getListProducts();
     // 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->addPagerLimit("grid", $this->_config['qtyperpage']);
     $toolbar->addPagerLimit("list", $this->_config['qtyperpage']);
     // set collection to toolbar and apply sort
     if (is_object($collection) && !empty($collection)) {
         $toolbar->setCollection($collection);
         $this->setChild('toolbar', $toolbar);
         Mage::dispatchEvent('catalog_block_product_list_collection', array('collection' => $this->getListProducts()));
     }
     return parent::_beforeToHtml();
 }
 /**
  * Prepare collection with new products
  *
  * @return Mage_Core_Block_Abstract
  */
 protected function _beforeToHtml()
 {
     $this->setProductCollection($this->_getProductCollection());
     return parent::_beforeToHtml();
 }