Post by CaptainHaddock » Thu Aug 01, 2013 8:20 am

I worked out how to get parent category filters to show products from subcategories.
I've written a free and simple extension with Vqmod.
Tested on 1.5.5.1
Hope that's helpful.
See:
http://www.opencart.com/index.php?route ... n_id=13066

New member

Posts

Joined
Tue Jul 02, 2013 7:01 am


Post by bonocarmiol » Wed Aug 14, 2013 6:45 am

Hi, It is posible to put a price filter in home page? I need one module there.

Newbie

Posts

Joined
Tue Apr 23, 2013 5:45 am

Post by lenl » Wed Aug 21, 2013 1:30 am

mark4013 wrote:My solution as a VQMod.. (only a few lines of code)

http://www.opencart.com/index.php?route ... n_id=11707
It'd be great if you could update it for version 1.5.6.
Another module that is needed is the ability to have a dropdown selector by filter group. I'd buy it!

Newbie

Posts

Joined
Sun Jun 03, 2012 1:00 am

Post by burrito » Thu Aug 29, 2013 4:10 pm

so I'm still trying to get the AND AND version working (AND all the filters selected in 1 group AND all filters selected in the next group)

Example:

filter_group: resolution
filter: FullHD
filter: HD

filter_group: Storage
filter: 1GB
filter: 2GB

anything selected should limit the selection to include the filter

Image
Opencart specialist | Our website | Our modules


User avatar
Active Member

Posts

Joined
Tue Dec 15, 2009 6:10 pm
Location - Amsterdam, The Netherlands

Post by burrito » Thu Aug 29, 2013 4:19 pm

hmmm thinking about it... would be maybe even better if you could select at the filter_group page whether it's an "AND" or an "OR" group... if that makes sense... gives more flexibility for the users.

Image
Opencart specialist | Our website | Our modules


User avatar
Active Member

Posts

Joined
Tue Dec 15, 2009 6:10 pm
Location - Amsterdam, The Netherlands

Post by Spiritcraft » Thu Sep 05, 2013 10:49 pm

Is anyone doing any work in terms of associating filters to products faster than one product page at a time? I have filters set up in some small categories and they are amazing. The issue seems to be getting them assigned to products in categories with 1,000 products or more. This would be a daunting task, one product page at a time. Does anyone have any ideas on how something could be done to speed the process up?

Newbie

Posts

Joined
Sun Jun 23, 2013 12:30 pm

Post by OnNets » Sun Sep 08, 2013 4:11 pm

Is there a way to make the filter module dropdown instead of checkbox.
I have color filter with 20++ color and it fill all my left column not to mention I have other filter too.

Thanks

New member

Posts

Joined
Wed Jan 06, 2010 5:53 pm

Post by storm-cloud » Sun Sep 15, 2013 2:34 am

OnNets wrote:Is there a way to make the filter module dropdown instead of checkbox.
I have color filter with 20++ color and it fill all my left column not to mention I have other filter too.
I am not sure if you have considered this but a drop down will only allow one selection each time.

As an alternative, in your stylesheet find:

Code: Select all

ul.box-filter > li ul {

Here you can add:

Code: Select all

max-height: 150px; /*This can be any height you prefer*/
overflow: auto;
This will show scrollbars for each group of filters that exceed the set height. This should help to keep the module size reasonable. However, some mobile browsers will not show the scrollbars.

Active Member

Posts

Joined
Wed Feb 22, 2012 8:07 am

Post by storm-cloud » Sun Sep 15, 2013 2:41 am

rph wrote:2. Go to Catalog > Categories and Edit a category. Under the Data tab add the filters you want to be able to apply to that category (e.g. Color > Blue, Color > Red).
Perhaps I have missed something but I don't understand this extra step. Sure this allows for additional control but personally I feel this just makes the filter setup take so much longer.

If I create a filter, apply the filter to a product and then enable the filter module, surely this is enough. If a product resides in a category and has a filter applied, the relative filter should automatically be assigned to the category.

I can't actually think of a scenario where someone might apply a filter to a product but did not want that filter associated to a category. Have I overlooked a possible reason for this extra step?

Active Member

Posts

Joined
Wed Feb 22, 2012 8:07 am

Post by robertiulianstoica » Wed Sep 18, 2013 9:39 pm

robertiulianstoica wrote:For all of you who are interested in getting the category filters from the products loaded in the category, not from the table category_filter you must go to catalog/model/catalog/category.php and modify the function "getCategoryFilters" by replacing

Code: Select all

$query = $this->db->query("SELECT filter_id FROM " . DB_PREFIX . "category_filter WHERE category_id = '" . (int)$category_id . "'");
with

Code: Select all

$query = $this->db->query("SELECT pf.filter_id FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p.product_id = pf.product_id) WHERE p2c.category_id = '" . (int)$category_id . "' AND p.status='1'");
DONE! Now your filters will load in every category depending on the products contained. You no longer need to insert filters into categories, neither will they apear if there are no products returned by the filter.

Ps: if anyone is interested, i will later provide a code to select filters depending on the filtered products loaded in the category.

Cheers!

EDIT 1: I forgot the posibility of a db prefix. Updated.
EDIT 2: Shows only the filters from the active products.
This is a fix for the unnecessary step.

robertiulianstoica[at]gmail.com


New member

Posts

Joined
Tue May 07, 2013 8:42 pm

Post by storm-cloud » Sat Sep 21, 2013 7:51 pm

robertiulianstoica wrote:This is a fix for the unnecessary step.
Awesome, I must have missed this! Thank you. :)
robertiulianstoica wrote:Ps: if anyone is interested, i will later provide a code to select filters depending on the filtered products loaded in the category.
Does this mean that you were working towards the exact thing that has also been in my mind... That is, once a filter is applied, that the visible filters should only be those that apply to the current filtered results (filters that are no longer applicable will be hidden).

Example:
Product 1 - "Filter Group 1: Filter 1" and "Filter Group 2: Filter 2"
Product 2 - "Filter Group 2: Filter 2"
Product 3 - "Filter Group 1: Filter 3"
Product 4 - "Filter Group 2: Filter 4"

If you apply Filter 2, then Products 1 and 2 should be visible and Products 3 and 4 would be hidden...

In the Filter Module, "Filter Group 1: Filter 1", "Filter Group 2: Filter 2" and "Filter Group 2: Filter 4" should remain visible but "Filter Group 1: Filter 3" should be hidden (as this belongs in a group that is not selected and the returned results are no longer applicable).

I hope I haven't made this too confusing but personally I would prefer this to only work across filter groups.

I have already modified the logic between filter groups to be "and" instead of "or" as I feel this is far more intuitive, as per the steps in this post: http://forum.opencart.com/viewtopic.php ... 20#p401453.

Leaving all available filters visible in the current applicable group(s) would allow the visitor to add filters to the current selection which would broaden the results. However, hiding filters in other groups which are no longer applicable will enhance the visitors experience as they will not be confused by selecting filters in another group which don't even apply to the current product list.

If you have found a solution to this, I would DEFINITELY be interested! ;D
Last edited by storm-cloud on Sun Sep 22, 2013 10:21 am, edited 1 time in total.

Active Member

Posts

Joined
Wed Feb 22, 2012 8:07 am

Post by Spiritcraft » Sat Sep 21, 2013 9:14 pm

@robert

Are you talking about code that would allow groups of filters to be associated with certain categories?

Any thoughts on any way to mass associate filters to products?

Thank you

Newbie

Posts

Joined
Sun Jun 23, 2013 12:30 pm

Post by OnNets » Mon Sep 23, 2013 12:52 pm

storm-cloud wrote:
OnNets wrote:Is there a way to make the filter module dropdown instead of checkbox.
I have color filter with 20++ color and it fill all my left column not to mention I have other filter too.
I am not sure if you have considered this but a drop down will only allow one selection each time.

As an alternative, in your stylesheet find:

Code: Select all

ul.box-filter > li ul {

Here you can add:

Code: Select all

max-height: 150px; /*This can be any height you prefer*/
overflow: auto;
This will show scrollbars for each group of filters that exceed the set height. This should help to keep the module size reasonable. However, some mobile browsers will not show the scrollbars.
Hi storm-cloud,
Thanks, this works and it make more sense. Drop-down can't be use here because of the multiple option.

Now that I want to display the module on "Content Top"

What code should I put to make it horizontally?

New member

Posts

Joined
Wed Jan 06, 2010 5:53 pm

Post by sbproduction » Sun Oct 06, 2013 2:47 am

Hey Hopefully i havent missed this but if i have then please point me in the right direction.

I have tried changing certain files but has not worked.
I am looking for a fix for the filter module in opencart 1.5.6

I need to be able to filter by a few choice i.e. i wanted size 15 shoes (click on the size filter) and then want them in a red (click on the colour filter)

Right now it filters by just the first choice.

For my site see.
http://www.skatetheunit.com/headset

Thanks

New member

Posts

Joined
Mon Sep 05, 2011 5:29 am

Post by storm-cloud » Thu Oct 10, 2013 9:10 pm

robertiulianstoica wrote:Ps: if anyone is interested, i will later provide a code to select filters depending on the filtered products loaded in the category.
Robert, have you made any progress with this? This sounds to be exactly what I am looking for! ;D

Active Member

Posts

Joined
Wed Feb 22, 2012 8:07 am

Post by JohnnyNM » Mon Oct 14, 2013 7:18 am

CaptainHaddock wrote: Hi,
I also have all sub category products showing in parent category by using this extension
http://tinyurl.com/products-in-subcat-in-parent
The problem is the products from subcategories do not show in the parent's filters.
Is this the same as your problem John? Did you find a solution?

E.g. Parent Category "Animals" has subcategories "Dogs" and "Cats". I have set up Animals and Cats and Dogs with filters for colors. If I am in subcategory dog, I can use filter to see only black dogs.
I would like to be able to use filter at parent category level to show all black dogs and black cats.

Did you work out how to make this happen?

Thanks very much
Peter
I did two things:

Show to filters for three levels down:
catalog/controller/module/filter.php
After '$category_id = end($parts);' add...

Code: Select all

$id_list = $category_id.',';

$results = $this->model_catalog_category->getCategories($category_id);

foreach ($results as $result) {
	$id_list .= $result['category_id'].',';
	$sub_results = $this->model_catalog_category->getCategories($result['category_id']);

	foreach ($sub_results as $sub_result) {
		$id_list .= $sub_result['category_id'].',';
		$sub2_results = $this->model_catalog_category->getCategories($sub_result['category_id']);
		
		foreach ($sub2_results as $sub2_result) {
			$id_list .= $sub2_result['category_id'].',';
		}
	}
}
Replace $category_id for $list_id on this line:

Code: Select all

$filter_groups = $this->model_catalog_category->getCategoryFilters($category_id);
Change this line:

Code: Select all

'name'      => $filter['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($data) . ')' : '')

for:

'name'      => $filter['name']
Include sub categories in parent:
catalog/controller/product/category.php

Code: Select all

Add this...

'filter_sub_category' => true,

after...

'filter_category_id' => $category_id,

Hope that's of use to someone.

I've also figured why the filters tend to confuse me.
By default they're un-ticked but show all search results, then if you tick one, you end up excluding everything else and working upwards from the bottom. If they were all ticked when you start searching then you could exclude them as necessary, which makes more sense to me. The only thing that would conflict somewhat are the products without ANY filters, but you could fix this by giving each product an 'Unclassified' filter value, or even working it into the code.

J.

Newbie

Posts

Joined
Fri Dec 09, 2011 8:18 pm

Post by rjainbwr » Sat Oct 19, 2013 11:45 am

i add a filter for size like
1-5
6-10
11-15
but if i search filer 6-10 then result perfectly and when i also use price Low-High then show all sizes means now filter not work..
how to solve this problem ?

Newbie

Posts

Joined
Mon Oct 14, 2013 9:45 pm

Post by SnekY » Wed Oct 23, 2013 5:59 pm

Hi Guys,

I am still new to Opencart and currently running Opencart 1.5.6. I am currently having trouble with the filter options as discussed before. What would be the best solution to solve this matter for 1.5.6?

Newbie

Posts

Joined
Sun Oct 20, 2013 8:44 pm

Post by C3PH@5 » Tue Oct 29, 2013 12:22 am

After reading through all of the posts, and trying the various fixes, I'm left confused, and without a solution. :(

All I want to do is to filter off of multiple filters. IE: Red AND Large, Not Red OR Large.

What modules do I need? What version of the products.php do I need? Do I need to retain the line of code in filter.tpl that changes the comma out for 'and'? For someone starting this journey from scratch, what is the solution?

Thanks for your help, it is GREATLY appreciated!

Newbie

Posts

Joined
Thu Sep 12, 2013 3:08 am

Post by olimax » Tue Oct 29, 2013 12:31 am

this mod by Mark Williams does the trick
http://www.opencart.com/index.php?route ... _license=0

User avatar
New member

Posts

Joined
Thu Dec 22, 2011 5:08 pm
Location - Barcelona & London
Who is online

Users browsing this forum: No registered users and 42 guests