Post by nbrofree » Thu Mar 04, 2021 12:41 am

I want the product/special page to have a category filter via url. Ex: index.php?route=product/special&cid=1234

So, I try to edit the file 'catalog / controller / product / special.php' on the filter_data array to be like:

Code: Select all

//todo other checks here
$cid= (int)$this->request->get['cid'];
$filter_data = array(
	'filter_category_id'  => $cid, //1234
	'filter_sub_category' => false,
	'sort'  => $sort,
...
I get the category id from the database but it always returns all specials.

I tried instead of 'filter_category_id' to use 'category', 'category_id' and others with no result. Also tried to set 'filter_sub_category' => true. I confirmed that I can see changes in the page by manually changing the limit.
If possible please provide me with the getProductSpecials() documentation or something similar because I couldn't find anything in the official page.

I have to say before anyone else does: yes, I always cleared cache between tries and yes, I will create an appropriate vQmod with appropriate checks when I successfully deal with this.

Newbie

Posts

Joined
Thu Mar 04, 2021 12:23 am

Post by paulfeakins » Thu Mar 04, 2021 7:07 pm

Looks like you're along the right lines ...

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


User avatar
Guru Member
Online

Posts

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

Post by DigitCart » Thu Mar 04, 2021 7:22 pm

Hi

The special page uses the `getProductSpecials` method not `getProducts`.
By default `getProducts` accepts `filter_category_id` but `getProductSpecials` does not accept it.

Take a look at this file:

Code: Select all

catalog\model\catalog\product.php

My Extensions


User avatar
Active Member

Posts

Joined
Thu Jun 22, 2017 5:32 pm


Post by nbrofree » Fri Mar 05, 2021 9:04 am

paulfeakins wrote:
Thu Mar 04, 2021 7:07 pm
Looks like you're along the right lines ...
I feel a bit more comfortable hearing this... but still... I cant get this to work :/

Newbie

Posts

Joined
Thu Mar 04, 2021 12:23 am

Post by nbrofree » Fri Mar 05, 2021 9:20 am

DigitCart wrote:
Thu Mar 04, 2021 7:22 pm
Hi

The special page uses the `getProductSpecials` method not `getProducts`.
By default `getProducts` accepts `filter_category_id` but `getProductSpecials` does not accept it.

Take a look at this file:

Code: Select all

catalog\model\catalog\product.php
So, just to check if I am correct... I have to get the function getProductSpecials() get the data = array() with the category id ($cid) have a bunch of checks and include the category filtering in the sql query for the system to run and return... right... right?! :-X

Newbie

Posts

Joined
Thu Mar 04, 2021 12:23 am
Who is online

Users browsing this forum: No registered users and 96 guests