Zen Cart Logo
Forums / Addon Sideboxes / Dynamic Filter [Support Thread]

Dynamic Filter [Support Thread]

Views: 652,533

Results 521 to 540 of 809
11 Dec 2014, 6:48 AM
#521
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Dynamic Filter [Support Thread]

bumba000:

Okay. Running 1.5.1. I get "WARNING: An Error occurred, please refresh the page and try again."
and in logs I get
1054:Unknown column 'm.manufacturers_name' in 'field list' :: SELECT DISTINCT pd.products_name, p.products_image, pd.products_short_desc, m.manufacturers_name, p.products_model, p.products_quantity, p.products_id, p.products_type, p.master_categories_id,
p.manufacturers_id, p.products_price, p.products_tax_class_id, pd.products_description, IF(s.status = 1,
s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status =1, s.specials_new_products_price,
p.products_price) as final_price, p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping,
p.products_qty_box_status FROM products p LEFT JOIN specials s on p.products_id = s.products_id LEFT JOIN products_description pd on p.products_id = pd.products_id JOIN products_to_categories p2c on p.products_id = p2c.products_id WHERE p.products_status = 1
and pd.language_id = '1'
and p2c.categories_id = '684' GROUP BY p.products_id order by p.products_sort_order, pd.products_name in /home/public_html/includes/classes/db/mysql/query_factory.php on line 120
On a strictly technical level, the reason it's saying "unknown column m.manufacturers_name" is because you don't have any reference to the manufacturers table in the query, let alone the name. So, whatever you're doing to trigger the error is because the code is either missing mention of manufacturers or you've got some switch related to manufacturer data turned off for whatever page you're trying to display and the addon author didn't account for that possibility.
Maybe go back to the admin settings for the page where you're seeing that and turn on manufacturer info?

11 Dec 2014, 8:07 AM
#522
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Dynamic Filter [Support Thread]

DrByte:

From my quick review, I'm pretty certain that the v1.5.3 version of the functions_general.php file already incorporates the changes that this plugin was attempting to do. So, from now on the functions_general.php file should be excluded from this plugin, and the official ZC version of the file should be used.

And other than that, I think that the rest of the v1.5.1 files for this plugin are probably fine since the affected "core files" were not changed between 151 and 153.
So, to use it on 153, use the plugin's 151 set of files EXCEPT keep the original ZC v153 version of functions_general.php

That said, I'm making these comments simply based on a very quick look at code, and not from doing any tests on a live site.

You are right Dr, I had come to that conclusion also.

The new version will be ready this weekend, Just finishing up the readme and final testing.

11 Dec 2014, 12:58 PM
#523
jimmie avatar

jimmie

Totally Zenned

Join Date:
Jan 2013
Location:
New Port Richey, Florida
Posts:
969
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

installed on v1.51. The sql out of the box did not work. used modified one from the thread. how do i sort by price, Pretty much the only option i want, option does not show on any page?
Most options are greyed out.
Also how can i remove original Filter Results by: or replace with this mod
http://floorz-n-more.com/

11 Dec 2014, 4:39 PM
#524
bumba000 avatar

bumba000

Totally Zenned

Join Date:
Feb 2007
Location:
Pennsylvania
Posts:
856
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Well I haven't been stumped like this in quite some time. The best I've come up with so far is to remove the index_filters/template/default_filter.php. That stops the warning and logs I've mentioned. I can't find an admin setting having to do with manufacturers that lets this work. So after removing the default_filter.php and the site loads, if the filter sidebox is enabled, it breaks the column left and any sidebox that should appear after the filter box is blown out all over the site.

I have found settings regarding manufacturer in admin>config>product_listing. I only plan to use this filter on the product listing and advanced search pages. Where else might I find settings for manufacturer that might help resolve this?

Anymore help on this would of course be greatly appreciated.

Thank You, John

11 Dec 2014, 5:03 PM
#525
bumba000 avatar

bumba000

Totally Zenned

Join Date:
Feb 2007
Location:
Pennsylvania
Posts:
856
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

So, with the index_filters/template/default_filter.php in place, the filter sidebox enabled, viewing a category with products, I get the warning and error logs. If I make a selection from the filter side box the warning goes away and I get no error logs, but the site is still broken and nothing is filtered out.

12 Dec 2014, 2:19 AM
#526
craig_freeburg avatar

craig_freeburg

New Zenner

Join Date:
Dec 2014
Location:
North Platte, NE & Fountain Valley, CA
Posts:
37
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

I've got ZC 151 installed and working correctly now. I have the filter working, but for some reason it only works when it's on pages from the categories. If I'm in the new products page, or the all products page, the filter shows up, but isn't filtering. The all products and new products pages are EZ Pages I created, so maybe that has something to do with it? Where the filter isn't thinking it's on the all products page? Any ideas? Thanks guys.

12 Dec 2014, 2:27 AM
#527
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Dynamic Filter [Support Thread]

I just happened to see in post 507 of this thread the following SQL:```
SELECT @cid:=configuration_group_id
FROM configuration_group
WHERE configuration_group_title= 'Dynamic Filter';
DELETE FROM configuration WHERE configuration_group_id = @cid;
DELETE FROM configuration_group WHERE configuration_group_id = @cid;


There is a recommended alteration to this kind of SQL for all mod authors to use, given in this sticky thread:
<http://www.zen-cart.com/showthread.php?194965-Mod-Authors-Please-read-if-you-are-creating-install-sql-files>
12 Dec 2014, 4:18 AM
#528
craig_freeburg avatar

craig_freeburg

New Zenner

Join Date:
Dec 2014
Location:
North Platte, NE &amp; Fountain Valley, CA
Posts:
37
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

I don't think I'm versed enough to actually change the sql file. Can it be explained rather easily? Or should I look for a different solution to get the filter to work on the all products page? thanks everyone

12 Dec 2014, 8:32 AM
#529
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Dynamic Filter [Support Thread]

gjh42:

I just happened to see in post 507 of this thread the following SQL:```
SELECT @cid:=configuration_group_id
FROM configuration_group
WHERE configuration_group_title= 'Dynamic Filter';
DELETE FROM configuration WHERE configuration_group_id = @cid;
DELETE FROM configuration_group WHERE configuration_group_id = @cid;

> 
> There is a recommended alteration to this kind of SQL for all mod authors to use, given in this sticky thread:
> <http://www.zen-cart.com/showthread.php?194965-Mod-Authors-Please-read-if-you-are-creating-install-sql-files>

This is taken care of in the upcoming release
13 Dec 2014, 2:14 AM
#530
craig_freeburg avatar

craig_freeburg

New Zenner

Join Date:
Dec 2014
Location:
North Platte, NE &amp; Fountain Valley, CA
Posts:
37
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Awesome. Thanks.

I'm assuming this is the only thread for this dynamic filter, so if I need to post this somewhere else, please let me know. But I had a question about the way this filter works. I know it uses attributes and I've gotten it to filter through the categories. On my site though, it will help to have options on some of the products as well. For example, being able to filter by shirt color, and once you're on the product info page, then having attributes to select the size before it's added to the cart. Is there a way to separate the 2 so only some attributes show up in dynamic filter, and some show up on the product info page?

13 Dec 2014, 8:41 AM
#531
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Dynamic Filter [Support Thread]

Craig Freeburg:

Awesome. Thanks.

I'm assuming this is the only thread for this dynamic filter, so if I need to post this somewhere else, please let me know. But I had a question about the way this filter works. I know it uses attributes and I've gotten it to filter through the categories. On my site though, it will help to have options on some of the products as well. For example, being able to filter by shirt color, and once you're on the product info page, then having attributes to select the size before it's added to the cart. Is there a way to separate the 2 so only some attributes show up in dynamic filter, and some show up on the product info page?
In the admin, there is an option to include/exclude certain attributes from the filter

18 Dec 2014, 5:22 PM
#532
landron avatar

landron

New Zenner

Join Date:
Dec 2011
Posts:
23
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

I've been running version 1.0 of this filter (with some issues as it doesn't work or look quite right) on a manually installed ver 1.51 of Zencart. Now that I see there's an upgrade, are there any specific upgrading instructions? I searched this thread with no results. Thank you

20 Dec 2014, 9:49 PM
#533
bumba000 avatar

bumba000

Totally Zenned

Join Date:
Feb 2007
Location:
Pennsylvania
Posts:
856
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

any chance a working version of this mod will be released? I can't seem to get this to work like at all. Everything about it breaks. Error logs fill up with everything from improper use of php functions to missing table names in queries. The sidebox breaks and all other sidebox contents end up all over the main page.

What a major let down.

31 Jan 2015, 8:41 PM
#534
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Dynamic Filter [Support Thread]

So still working on this mod from time to time, but lacking the time to fish it up.
But I wanted to at least show you this update.

I did by accident more or less discover how to change the number of filtered products shown between the brackets.
If you search in file includes/templates/YOUR_TEMPLATE/sideboxes/tpl_dynamic_filter.php.
and change

htmlspecialchars(html_entity_decode($attributes->fields['quantity'], ENT_QUOTES))

to

htmlspecialchars(html_entity_decode($attributes->fields['flag'], ENT_QUOTES))

the number also changes to the number of products left on which to filter.
You can see it in action here

1 Feb 2015, 10:42 AM
#535
simon1066 avatar

simon1066

Totally Zenned

Join Date:
Feb 2009
Location:
UK
Posts:
1,326
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Well done! Such a seemingly simple change for such a big effect. Thank you.

(For some reason the number of products left does not decrease on one of my attributes - it actually increases, I'll need to dig deeper on that one)

7 Feb 2015, 6:19 PM
#536
djace avatar

djace

New Zenner

Join Date:
Sep 2010
Posts:
45
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Hello, Will this dynamic filter work under ZenCart 1.5.4?
If yes, can you please provide me with a download link?
Thank you very much,
Admir M.

7 Feb 2015, 7:41 PM
#537
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Dynamic Filter [Support Thread]

It will work with 1.5.4. You can download the latest version of the module and use the file set for Zen Cart 1.5.1

except for the file includes/functions/functions_general.php. There you will need to make only 1 small change
find:

  function zen_get_all_get_params($exclude_array = array(), $search_engine_safe = true) {
    if (!is_array($exclude_array)) $exclude_array = array();
    $exclude_array = array_merge($exclude_array, array(zen_session_name(), 'main_page', 'error', 'x', 'y'));
    $get_url = '';
    if (is_array($_GET) && (sizeof($_GET) > 0)) {
      reset($_GET);
      while (list($key, $value) = each($_GET)) {
        if (!in_array($key, $exclude_array)) {
          if (!is_array($value)) {
            if (strlen($value) > 0) {
              $get_url .= zen_sanitize_string($key) . '=' . rawurlencode(stripslashes($value)) . '&';
            }
          } else {
            foreach(array_filter($value) as $arr){
              $get_url .= zen_sanitize_string($key) . '[]=' . rawurlencode(stripslashes($arr)) . '&';
            }
          }
        }
      }
    }
    while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);
    while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);

    return $get_url;
  }

and replace with

  function zen_get_all_get_params($exclude_array = array(), $search_engine_safe = true) {
    if (!is_array($exclude_array)) $exclude_array = array();
    $exclude_array = array_merge($exclude_array, array(zen_session_name(), 'main_page', 'error', 'x', 'y'));
    $get_url = '';
    if (is_array($_GET) && (sizeof($_GET) > 0)) {
      reset($_GET);
      while (list($key, $value) = each($_GET)) {
// bof dynamic filter 1 of 1
        if ( (!in_array($key, $exclude_array)) && (is_string($value) && strlen($value) > 0 || is_array($value) && array_filter($value) ) && ($key != 'main_page') && ($key != zen_session_name()) && ($key != 'error') && ($key != 'x') && ($key != 'y') ) {
// eof dynamic filter 1 of 1
          if (!is_array($value)) {
            if (strlen($value) > 0) {
              $get_url .= zen_sanitize_string($key) . '=' . rawurlencode(stripslashes($value)) . '&';
            }
          } else {
            foreach(array_filter($value) as $arr){
              $get_url .= zen_sanitize_string($key) . '[]=' . rawurlencode(stripslashes($arr)) . '&';
            }
          }
        }
      }
    }
    while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);
    while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);

    return $get_url;
  }
11 Feb 2015, 6:11 AM
#538
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Dynamic Filter [Support Thread]

Design75 ... do you mind if I challenge that?

I'm thinking that code change is redundant. Can you help me understand what I'm missing?
Note the things I've highlighted below, as I think your suggested code change is duplicating what's already in that function's logic:

  function zen_get_all_get_params($exclude_array = array(), $search_engine_safe = true) {
    if (!is_array($exclude_array)) $exclude_array = array();
    $exclude_array = array_merge($exclude_array, array(zen_session_name(), 'main_page', 'error', 'x', 'y'));
    $get_url = '';
    if (is_array($_GET) && (sizeof($_GET) > 0)) {
      reset($_GET);
      while (list($key, $value) = each($_GET)) {
// bof dynamic filter 1 of 1
        if ( (!in_array($key, $exclude_array)) && (is_string($value) && strlen($value) > 0 || is_array($value) && array_filter($value) ) && ($key != 'main_page') && ($key != zen_session_name()) && ($key != 'error') && ($key != 'x') && ($key != 'y') ) {
// eof dynamic filter 1 of 1
          if (!is_array($value)) {
            if (strlen($value) > 0) {
              $get_url .= zen_sanitize_string($key) . '=' . rawurlencode(stripslashes($value)) . '&';
            }
          } else {
            foreach(array_filter($value) as $arr){
              $get_url .= zen_sanitize_string($key) . '[]=' . rawurlencode(stripslashes($arr)) . '&';
            }
          }
        }
      }
    }
    while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);
    while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);

    return $get_url;
  }  

My point is really: if no changes are needed, then it's better not to touch the file.

11 Feb 2015, 8:36 AM
#539
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Dynamic Filter [Support Thread]

DrByte:

Design75 ... do you mind if I challenge that?

I'm thinking that code change is redundant. Can you help me understand what I'm missing?
Note the things I've highlighted below, as I think your suggested code change is duplicating what's already in that function's logic:

function zen_get_all_get_params($exclude_array = array(), $search_engine_safe = true) {
if (!is_array($exclude_array)) $exclude_array = array();
$exclude_array = array_merge($exclude_array, array(zen_session_name(), 'main_page', 'error', 'x', 'y'));
$get_url = '';
if (is_array($_GET) && (sizeof($_GET) > 0)) {
reset($_GET);
while (list($key, $value) = each($_GET)) {
// bof dynamic filter 1 of 1
if ( (!in_array($key, $exclude_array)) && (is_string($value) && strlen($value) > 0 || is_array($value) && array_filter($value) ) && ($key != 'main_page') && ($key != zen_session_name()) && ($key != 'error') && ($key != 'x') && ($key != 'y') ) {
// eof dynamic filter 1 of 1
if COLOR=#ffa500 {
if (strlen($value) > 0) [/COLOR]{
$get_url .= zen_sanitize_string($key) . '=' . rawurlencode(stripslashes($value)) . '&';
}
} else {
foreach(array_filter($value) as $arr){
$get_url .= zen_sanitize_string($key) . '[]=' . rawurlencode(stripslashes($arr)) . '&';
}
}
}
}
}
while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);
while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);

return $get_url;

}

> My point is really: if no changes are needed, then it's better not to touch the file.

I must admit I do not fully understand the code , but just compared old 1.5.1 and new 1.5.4 vanilla files end the code from the mod.
This was the line that was left after comparing, but is you say it is not needed, (and after some better reading of that code block) I agree it seems unnecessary.
I am going to test it right now, and will report back.
23 Feb 2015, 10:06 AM
#540
louis avatar

louis

Zen Follower

Join Date:
Jul 2006
Location:
Johannesburg
Posts:
408
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Eerin:

Thanks for the reply, after an extremely long day yesterday looking through all the code and undoing everything that I had worked on over the last 3 days trying to find the problem. I got onto my web host this morning and it turns out they had done a security update and turned on a new mod_security setting (341245) that was blocking this feature. They have now turned it off for me and everything is working perfectly once again. Hopefully this may help someone in the future if they experience a similar issue. The code it's self is still as bullet proof as ever. Thanks.

Thank you for pointing this out. I received a "403 page not found" error when selecting price as part of the filter. I searched high and low over the last week or so to see if I could find a solution but to no avail. After seeing this post over the weekend, I contacted my host this morning and they made some changes on their side and voila, the price filter is working again.

Power to the people that support community based projects!