当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Catalog_Block_Product_Abstract::_beforeToHtml方法代码示例

本文整理汇总了PHP中Mage_Catalog_Block_Product_Abstract::_beforeToHtml方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Catalog_Block_Product_Abstract::_beforeToHtml方法的具体用法?PHP Mage_Catalog_Block_Product_Abstract::_beforeToHtml怎么用?PHP Mage_Catalog_Block_Product_Abstract::_beforeToHtml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Catalog_Block_Product_Abstract的用法示例。


在下文中一共展示了Mage_Catalog_Block_Product_Abstract::_beforeToHtml方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _beforeToHtml

 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();
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Product_New.php

示例2: _beforeToHtml

 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();
 }
开发者ID:dragontheme1235,项目名称:project-1,代码行数:33,代码来源:Widget.php

示例3: _beforeToHtml

 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();
 }
开发者ID:santhosh400,项目名称:ecart,代码行数:25,代码来源:Ourcollection.php

示例4: _beforeToHtml

 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();
 }
开发者ID:adityaj221,项目名称:magento,代码行数:26,代码来源:List.php

示例5: _beforeToHtml

 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();
 }
开发者ID:xiaoguizhidao,项目名称:devfashion,代码行数:8,代码来源:Latest.php

示例6: _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();
 }
开发者ID:praxigento,项目名称:mage_app_prxgt_store,代码行数:8,代码来源:List.php

示例7: _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();
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:13,代码来源:List.php

示例8: _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($this->getProductsCount())->setCurPage(1);
     $this->setProductCollection($collection);
     return parent::_beforeToHtml();
 }
开发者ID:nandodrw,项目名称:zapatos,代码行数:14,代码来源:Special.php

示例9: _beforeToHtml

 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();
 }
开发者ID:kk12837,项目名称:sweetbaby,代码行数:10,代码来源:Popular.php

示例10: _beforeToHtml

 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();
 }
开发者ID:nilshopsahl,项目名称:hasla.local,代码行数:11,代码来源:Listing.php

示例11: _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();
 }
开发者ID:par-orillonsoft,项目名称:bookstore,代码行数:17,代码来源:Featured.php

示例12: _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()->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();
 }
开发者ID:kk12837,项目名称:sweetbaby,代码行数:13,代码来源:Topsell.php

示例13: _beforeToHtml

 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();
 }
开发者ID:santhosh400,项目名称:ecart,代码行数:14,代码来源:New+-+Copy.php

示例14: _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();
 }
开发者ID:xiaoguizhidao,项目名称:storebaby.it,代码行数:19,代码来源:Special.php

示例15: _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();
 }
开发者ID:sumanyaligar,项目名称:MyMagento--07-10-2015,代码行数:15,代码来源:Category.php


注:本文中的Mage_Catalog_Block_Product_Abstract::_beforeToHtml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。