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

Not sure if I posted this before
vqmod, from code by robertiulianstoica, to get filters directly from the products without having to put them in the categories
Either just the selected category or that category and its sub-cats. Comment out as appropriate

Attachments


User avatar
New member

Posts

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

Post by lpotts » Thu Oct 31, 2013 4:17 am

I've set-up filters on our categories, and also added a couple of the minor modules (OR to AND), and also the products to categories... Which seem to work correctly, the filters show up correctly.. But when I actually use the filters... Nothing. The page returns all the products that we're there in the first place, and the filters disappear, the heading changes from the category heading to the number of products in that category... Any help would be greatly appreciated.

Best Regards,

Luke

New member

Posts

Joined
Wed Jan 09, 2013 2:06 am

Post by robertiulianstoica » Mon Nov 04, 2013 9:11 pm

olimax wrote:Not sure if I posted this before
vqmod, from code by robertiulianstoica, to get filters directly from the products without having to put them in the categories
Either just the selected category or that category and its sub-cats. Comment out as appropriate
Good job!

robertiulianstoica[at]gmail.com


New member

Posts

Joined
Tue May 07, 2013 8:42 pm

Post by opennito » Sat Nov 09, 2013 8:22 pm

Is it possible to show and the number of products, next to the filters? (for example Red(5), Brown (6) etc) Does anybody have done this before?? ???

Newbie

Posts

Joined
Thu Feb 28, 2013 8:00 pm

Post by ihmsupport » Wed Nov 13, 2013 9:52 pm

If you want to search more than 1 filter replace

Code: Select all

location = '<?php echo $action; ?>&filter=' + filter.join(' and ');
with:

Code: Select all

location = '<?php echo $action; ?>&filter=' + filter.join('&filter=');
This will allow you to filter products on multiple filter, were as before the and only allowed you to filter multiple options within the same filter

Newbie

Posts

Joined
Thu Nov 07, 2013 11:49 pm

Post by cuculetea » Sun Nov 17, 2013 7:08 pm

Hello guys,

Nice work with create logic "or" if they are from same group and "and" if they are on diferent groups.
I don`t know who create "filters" on opencart but he done almost a good job. The way they are now they show products and this is good. What is very rong is to have products and now showing because of a filter logic or a mistake.

But ,like always i say, don`t try to change the system . Try to adapt to system. So many of the customers use excel on job. They will expect to work like on there. I belive this is the way they should work(at least on my country online shopping have filters that use logic from excel). I belive this should be by default. About the ideea to use filter from attribute on 5 min (if you know something about php and mysql) can be done.


I modify my controller to work almost like on excel. Why almost?
I create a logic where look for first filter id selected by customer from group and keep all other filter from that group. In rest of groups to have just filter that have products from first filter id(if any)

I also in testing with this and i don`t know if can be improved or not.
You cannot use this modification (i think - i still have to investigate) with robertiulianstoica modification
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

This are my modification , if any have a better ideea or adivice will be very nice


The module is already modified to use "or" between same group and "and" between different groups


<?php
class ControllerModuleFilter extends Controller {
protected function index($setting) {
if (isset($this->request->get['path'])) {
$parts = explode('_', (string)$this->request->get['path']);
} else {
$parts = array();
}

$category_id = end($parts);

$this->load->model('catalog/category');

$category_info = $this->model_catalog_category->getCategory($category_id);

if ($category_info) {
$this->language->load('module/filter');

$this->data['heading_title'] = $this->language->get('heading_title');

$this->data['button_filter'] = $this->language->get('button_filter');

$url = '';

if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}

if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request->get['order'];
}

if (isset($this->request->get['limit'])) {
$url .= '&limit=' . $this->request->get['limit'];
}

$this->data['action'] = str_replace('&', '&', $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url));

if (isset($this->request->get['filter'])) {
$this->data['filter_category'] = explode(',', $this->request->get['filter']);
} else {
$this->data['filter_category'] = array();
}

$this->load->model('catalog/product');

$this->data['filter_groups'] = array();

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

if (!empty($this->data['filter_category'][0])) {
$first_group = $this->db->query("SELECT f.filter_group_id FROM filter f LEFT JOIN filter_group fg ON (f.filter_group_id = fg.filter_group_id) WHERE f.filter_id='". $this->data['filter_category'][0] . "'");


//$products = $this->db->query("SELECT DISTINCT(pf.product_id) FROM product_filter as pf left join category_filter cf on (cf.category_id=". $category_id .") where cf.filter_id=pf.filter_id and pf.filter_id IN (" . implode(',', $this->data['filter_category']) . ") ");
$products = $this->db->query("SELECT DISTINCT(product_id) FROM product_filter where filter_id IN (" . implode(',', $this->data['filter_category']) . ") ");
$implode1 = array();
foreach ($products->rows as $pr) {
$implode1[] = (int)$pr['product_id'];
}
$products1 = $this->db->query("SELECT DISTINCT(product_id) FROM product_to_category where product_id IN (" . implode(',', $implode1) . ") and category_id='" . $category_id . "'");
$implode2 = array();
foreach ($products1->rows as $pr1) {
$implode2[] = (int)$pr1['product_id'];
}

}



if ($filter_groups) {
foreach ($filter_groups as $filter_group) {
$filter_data = array();

foreach ($filter_group['filter'] as $filter) {
if (!empty($this->data['filter_category'][0])) {
if ($first_group->row['filter_group_id'] == $filter_group['filter_group_id']) {
$data = array(
'filter_category_id' => $category_id,
'filter_filter' => $filter['filter_id']
);

$filter_data[] = array(
'filter_id' => $filter['filter_id'],
'name' => $filter['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($data) . ')' : '')
);
} else {

$products_count = $this->db->query("SELECT DISTINCT(product_id) FROM product_filter
where filter_id='" . $filter['filter_id'] . "' and product_id IN (" . implode(',', $implode2) . ")");
if ($products_count->num_rows > 0) {
$data = array(
'filter_category_id' => $category_id,
'filter_filter' => $filter['filter_id']
);
$filter_data[] = array(
'filter_id' => $filter['filter_id'],
'name' => $filter['name'] . ($this->config->get('config_product_count') ? ' (' . $products_count->num_rows . ')' : '')
);

}
}
} else {
$data = array(
'filter_category_id' => $category_id,
'filter_filter' => $filter['filter_id']
);

$filter_data[] = array(
'filter_id' => $filter['filter_id'],
'name' => $filter['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($data) . ')' : '')
);
}
}
$this->data['filter_groups'][] = array(
'filter_group_id' => $filter_group['filter_group_id'],
'name' => $filter_group['name'],
'filter' => $filter_data
);
}

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/filter.tpl')) {
$this->template = $this->config->get('config_template') . '/template/module/filter.tpl';
} else {
$this->template = 'default/template/module/filter.tpl';
}

$this->render();
}
}
}
}
?>
I know i add more query to db and this is not good, i will try to make it better.......if i can
P.S. sorry for my poor english. If any one is confused please tell me and i will try to remake

New member

Posts

Joined
Wed Feb 15, 2012 10:02 pm

Post by cuculetea » Sun Nov 17, 2013 7:47 pm

And.... is not working very well because when i make multiple selection the filter_id change order of ids :-[

New member

Posts

Joined
Wed Feb 15, 2012 10:02 pm

Post by opennito » Tue Nov 26, 2013 5:31 pm

Im facing really big problem, and seems to be a bug here, when i apply a filter all seems to work correct, but if a change page, for example on page two the filter doesnt work and show all the products from the category, has anybody else facing that issue?

Newbie

Posts

Joined
Thu Feb 28, 2013 8:00 pm

Post by zmarcin80 » Mon Jan 06, 2014 8:56 pm

Hi.

I went through all topic and I am well confused. Can somebody write what to exactly do to fix it, please?

Thanks

Newbie

Posts

Joined
Mon Jan 06, 2014 8:54 pm

Post by olimax » Tue Jan 07, 2014 2:46 am

Download the VQmod I posted earlier
Install that then go to Catalog/Filters and add a set
add FIlters to some products
Install a Filter Module somewhere and it should self populate

User avatar
New member

Posts

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

Post by pakho » Fri Feb 07, 2014 11:31 am

ihmsupport wrote:If you want to search more than 1 filter replace

Code: Select all

location = '<?php echo $action; ?>&filter=' + filter.join(' and ');
with:

Code: Select all

location = '<?php echo $action; ?>&filter=' + filter.join('&filter=');
This will allow you to filter products on multiple filter, were as before the and only allowed you to filter multiple options within the same filter
It work fine exept for one thing, when i "check" 2 items from different group and i clic on refine search, the checbox from my fist group isnt checked anymore, only the checbock on the second group is cheked.

I would like to keep all the checkboxes which the user has checked when he clics on refine search so he can know what kind of product he is seeing.

Newbie

Posts

Joined
Wed Jan 08, 2014 11:04 am

Post by brright » Thu Feb 20, 2014 1:00 pm

Help please. Filters are not showing. :( I've tried every sorting, uninstalling other modules. I don't know what else to do.

Newbie

Posts

Joined
Fri Nov 01, 2013 10:23 pm

Post by brright » Thu Feb 20, 2014 6:43 pm

brright wrote:Help please. Filters are not showing. :( I've tried every sorting, uninstalling other modules. I don't know what else to do.
I already solve this problem, now the filter module is showing twice. :(

Newbie

Posts

Joined
Fri Nov 01, 2013 10:23 pm

Post by Horhecart » Thu Mar 13, 2014 7:00 pm

HI, will this also work on OC 1.5.6.1?

Newbie

Posts

Joined
Sat Dec 29, 2012 5:03 am

Post by Spiritcraft » Sat Mar 15, 2014 5:53 am

olimax wrote:Not sure if I posted this before
vqmod, from code by robertiulianstoica, to get filters directly from the products without having to put them in the categories
Either just the selected category or that category and its sub-cats. Comment out as appropriate
What exactly does this do? I need some filters help if anyone is available. I have lists of keywords gathered that could be used with a database query to assign filters. I had a developer do this in one category of 3K products and it worked. He has since moved on to a 9-5 job and need someone else to help me mass populate my filters. Any interest out there?

Newbie

Posts

Joined
Sun Jun 23, 2013 12:30 pm

Post by ocaddons » Fri Apr 04, 2014 12:54 pm

Hi,

I have implement a module([VQMOD]Advanced products filters module[Include Price Range] ) to enhance the default filter module.

Store Front:

Image

Admin Panel:

Image

It maybe useful for your store. Please have a look at it > http://forum.opencart.com/viewtopic.php?f=123&t=120386

Image
Image

EMail: support@ocaddons.com


User avatar
New member

Posts

Joined
Fri Dec 27, 2013 10:21 am


Post by storm-cloud » Sun Apr 06, 2014 7:08 am

I was just wondering if anyone has discovered a way to add a disabled attribute to filters which are unusable within other groups?

For example, a customer applies a filter and then the page reloads with the applicable products. The issue here is that all the filters are still visible. It would greatly improve the user experience if there was an indicator for the unusable filters.

Edit: I have come close to working this out by applying an if statement around the code that loads the filters (<?php if ($product_total <= 0) { ?>). The only issue I have is after applying the modification suggested earlier in this thread to change the filter logic from "or" to "and", this is not updating the product count accordingly. If I can find a way to update the product count after the filter has been applied then I am confident this can work.

For reference, this is the code that changes the logic from "or" to "and": http://forum.opencart.com/viewtopic.php ... 20#p401453. If anyone knows of a way to also update the product count within the filter module accordingly, that would be greatly appreciated!

Active Member

Posts

Joined
Wed Feb 22, 2012 8:07 am

Post by storm-cloud » Sun Apr 06, 2014 8:49 am

olimax wrote:this mod by Mark Williams does the trick
http://www.opencart.com/index.php?route ... n_id=11707
As noted above, the issue here is that this modification does not update the filter product count. If applying "and" logic, it is counter intuitive to display a product count which is not updated according to the applied filter.

Active Member

Posts

Joined
Wed Feb 22, 2012 8:07 am

Post by drest341 » Tue Apr 15, 2014 5:01 pm

Ganisek wrote:OK.. it seem that im done :)
its only one file changes
catalog\model\catalog -> and replce product.php

I hope that this is it. :)

THIS is repair of price_filter archive pack!
Hi Ganisek. I tryed to implement the filter by replacement the product.php and works perfect in v.1.5.6, but when i click on the product to see details, a white screen comes out. Is it only for v.1.5.5??

Thanks

Any fool can write code that a computer can understand. Good programmers write code that humans can understand ~ Martin Fowler.


User avatar
New member

Posts

Joined
Fri Feb 21, 2014 10:47 pm

Post by labeshops » Fri Apr 25, 2014 8:36 pm

Hey guys

I updated from 1.5.2.2 to 1.5.6.4 (which was actually a fresh install of 1.5.6.4 with tables imported) and followed all the usual steps to use filters, but the filter module will NOT display on page. It makes the column left show http://www.cosplaycostumecloset.com/hal ... n-costumes but nothing shows in the column! I'm using the default template. I've seen a few mentions of this in this thread, but no one posted how they fixed it.

I have filter groups set up, added them to the category and added them to 1 of the products in that category. Installed the filter module and applied it to my layout for the category page. Also tried both the vqmods in this thread to add the filters to categories automatically too and the one to fix the logic of the filter (AND/OR), but the stupid filter box itself is not showing.

Running Opencart v2.2 with multi-stores from http://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA
Who is online

Users browsing this forum: No registered users and 7 guests