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


PHP Mage_Catalog_Block_Product_List类代码示例

本文整理汇总了PHP中Mage_Catalog_Block_Product_List的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Catalog_Block_Product_List类的具体用法?PHP Mage_Catalog_Block_Product_List怎么用?PHP Mage_Catalog_Block_Product_List使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: collect

 /**
  * Collects list of objects in product list
  *
  * @param Mage_Catalog_Block_Product_List $object
  * @return Mage_Catalog_Model_Product[]
  */
 public function collect($object)
 {
     $result = array();
     $products = $object->getLoadedProductCollection();
     foreach ($products as $product) {
         $result[] = $product;
     }
     return $result;
 }
开发者ID:jonesio,项目名称:EcomDev_Varnish,代码行数:15,代码来源:List.php

示例2: applyProductList

 /**
  * Product list cache, needs to clear on displayed products
  *
  * @param Mage_Catalog_Block_Product_List $block
  */
 public function applyProductList(Mage_Catalog_Block_Product_List $block)
 {
     // The "messages" block is session-dependent, don't cache
     if (Mage::helper('cache')->responseHasMessages()) {
         $block->setData('cache_lifetime', null);
         return;
     }
     // Set cache tags
     $tags = array();
     $tags[] = Mage_Catalog_Model_Category::CACHE_TAG . '_' . $this->_getCategoryIdForProductList($block);
     // The toolbar needs to apply sort order etc
     $_toolbar = $block->getToolbarBlock();
     $productCollection = $block->getLoadedProductCollection();
     /**
      * @see Mage_Catalog_Block_Product_List_Toolbar::getCurrentOrder
      */
     if ($orders = $block->getAvailableOrders()) {
         $_toolbar->setAvailableOrders($orders);
     }
     if ($sort = $block->getSortBy()) {
         $_toolbar->setDefaultOrder($sort);
     }
     if ($dir = $block->getDefaultDirection()) {
         $_toolbar->setDefaultDirection($dir);
     }
     if ($modes = $block->getModes()) {
         $_toolbar->setModes($modes);
     }
     $_toolbar->setCollection($productCollection);
     $productIds = array();
     foreach ($productCollection as $_product) {
         $tags[] = Mage_Catalog_Model_Product::CACHE_TAG . "_" . $_product->getId();
         $productIds[] = $_product->getId();
     }
     if (!empty($productIds)) {
         $childIds = Mage::helper('cache')->getChildProductIds($productIds);
         foreach ($childIds as $childId) {
             $tags[] = Mage_Catalog_Model_Product::CACHE_TAG . '_' . $childId;
         }
     }
     $block->setData('cache_tags', $tags);
     // Set cache key
     $keys = $this->_getBasicKeys($block);
     $_taxRateRequest = Mage::getModel('tax/calculation')->getRateRequest();
     $_customer = Mage::getSingleton('customer/session')->getCustomer();
     $_categoryId = $this->_getCategoryIdForProductList($block);
     foreach (Mage::app()->getRequest()->getParams() as $key => $value) {
         $value = Mage::helper('cache')->paramValueToCacheKey($value);
         $keys[] = $key . '_' . $value;
     }
     $keys = array_merge($keys, array($_categoryId, $_toolbar->getCurrentOrder(), $_toolbar->getCurrentDirection(), $_toolbar->getCurrentMode(), $_toolbar->getCurrentPage(), $_toolbar->getLimit(), $_customer->getGroupId(), $_taxRateRequest->getCountryId(), $_taxRateRequest->getRegionId(), $_taxRateRequest->getPostcode(), $_taxRateRequest->getCustomerClassId(), Mage::registry('current_tag')));
     $block->setData('cache_key', $this->_getCacheKey($keys, $block));
 }
开发者ID:lfdesousa,项目名称:varnish-stuff,代码行数:58,代码来源:Catalog.php

示例3: __construct

 public function __construct($attributes = array())
 {
     parent::__construct($attributes);
     $selfData = $this->getData();
     // handler configuration for module config
     $configuration = $this->_getConfiguration();
     if (count($configuration)) {
         foreach ($configuration as $field => $value) {
             //if (!array_key_exists($field, $selfData)){
             $selfData[$field] = $value;
             //}
         }
     }
     //Zend_Debug::dump($attributes);die;
     // handler attributes for {{block ...}} in cms page
     if (count($attributes)) {
         foreach ($attributes as $field => $value) {
             //if (!array_key_exists($field, $selfData)){
             $selfData[$field] = $value;
             //}
         }
     }
     // re-save data
     $this->setData($selfData);
 }
开发者ID:Aerotexextintores,项目名称:novosite,代码行数:25,代码来源:Home2.php

示例4: _getProductCollection

 /**
  * Retrieve loaded category collection
  *
  * @return Mage_Eav_Model_Entity_Collection_Abstract
  */
 protected function _getProductCollection()
 {
     if (is_null($this->_prodCollection)) {
         $collection = parent::_getProductCollection();
         /*Get customer "status" attribute options*/
         $_approvedStatusId = Mage::getStoreConfig('marketplace/status/approved');
         if ($_approvedStatusId) {
             $_customerData = Mage::getModel('customer/customer')->getCollection()->addFieldToFilter('status', $_approvedStatusId)->load();
             $where = 'ce.value IS NULL';
             $_sellerIds = array();
             /*Get array of seller ids with stats approved*/
             foreach ($_customerData as $_data) {
                 $_sellerIds[] = $_data['entity_id'];
             }
             if ($_sellerIds) {
                 $where .= " OR ce.value in (" . implode(',', $_sellerIds) . ")";
             }
             $resource = Mage::getSingleton('core/resource');
             $tableName = $resource->getTableName('catalog_product_entity_int');
             $collection->getSelect()->joinLeft($tableName . ' As ce', 'ce.entity_id=e.entity_id AND ce.attribute_id=' . Mage::helper('marketplace')->getProductSellerAttributeId(), null);
             $collection->getSelect()->where($where);
         }
         $this->_prodCollection = $collection;
     }
     return $this->_prodCollection;
 }
开发者ID:DeveshKumarThakur,项目名称:cosmetics,代码行数:31,代码来源:List.php

示例5: _prepareLayout

 public function _prepareLayout()
 {
     parent::_prepareLayout();
     /*$pager = $this->getLayout()->createBlock('page/html_pager', 'custom.pager');
       //$pager->setAvailableLimit(array(5=>5,10=>10,20=>20,'all'=>'all'));
       $pager->setCollection($this->getCollection());
       $this->setChild('pager', $pager);
       $this->getCollection()->load();*/
     $name = 'gosf_cookie2013';
     if (Mage::getModel('core/cookie')->get($name) != 'gosf') {
         header('Location:http://www.zoffio.com/');
         exit;
     }
     $param = $this->getRequest()->getParam('id');
     if ($headBlock = $this->getLayout()->getBlock('head')) {
         if ($param == 20) {
             $headBlock->setTitle("Stationery");
             $headBlock->setDescription($gosfcategory['meta_descr']);
             $headBlock->setKeywords($gosfcategory['meta_tags']);
         }
         if ($param == 72) {
             $headBlock->setTitle("Tech & Digitals");
             $headBlock->setDescription($gosfcategory['meta_descr']);
             $headBlock->setKeywords($gosfcategory['meta_tags']);
         }
         if ($param == 126) {
             $headBlock->setTitle("Gift Items");
             $headBlock->setDescription($gosfcategory['meta_descr']);
             $headBlock->setKeywords($gosfcategory['meta_tags']);
         }
     }
     return $this;
     //return parent::_prepareLayout();
 }
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:34,代码来源:List.php

示例6: _toHtml

 /**
  * Get HTML if there's anything to show
  */
 protected function _toHtml()
 {
     if ($this->_getProductCollection()->count()) {
         return parent::_toHtml();
     }
     return '';
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:10,代码来源:List.php

示例7: _construct

 protected function _construct()
 {
     parent::_construct();
     // set defaults
     $this->setSortBy('relevance');
     $this->setDefaultDirection('desc');
 }
开发者ID:elderxavier,项目名称:sphinxsearch,代码行数:7,代码来源:List.php

示例8: _getProductCollection

 public function _getProductCollection()
 {
     if ($this->getSkuList()) {
         $collection = Mage::getModel('catalog/product')->getCollection();
         $layer = $this->getLayer();
         $layer->prepareProductCollection($collection);
     } else {
         $collection = parent::_getProductCollection();
     }
     if ($this->getLimit()) {
         $collection->setPageSize($this->getLimit());
     }
     if ($this->getSortBy()) {
         $collection->setOrder($this->getSortBy(), $this->getSortByDirection());
     }
     if ($this->getSkuList()) {
         $select = $collection->getSelect();
         $separator = $this->getSeparator();
         if (empty($separator)) {
             $separator = ',';
         }
         $skus = explode($separator, $this->getSkuList());
         if (count($skus)) {
             $select->where('e.sku IN (?)', $skus);
             $escapedSkus = array();
             foreach ($skus as $sku) {
                 $escapedSkus[] = $collection->getConnection()->quote($sku);
             }
             $select->order(new Zend_Db_Expr('FIELD(e.sku, ' . join(',', $escapedSkus) . ')'));
         } else {
             $select->where('SKU IS NULL');
         }
     }
     return $collection;
 }
开发者ID:EliasKotlyar,项目名称:EasyTemplate,代码行数:35,代码来源:List.php

示例9: testPrepareSortableFieldsByCategory

 public function testPrepareSortableFieldsByCategory()
 {
     $category = new Mage_Catalog_Model_Category();
     $category->setDefaultSortBy('name');
     $this->_block->prepareSortableFieldsByCategory($category);
     $this->assertEquals('name', $this->_block->getSortBy());
 }
开发者ID:relue,项目名称:magento2,代码行数:7,代码来源:ListTest.php

示例10: _preparePriceRenderer

 public function _preparePriceRenderer($productType)
 {
     if (Mage::getStoreConfig('settings/settings/enable') == 1) {
         return $this->_getPriceBlock($productType)->setTemplate('quickview/catalog/product/price.phtml')->setUseLinkForAsLowAs($this->_useLinkForAsLowAs);
     } else {
         return parent::_preparePriceRenderer($productType);
     }
 }
开发者ID:helirexi,项目名称:product_quickview,代码行数:8,代码来源:List.php

示例11:

	function _toHtml() 
	{			
		if(!$this->_config['show']) return;	
		$this->__renderSlideShowImages();
		$this->assign('configs', $this->_config);			
		$this->setTemplate($this->_config['template']);	
        return parent::_toHtml();	
	}
开发者ID:ravi2jdesign,项目名称:magentoOLD,代码行数:8,代码来源:List.php

示例12: _prepareLayout

 /**
  * @return $this
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
     $breadcrumbs->addCrumb('home', array('label' => Mage::helper('cms')->__('Home'), 'title' => Mage::helper('cms')->__('Home Page'), 'link' => Mage::getBaseUrl()));
     $breadcrumbs->addCrumb('brandname', array('label' => $this->_brandname, 'title' => $this->_brandname));
     return $this;
 }
开发者ID:aliuosio,项目名称:dev-hh-brands,代码行数:11,代码来源:Products.php

示例13: testPrepareSortableFieldsByCategory

 public function testPrepareSortableFieldsByCategory()
 {
     /** @var $category Mage_Catalog_Model_Category */
     $category = Mage::getModel('Mage_Catalog_Model_Category');
     $category->setDefaultSortBy('name');
     $this->_block->prepareSortableFieldsByCategory($category);
     $this->assertEquals('name', $this->_block->getSortBy());
 }
开发者ID:natxetee,项目名称:magento2,代码行数:8,代码来源:ListTest.php

示例14: getPriceHtml

 public function getPriceHtml($product, $displayMinimalPrice = false, $idSuffix = '')
 {
     $html = parent::getPriceHtml($product, $displayMinimalPrice, $idSuffix);
     if (Mage::getStoreConfig('amconf/list/enable_list') == 1 && $product->isSaleable() && $product->isConfigurable()) {
         $html .= Mage::helper('amconf')->getHtmlBlock($product, '');
     }
     return $html;
 }
开发者ID:xiaoguizhidao,项目名称:Magento-Sandbox-Install,代码行数:8,代码来源:List.php

示例15: _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:shashankkanungo,项目名称:magento,代码行数:8,代码来源:SM_Vendors_Block_Catalog_Product_List.php


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