當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Mage_Catalog_Model_Resource_Product_Collection::setOrder方法代碼示例

本文整理匯總了PHP中Mage_Catalog_Model_Resource_Product_Collection::setOrder方法的典型用法代碼示例。如果您正苦於以下問題:PHP Mage_Catalog_Model_Resource_Product_Collection::setOrder方法的具體用法?PHP Mage_Catalog_Model_Resource_Product_Collection::setOrder怎麽用?PHP Mage_Catalog_Model_Resource_Product_Collection::setOrder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mage_Catalog_Model_Resource_Product_Collection的用法示例。


在下文中一共展示了Mage_Catalog_Model_Resource_Product_Collection::setOrder方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testSetOrder

 /**
  * @dataProvider setOrderDataProvider
  */
 public function testSetOrder($order, $expectedOrder)
 {
     $this->_collection->setOrder($order);
     $this->_collection->load();
     // perform real SQL query
     $selectOrder = $this->_collection->getSelect()->getPart(Zend_Db_Select::ORDER);
     foreach ($expectedOrder as $field) {
         $orderBy = array_shift($selectOrder);
         $this->assertArrayHasKey(0, $orderBy);
         $this->assertTrue(false !== strpos($orderBy[0], $field), 'Ordering by same column more than once is restricted by multiple RDBMS requirements.');
     }
 }
開發者ID:natxetee,項目名稱:magento2,代碼行數:15,代碼來源:CollectionTest.php

示例2: setOrder

 /**
  * Set Order field
  *
  * @param string $attribute
  * @param string $dir
  * @return Mage_CatalogSearch_Model_Resource_Fulltext_Collection
  */
 public function setOrder($attribute, $dir = 'desc')
 {
     if ($attribute == 'relevance') {
         //$this->getSelect()->order("relevance {$dir}");
     } else {
         parent::setOrder($attribute, $dir);
     }
     return $this;
 }
開發者ID:axovel,項目名稱:easycarcare,代碼行數:16,代碼來源:Collection.php

示例3: setOrder

 /**
  * Add sorting
  *
  * @param string $attribute
  * @param string $dir
  * @return Mage_Reports_Model_Resource_Product_Downloads_Collection
  */
 public function setOrder($attribute, $dir = self::SORT_ORDER_DESC)
 {
     if ($attribute == 'purchases' || $attribute == 'downloads' || $attribute == 'link_title') {
         $this->getSelect()->order($attribute . ' ' . $dir);
     } else {
         parent::setOrder($attribute, $dir);
     }
     return $this;
 }
開發者ID:par-orillonsoft,項目名稱:magento_work,代碼行數:16,代碼來源:Collection.php

示例4: setOrder

 /**
  * Set Order field
  *
  * @param string $attribute
  * @param string $dir
  * @return Mage_CatalogSearch_Model_Resource_Fulltext_Collection
  */
 public function setOrder($attribute, $dir = 'desc')
 {
     if (!$this->checkSearchaniseResult()) {
         return parent::setOrder($attribute, $dir);
     }
     if ($attribute == 'relevance') {
         $product_ids = $this->getSearchaniseRequest()->getProductIdsString();
         if (!empty($product_ids)) {
             $this->getSelect()->order("FIELD (e.entity_id, {$product_ids}) {$dir}");
         }
     } else {
         parent::setOrder($attribute, $dir);
     }
     return $this;
 }
開發者ID:xiaoguizhidao,項目名稱:ecommerce,代碼行數:22,代碼來源:Collection.php

示例5: setOrder

 /**
  * Set order to attribute
  *
  * @param string $attribute
  * @param string $dir
  * @return Mage_Review_Model_Resource_Review_Product_Collection
  */
 public function setOrder($attribute, $dir = 'DESC')
 {
     switch ($attribute) {
         case 'rt.review_id':
         case 'rt.created_at':
         case 'rt.status_id':
         case 'rdt.title':
         case 'rdt.nickname':
         case 'rdt.detail':
             $this->getSelect()->order($attribute . ' ' . $dir);
             break;
         case 'stores':
             // No way to sort
             break;
         case 'type':
             $this->getSelect()->order('rdt.customer_id ' . $dir);
             break;
         default:
             parent::setOrder($attribute, $dir);
     }
     return $this;
 }
開發者ID:buttasg,項目名稱:cowgirlk,代碼行數:29,代碼來源:Collection.php

示例6: setOrder

 /**
  * Set order
  *
  * @param string $attribute
  * @param string $dir
  * @return Mage_Reports_Model_Resource_Product_Collection
  */
 public function setOrder($attribute, $dir = self::SORT_ORDER_DESC)
 {
     if (in_array($attribute, array('carts', 'orders', 'ordered_qty'))) {
         $this->getSelect()->order($attribute . ' ' . $dir);
     } else {
         parent::setOrder($attribute, $dir);
     }
     return $this;
 }
開發者ID:shebin512,項目名稱:Magento_Zoff,代碼行數:16,代碼來源:Collection.php

示例7: setOrder

 /**
  * Set sorting order
  *
  * $attribute can also be an array of attributes
  *
  * @param string|array $attribute
  * @param string $dir
  * @return Mage_Catalog_Model_Resource_Product_Link_Product_Collection
  */
 public function setOrder($attribute, $dir = self::SORT_ORDER_ASC)
 {
     if ($attribute == 'position') {
         return $this->setPositionOrder($dir);
     } elseif ($attribute == 'attribute_set_id') {
         return $this->setAttributeSetIdOrder($dir);
     }
     return parent::setOrder($attribute, $dir);
 }
開發者ID:barneydesmond,項目名稱:propitious-octo-tribble,代碼行數:18,代碼來源:Collection.php

示例8: setOrder

 /**
  * Set attribute order
  *
  * @param string $attribute
  * @param string $dir
  * @return Mage_Tag_Model_Resource_Product_Collection
  */
 public function setOrder($attribute, $dir = 'desc')
 {
     if ($attribute == 'popularity') {
         $this->getSelect()->order($attribute . ' ' . $dir);
     } else {
         parent::setOrder($attribute, $dir);
     }
     return $this;
 }
開發者ID:cnglobal-sl,項目名稱:caterez,代碼行數:16,代碼來源:Collection.php

示例9: setOrder

 /**
  * Set Order field
  *
  * @param string $attribute
  * @param string $dir
  * @return Mage_Catalog_Model_Resource_Product_Collection
  */
 public function setOrder($attribute, $dir = parent::SORT_ORDER_ASC)
 {
     //         $helper=Mage::helper('autocompleteplus_autosuggest');
     //         $enabledFulltext = $helper->getConfigDataByFullPath('autocompleteplus/config/enabled_fulltext');
     if ($this->is_fulltext_enabled && $attribute == 'relevance') {
         $dir = parent::SORT_ORDER_ASC;
         $id_str = count($this->list_ids) > 0 ? implode(',', $this->list_ids) : '0';
         if (!empty($id_str)) {
             $sort = "FIELD(e.entity_id, {$id_str}) {$dir}";
             $this->getSelect()->order(new Zend_Db_Expr($sort));
         }
     } else {
         return parent::setOrder($attribute, $dir);
     }
     return $this;
 }
開發者ID:xiaoguizhidao,項目名稱:mydigibits,代碼行數:23,代碼來源:Collection.php

示例10: setOrderParent

 /**
  * Set Order field
  *
  * @param string $attribute
  * @param string $dir
  * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
  */
 public function setOrderParent($attribute, $dir = 'desc')
 {
     return parent::setOrder($attribute, $dir);
 }
開發者ID:kozinthetdbp,項目名稱:shopmyar,代碼行數:11,代碼來源:Collection.php


注:本文中的Mage_Catalog_Model_Resource_Product_Collection::setOrder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。