Post by prototype0104 » Sat Nov 23, 2019 5:03 am

Hi guys! I'm using OC 3.0.3.2 with journal 3. I'm trying to sort products in category pages by quantity but I have some issues.
Changed p.sort_order (default sort) to p.quantity in category.php but category page is not loading products sorted by quantity, it's loading sorted A-Z.. If I'm changing to A-Z sort and back to Default products are sorted by quantity ..Any ideas? I tried to modify in model/journal3/product/filter.php but no result.

Active Member

Posts

Joined
Sun Mar 24, 2019 6:08 pm
Location - Romania

Post by Johnathan » Sat Nov 23, 2019 10:39 pm

If you're using Journal 3, and they modify the search code, you'll need to ask the Journal team how to do this. The normal file for loading products is this one:

/catalog/model/catalog/product.php

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by letxobnav » Sat Nov 23, 2019 11:16 pm

in addition to changing the "default" link, you also need to change the default setting for when no sort is present in the GET variables:

controller catalog.php

Code: Select all

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

Code: Select all

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

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
Expert Member

Posts

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

Post by prototype0104 » Mon Nov 25, 2019 5:05 pm

Thank you!
But not working .. :-\

In catalog.php:

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';
		}

Code: Select all

$data['sorts'][] = array(
			'text'  => $this->language->get('text_default'),
			'value' => 'p.quantity-DESC',
			'href'  => $this->url->link('product/catalog', '&sort=p.quantity&order=DESC' . $url),
		);
In category.php:

Code: Select all

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

Active Member

Posts

Joined
Sun Mar 24, 2019 6:08 pm
Location - Romania

Post by paulfeakins » Mon Nov 25, 2019 8:13 pm

prototype0104 wrote:
Mon Nov 25, 2019 5:05 pm
But not working .. :-\
As Johnathan said, if you use Journal, the search will not be using the normal file.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by prototype0104 » Mon Nov 25, 2019 8:52 pm

Any ideas where to find the code?

Active Member

Posts

Joined
Sun Mar 24, 2019 6:08 pm
Location - Romania

Post by cygors » Fri Sep 18, 2020 1:13 am

Hi,
Opencart in Journal > Skins > Edit > Product Listing > Sort Bar > Product Sort

Newbie

Posts

Joined
Sat Aug 05, 2017 6:21 am

Post by weedecs » Fri Mar 04, 2022 2:19 pm

cygors wrote:
Fri Sep 18, 2020 1:13 am
Hi,
Opencart in Journal > Skins > Edit > Product Listing > Sort Bar > Product Sort
Hello,
There is no quantity option at that setting!!!

Only default, date, name, price, rate, model... but not quantity.

Is there any way to do it on Journal?

Web Design: http://www.websanati.com
Personel Blog: http://www.alperheper.com


User avatar
Newbie

Posts

Joined
Sat Feb 11, 2012 6:58 pm

Post by straightlight » Sat Mar 05, 2022 12:49 am

weedecs wrote:
Fri Mar 04, 2022 2:19 pm
cygors wrote:
Fri Sep 18, 2020 1:13 am
Hi,
Opencart in Journal > Skins > Edit > Product Listing > Sort Bar > Product Sort
Hello,
There is no quantity option at that setting!!!

Only default, date, name, price, rate, model... but not quantity.

Is there any way to do it on Journal?
Journal is not supported on the forum.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 12 guests