Jump to content

product sort by price lowest to highest.


Recommended Posts

Hi,

I have my specials product (pricesdrop or tmspecials, the products with 'specific price') listed on the main page of my webstore.

 

I want to have these special products to sort by price, lowest to highest.

 

I understand I have change the code 'orderBy' and 'orderWay' to sort by price and make it "asc (ascending)" in the controller but not quite exactly sure how to do this.

 

Can someone please advice me through?

 

Thanks!

 

Regards,

Jeong

 

 

this is the code from my PricesDropController.php

 

class PricesDropControllerCore extends FrontController
{
public $php_self = 'prices-drop.php';
 
public function setMedia()
{
parent::setMedia();
Tools::addCSS(_THEME_CSS_DIR_.'product_list.css');
}
 
public function process()
{
parent::process();
 
$this->productSort();
$nbProducts = Product::getPricesDrop((int)(self::$cookie->id_lang), NULL, NULL, true);
$this->pagination($nbProducts);
 
self::$smarty->assign(array(
'products' => Product::getPricesDrop((int)(self::$cookie->id_lang), (int)($this->p) - 1, (int)($this->n), false, $this->orderBy, $this->orderWay),
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
'nbProducts' => $nbProducts,
'homeSize' => Image::getSize('home')
));
}
 
public function displayContent()
{
parent::displayContent();
self::$smarty->display(_PS_THEME_DIR_.'prices-drop.tpl');
}
}
Edited by jeong (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...