Page 1 of 1

How to add product in Featured module as descending

Posted: Wed Feb 05, 2014 3:04 am
by aqibboy2
As title mention in featured module if we add product it go at the end but i want to be in opposite way.whenever i add product it should get 1st position instead of last.Please help

Thanks
Aqib

Re: How to add product in Featured module as descending

Posted: Fri Feb 07, 2014 9:11 pm
by Qphoria
aqibboy2 wrote:As title mention in featured module if we add product it go at the end but i want to be in opposite way.whenever i add product it should get 1st position instead of last.Please help

Thanks
Aqib
1. EDIT: catalog/controller/module/featured.php

2. FIND:

Code: Select all

protected function index($setting) {
3. BEFORE, ADD:

Code: Select all

	private function array_sort_by_column(&$arr, $col, $dir = SORT_ASC) {
	    $sort_col = array();
	    foreach ($arr as $key=> $row) {
	        $sort_col[$key] = $row[$col];
	    }

	    array_multisort($sort_col, $dir, $arr);
	}
4. FIND:

Code: Select all

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/featured.tpl')) {
5. BEFORE, ADD:

Code: Select all

$this->array_sort_by_column($this->data['products'], 'product_id', SORT_DESC);

Re: How to add product in Featured module as descending

Posted: Sun Feb 09, 2014 4:16 am
by aqibboy2
Qphoria wrote:
1. EDIT: catalog/controller/module/featured.php

2. FIND:

Code: Select all

protected function index($setting) {
3. BEFORE, ADD:

Code: Select all

	private function array_sort_by_column(&$arr, $col, $dir = SORT_ASC) {
	    $sort_col = array();
	    foreach ($arr as $key=> $row) {
	        $sort_col[$key] = $row[$col];
	    }

	    array_multisort($sort_col, $dir, $arr);
	}
4. FIND:

Code: Select all

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/featured.tpl')) {
5. BEFORE, ADD:

Code: Select all

$this->array_sort_by_column($this->data['products'], 'product_id', SORT_DESC);
Thank You very much for your time and effort i really appreciate it...unfortunately this code not seems to work accurate. i have try in different way that is delete my old products in featured module and add fresh product when i add second product its work fine but when add more product then it will work as random.

Re: How to add product in Featured module as descending

Posted: Sun Feb 09, 2014 4:39 am
by aqibboy2
here is my website http://partworntyreleicester.co.uk/ on the main page i have featured module name as best deal of the day.

when i go in featured module and add new product that product go live randomly.