• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Mage_Catalog_Block_Product_List类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: getAddToCartUrl

 public function getAddToCartUrl($product, $additional = array())
 {
     if (!isset($additional['_query'])) {
         $additional['_query'] = array();
     }
     $additional['_query']['flycart_item'] = $product->getId();
     return parent::getAddToCartUrl($product, $additional);
 }
开发者ID:chaudhary4k4,项目名称:supershopmagento,代码行数:8,代码来源:List.php


示例17: __construct

 public function __construct()
 {
     parent::__construct();
     $this->addPriceBlockType('bundle', 'bundle/catalog_product_price', 'bundle/catalog/product/price.phtml');
     $this->addPriceBlockType('giftcard', 'enterprise_giftcard/catalog_product_price', 'giftcard/catalog/product/price.phtml');
     $this->addPriceBlockType('msrp', 'catalog/product_price', 'catalog/product/price_msrp.phtml');
     $this->addPriceBlockType('msrp_item', 'catalog/product_price', 'catalog/product/price_msrp_item.phtml');
     $this->addPriceBlockType('msrp_noform', 'catalog/product_price', 'catalog/product/price_msrp_noform.phtml');
 }
开发者ID:EagleSH,项目名称:besttoy,代码行数:9,代码来源:View.php


示例18: _prepareLayout

 protected function _prepareLayout()
 {
     $title = $this->getConfig("brandnav_title");
     if (!$title) {
         $title = $this->__("All Brands");
     }
     $this->getLayout()->getBlock('head')->setTitle($title);
     return parent::_prepareLayout();
 }
开发者ID:quanghuynt93,项目名称:VesSmartshop,代码行数:9,代码来源:List.php


示例19: __construct

 public function __construct()
 {
     parent::__construct();
     if (Mage::helper('adjnav')->isModuleEnabled('Aitoc_Aitproductslists')) {
         $this->setTemplate('aitcommonfiles/design--frontend--base--default--template--catalog--product--list.phtml');
     } else {
         $this->setTemplate('catalog/product/list.phtml');
     }
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:9,代码来源:FrontCatalogProductList.php


示例20: __construct

 public function __construct()
 {
     parent::__construct();
     $now = date("Y-m-d 00:00:00");
     $collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*')->addAttributeToSelect('special_to_date')->addAttributeToFilter('status', 1)->addAttributeToFilter('visibility', array('neq' => 1))->addAttributeToFilter('special_price', array('neq' => ''))->addAttributeToFilter(array(array('attribute' => 'special_to_date', 'date' => true, 'gteq' => $now), array('attribute' => 'special_to_date', 'is' => new Zend_Db_Expr('null'))), '', 'left')->addAttributeToFilter(array(array('attribute' => 'special_from_date', 'date' => true, 'lteq' => $now), array('attribute' => 'special_from_date', 'is' => new Zend_Db_Expr('null'))), '', 'left');
     if ($limit = (int) Mage::getStoreConfig('onsale/configuration/limit')) {
         $collection->getSelect()->limit($limit);
     }
     $this->_collection = $collection;
 }
开发者ID:jokusafet,项目名称:MagentoSource,代码行数:10,代码来源:Onsale.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Mage_Catalog_Model_Abstract类代码示例发布时间:2022-05-23
下一篇:
PHP Mage_Catalog_Block_Product_Abstract类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap