本文整理汇总了PHP中Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection::setOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection::setOrder方法的具体用法?PHP Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection::setOrder怎么用?PHP Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection::setOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection
的用法示例。
在下文中一共展示了Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection::setOrder方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setOrder
/**
* 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: setOrder
/**
* 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: _addSortToCollection
/**
* 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: setOrder
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: setOrder
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;
}
示例6: setOrder
public function setOrder($attribute, $dir = 'desc')
{
if ($attribute == 'popularity') {
$this->getSelect()->order($attribute . ' ' . $dir);
} else {
parent::setOrder($attribute, $dir);
}
return $this;
}
示例7: setOrder
/**
* 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;
}