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
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
It'd be great if you could update it for version 1.5.6.mark4013 wrote:My solution as a VQMod.. (only a few lines of code)
http://www.opencart.com/index.php?route ... n_id=11707
Another module that is needed is the ability to have a dropdown selector by filter group. I'd buy it!
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
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
Opencart specialist | Our website | Our modules
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.
Opencart specialist | Our website | Our modules
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?
I am not sure if you have considered this but a drop down will only allow one selection each time.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.
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;
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.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).
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?
This is a fix for the unnecessary step.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
withCode: Select all
$query = $this->db->query("SELECT filter_id FROM " . DB_PREFIX . "category_filter WHERE category_id = '" . (int)$category_id . "'");
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.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'");
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.
robertiulianstoica[at]gmail.com
Awesome, I must have missed this! Thank you.robertiulianstoica wrote:This is a fix for the unnecessary step.
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).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.
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!
Last edited by storm-cloud on Sun Sep 22, 2013 10:21 am, edited 1 time in total.
@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
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
Hi storm-cloud,storm-cloud wrote:I am not sure if you have considered this but a drop down will only allow one selection each time.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.
As an alternative, in your stylesheet find:
Code: Select all
ul.box-filter > li ul {
Here you can add: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.Code: Select all
max-height: 150px; /*This can be any height you prefer*/ overflow: auto;
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?
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
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
Robert, have you made any progress with this? This sounds to be exactly what I am looking for!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.
I did two things: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
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'].',';
}
}
}
Code: Select all
$filter_groups = $this->model_catalog_category->getCategoryFilters($category_id);
Code: Select all
'name' => $filter['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($data) . ')' : '')
for:
'name' => $filter['name']
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.
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!
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!
this mod by Mark Williams does the trick
http://www.opencart.com/index.php?route ... _license=0
http://www.opencart.com/index.php?route ... _license=0
Who is online
Users browsing this forum: No registered users and 45 guests