Post by venacava » Thu Sep 12, 2019 4:59 am

hi, products sorting by date_added in catalog default but I want to sort it by model
can you help please :)

New member

Posts

Joined
Mon Sep 02, 2019 1:42 am

Post by by mona » Thu Sep 12, 2019 8:23 am

catalog/controller/product/category.php
and anywhere else you want to change it

this line

Code: Select all

$data['sorts'][] = array(
				'text'  => $this->language->get('text_default'),
				'value' => 'p.sort_order-ASC',
				'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url)
			);
to this line

Code: Select all

$data['sorts'][] = array(
				'text'  => $this->language->get('text_default'),
				'value' => 'p.model-ASC',
				'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url)
			);
or DESC not ASC

Active Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by letxobnav » Thu Sep 12, 2019 10:48 am

you are forgetting:

Code: Select all

		if (isset($this->request->get['sort'])) {
			$sort = $this->request->get['sort'];
		} else {
			$sort = 'p.sort_order';
		}

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Active Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by by mona » Thu Sep 12, 2019 1:48 pm

letxobnav wrote:
Thu Sep 12, 2019 10:48 am
you are forgetting:
indeed I did - thank you kind sir

Active Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by venacava » Thu Sep 12, 2019 3:33 pm

thanks fot your replies.. so which one should I use :)

New member

Posts

Joined
Mon Sep 02, 2019 1:42 am

Post by by mona » Thu Sep 12, 2019 8:58 pm

both !

Active Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by venacava » Fri Sep 13, 2019 12:47 am

Yeah it works :) Thank you so much :)

New member

Posts

Joined
Mon Sep 02, 2019 1:42 am

Post by glolar » Thu Oct 10, 2019 5:18 am

I need to do something similar. When there are products in the cart, I need them to be sorted by model, not by date_added, as they are now. Where would I change this in the code? For the life of me, I cannot find it.

Thanks in advance!

Increase Your Child's I.Q.
iPad Wallpapers
Turtle & Tortoise Screen Savers


User avatar
Active Member

Posts

Joined
Thu Jul 29, 2010 12:35 pm
Location - San Diego, CA
Who is online

Users browsing this forum: No registered users and 28 guests