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


PHP Mage_Core_Model_Mysql4_Collection_Abstract::setOrder方法代码示例

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


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

示例1: setCollection

 /**
  * Set collection to pager
  *
  * @param Varien_Data_Collection $collection
  * @return Mage_Catalog_Block_Product_List_Toolbar
  */
 public function setCollection($collection)
 {
     $this->_collection = $collection;
     $this->_collection->setCurPage($this->getCurrentPage());
     // we need to set pagination only if passed value integer and more that 0
     $limit = (int) $this->getLimit();
     if ($limit) {
         $this->_collection->setPageSize($limit);
     }
     if ($this->getCurrentOrder() && $this->getRequest()->getParam('order')) {
         if ($this->getCurrentOrder() == 'new' && Mage::registry('current_category')) {
             $this->_collection->setOrder('entity_id', 'desc');
         } else {
             if ($this->getCurrentOrder() == 'popular' && Mage::registry('current_category')) {
                 $this->getCollection()->getSelect()->joinLeft(array('sfoi' => $collection->getResource()->getTable('sales/order_item')), 'e.entity_id = sfoi.product_id', array('qty_ordered' => 'SUM(sfoi.qty_ordered)'))->group('e.entity_id')->order('qty_ordered ' . $this->getCurrentDirection());
             } else {
                 if ($this->getCurrentOrder() == 'price' && Mage::registry('current_category')) {
                     $this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
                 } else {
                     $this->_collection->setOrder('position', 'asc');
                 }
             }
         }
     } else {
         if (Mage::registry('current_category')) {
             $this->_collection->setOrder('position', 'asc');
         }
     }
     return $this;
 }
开发者ID:sshegde123,项目名称:wmp8,代码行数:36,代码来源:Toolbar.php

示例2: setCollection

 /**
  * Set collection to pager
  *
  * @param Varien_Data_Collection $collection
  * @return Mage_Catalog_Block_Product_List_Toolbar
  */
 public function setCollection($collection)
 {
     $this->_collection = $collection;
     $this->_collection->setCurPage($this->getCurrentPage());
     // we need to set pagination only if passed value integer and more that 0
     $limit = (int) $this->getLimit();
     if ($limit) {
         $this->_collection->setPageSize($limit);
     }
     if ($this->getCurrentOrder()) {
         $this->_collection->setOrder(array($this->getCurrentOrder(), 'entity_id'), $this->getCurrentDirection());
         //Ashwani Bhasin 1-29-2012 added entity id
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:21,代码来源:Toolbar.php

示例3: setCollection

 /**
  * Set collection to pager
  *
  * @param Varien_Data_Collection $collection
  * @return Mage_Catalog_Block_Product_List_Toolbar
  */
 public function setCollection($collection)
 {
     $this->_collection = $collection;
     $this->_collection->setCurPage($this->getCurrentPage());
     // we need to set pagination only if passed value integer and more that 0
     $limit = (int) $this->getLimit();
     if ($limit) {
         $this->_collection->setPageSize($limit);
     }
     //appstockus changed
     if ($this->getCurrentOrder()) {
         $this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection())->setOrder('price', 'desc');
     }
     // if($this->getCurrentOrder() == 'discount'){
     //     $this->getCollection()->getSelect()->joinLeft('catalog_product_index_price as cpd','e.entity_id = cpd.entity_id','SUM(cpd.price - cpd.final_price) AS discount')->group('e.entity_id')->order('<strong class="StrictlyAutoTagBold">discount</strong> desc');
     // } else if ($this->getCurrentOrder()) {
     //     $this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection())->setOrder('price', 'desc');
     // }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:ortodon,代码行数:26,代码来源:Toolbar.php


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