예제 #1
0
 /**
  * Set Order field
  *
  * @param string $attribute
  * @param string $dir
  * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
  */
 public function setOrder($attribute, $dir = 'desc')
 {
     if ($attribute == 'relevance') {
         $this->getSelect()->order("relevance {$dir}");
     } else {
         parent::setOrder($attribute, $dir);
     }
     return $this;
 }
예제 #2
0
 /**
  * Add sorting
  *
  * @return Mage_Reports_Model_Mysql4_Product_Downloads_Collection
  */
 public function setOrder($attribute, $dir = 'desc')
 {
     if ($attribute == 'purchases' || $attribute == 'downloads' || $attribute == 'link_title') {
         $this->getSelect()->order($attribute . ' ' . $dir);
     } else {
         parent::setOrder($attribute, $dir);
     }
     return $this;
 }
예제 #3
0
 /**
  * add sort to result collection
  * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
  * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection
  */
 protected function _addSortToCollection(Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection)
 {
     $orderBy = Mage::app()->getRequest()->getParam('order', null);
     $orderDir = Mage::app()->getRequest()->getParam('dir', null);
     if (is_null($orderBy)) {
         return $collection;
     }
     if (is_null($orderDir)) {
         $orderDir = $collection::SORT_ORDER_DESC;
     } elseif ($orderDir == 'desc') {
         $orderDir = $collection::SORT_ORDER_DESC;
     } elseif ($orderDir == 'asc') {
         $orderDir = $collection::SORT_ORDER_ASC;
     }
     $collection->setOrder($orderBy, $orderDir);
     return $collection;
 }
예제 #4
0
 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;
 }
예제 #5
0
 public function setOrder($attribute, $dir = 'desc')
 {
     switch ($attribute) {
         case 'carts':
         case 'orders':
         case 'ordered_qty':
             $this->getSelect()->order($attribute . ' ' . $dir);
             break;
         default:
             parent::setOrder($attribute, $dir);
     }
     return $this;
 }
 public function setOrder($attribute, $dir = 'desc')
 {
     if ($attribute == 'popularity') {
         $this->getSelect()->order($attribute . ' ' . $dir);
     } else {
         parent::setOrder($attribute, $dir);
     }
     return $this;
 }
예제 #7
0
 /**
  * Set Order field
  *
  * @param string $attribute
  * @param string $dir
  * @return Mage_CatalogSearch_Model_Mysql4_Fulltext_Collection
  */
 public function setOrder($attribute, $dir = 'desc')
 {
     $helper = Mage::helper('autocompleteplus_autosuggest');
     $enabledFulltext = $helper->getConfigDataByFullPath('autocompleteplus/config/enabled_fulltext');
     if ($enabledFulltext) {
     } else {
         if ($attribute == 'relevance') {
             $this->getSelect()->order("relevance {$dir}");
         } else {
             parent::setOrder($attribute, $dir);
         }
     }
     return $this;
 }