Post by 4bco » Thu Oct 13, 2011 12:34 am

I would like to change the code for the default sort order so that it displays the items with the most in stock first. Any ideas?
Last edited by 4bco on Thu Oct 13, 2011 8:12 am, edited 1 time in total.

Custom Website Design from BCO ~ Building Companies Online
If we were of assistance to you, please help my family in return with a small donation.


New member

Posts

Joined
Wed Jun 29, 2011 11:40 pm

Post by uksitebuilder » Thu Oct 13, 2011 3:43 am

open: catalog/controller/product/category.php

find:

Code: Select all

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

		if (isset($this->request->get['order'])) {
			$order = $this->request->get['order'];
		} else {
			$order = 'ASC';
		}
change to

Code: Select all

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

		if (isset($this->request->get['order'])) {
			$order = $this->request->get['order'];
		} else {
			$order = 'DESC';
		}
		
You may also want to do the same for

catalog/controler/product/manufacturer.php
catalog/controler/product/search.php
catalog/controler/product/special.php

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by 4bco » Thu Oct 13, 2011 5:08 am

Thanks I will give it a try.....

Could you tell me how to change the code if they want it to sort by name first A-Z....They are having trouble making up their mind as to which way they want it ;)

Thanks for you help!

Custom Website Design from BCO ~ Building Companies Online
If we were of assistance to you, please help my family in return with a small donation.


New member

Posts

Joined
Wed Jun 29, 2011 11:40 pm

Post by uksitebuilder » Thu Oct 13, 2011 5:13 am

find

Code: Select all

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

Code: Select all

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

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by 4bco » Thu Oct 13, 2011 8:12 am

Thank you....worked like a charm....

Sending a donation your way!

Custom Website Design from BCO ~ Building Companies Online
If we were of assistance to you, please help my family in return with a small donation.


New member

Posts

Joined
Wed Jun 29, 2011 11:40 pm

Post by 4bco » Thu Oct 13, 2011 8:21 am

ps...It would be great if you could help me with this topic too....

http://forum.opencart.com/viewtopic.php?f=21&t=41766

Custom Website Design from BCO ~ Building Companies Online
If we were of assistance to you, please help my family in return with a small donation.


New member

Posts

Joined
Wed Jun 29, 2011 11:40 pm

Post by davidbfranks » Sun May 31, 2015 11:10 pm

Any idea how to do this on OC2?

Active Member

Posts

Joined
Mon Mar 04, 2013 10:31 pm
Location - London
Who is online

Users browsing this forum: No registered users and 8 guests