Post by aqibboy2 » Wed Feb 05, 2014 3:04 am

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

Newbie

Posts

Joined
Sun Jun 03, 2012 8:05 am

Post by Qphoria » Fri Feb 07, 2014 9:11 pm

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);

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by aqibboy2 » Sun Feb 09, 2014 4:16 am

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.

Newbie

Posts

Joined
Sun Jun 03, 2012 8:05 am

Post by aqibboy2 » Sun Feb 09, 2014 4:39 am

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.

Newbie

Posts

Joined
Sun Jun 03, 2012 8:05 am
Who is online

Users browsing this forum: No registered users and 47 guests