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

Dynamic Filter [Support Thread]

Views: 652,521

Results 441 to 460 of 809
04 Jun 2014, 08:03
#441
panservolvo avatar

panservolvo

New Zenner

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

Dynamic Filter [Support Thread]

I found out that it happens to all products with more than 4 attributes.
Is it a limit to how many attributes the dynamic filter can handle to loop through?

04 Jun 2014, 09:48
#442
design75 avatar

design75

Totally Zenned

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

Re: Dynamic Filter [Support Thread]

panservolvo:

I found out that it happens to all products with more than 4 attributes.
Is it a limit to how many attributes the dynamic filter can handle to loop through?

There is no limit, on the number of attributes, as far as I know, but I only use this module on read only attributes.

04 Jun 2014, 09:50
#443
panservolvo avatar

panservolvo

New Zenner

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

Re: Dynamic Filter [Support Thread]

The attribute in question is a read only attribute. Everything is working fine exept filtering on attributes when there are more than 4 on the product

04 Jun 2014, 13:11
#444
panservolvo avatar

panservolvo

New Zenner

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

Re: Dynamic Filter [Support Thread]

After more digging, I've found out that its not 4 attributes thats my upper limit, its more randomly than that.
Adding/removing attribute values from a product change if the filter for that particular filter works or not.
An example. A product has 6 attributes with in total 15 attribute values. The filter on attribute "stock" does not work.
I remove one attribute value from one of the other attributes, for instance a color.
Now the filter on attribute "stock" works just fine.
It doesnt matter what attribute value I remove, so its not just one attribute or value which causes this... hmmmmmmm.....

suggestions?

04 Jun 2014, 13:15
#445
panservolvo avatar

panservolvo

New Zenner

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

Re: Dynamic Filter [Support Thread]

another "fun feature", if I delete the language english, only keeping norwegian, it works as it should.

04 Jun 2014, 14:17
#446
design75 avatar

design75

Totally Zenned

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

Re: Dynamic Filter [Support Thread]

panservolvo:

another "fun feature", if I delete the language english, only keeping norwegian, it works as it should.

A yes, I remeber I added some code for that for a customer. Let me find it, and I will post it here.

05 Jun 2014, 10:09
#447
wrickspam avatar

wrickspam

New Zenner

Join Date:
Dec 2011
Location:
Emmen, The Netherlands
Posts:
85
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

panservolvo:

Thank you again. I took a look at the file for the dynamic filter, but i figured I probably would use several hours getting this working.
Instead I made a database trigger on the products table. Every time the table is updated the trigger updates my newly created stock attribute to in stock/out of stock according to products_quantity. Not too pretty, but effective :)

Im having exaclty the same problems, very hard to replicate the problem but it appears to only not filter for products with a lot of attributes, i havent tried to delete the english language. but i will give that a try to see if it fixes stuff

Really need a fix for this plugin

05 Jun 2014, 10:18
#448
wrickspam avatar

wrickspam

New Zenner

Join Date:
Dec 2011
Location:
Emmen, The Netherlands
Posts:
85
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

I have tried removing the english language, but that still doesnt fix the problems with filtering.

As the person above me i have the error:

[05-Jun-2014 12:15:58 Europe/Amsterdam] PHP Warning:  trim() expects parameter 1 to be string, array given in /var/www/vhosts/domain/httpdocs/shop/includes/functions/functions_general.php on line 63
[05-Jun-2014 12:15:58 Europe/Amsterdam] PHP Warning:  trim() expects parameter 1 to be string, array given in /var/www/vhosts/domain/httpdocs/shop/includes/functions/functions_general.php on line 63

Here you can see how buggy it is:
http://www.etcoevorden.nl/shop/index.php?main_page=index&cPath=23_42

This shows a lot of products, but when clicking on the "Discovery 1 1990-1998" Filter on the left side

It doesnt show me any results (in the bottom it shows -> Artikel 1 tot 10 (van 18 artikelen) (so it should have at least 1 result)

If you check one of the products in this category -> http://www.etcoevorden.nl/shop/index.php?main_page=product_info&cPath=23_42&products_id=8

It does show Attribute -> "Discovery 1 1990-1998" in the bottom so it should be able to find it ?

Im currently running Zencart 1.5.1 and i have tried to add the fixes posted by dr blyte

05 Jun 2014, 10:23
#449
wrickspam avatar

wrickspam

New Zenner

Join Date:
Dec 2011
Location:
Emmen, The Netherlands
Posts:
85
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

This is on line 63 in functions_general:

  function zen_parse_input_field_data($data, $parse) {
    return strtr(trim($data), $parse);
  }

My PHP version is 5.3.23

Zencart 1.5.1

05 Jun 2014, 12:14
#450
design75 avatar

design75

Totally Zenned

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

Re: Dynamic Filter [Support Thread]

I found the language code I have added to the filter to show multiple languages.

in includes\templates\YOUR_TEMPLATE\sideboxes\tpl_dynamic_filter.php find

        $categories = $db->Execute("SELECT categories_id, categories_name, IF(categories_id IN (" . implode(',', $filteredCategories) . "), 'Y', 'N') as flag" .
        " FROM " . TABLE_CATEGORIES_DESCRIPTION .
        " WHERE categories_id IN (" . implode(',', $unfilteredCategories) . ")" .
        " ORDER BY categories_name");

and replace with

        $categories = $db->Execute("SELECT categories_id, categories_name, IF(categories_id IN (" . implode(',', $filteredCategories) . "), 'Y', 'N') as flag" .
                              " FROM " . TABLE_CATEGORIES_DESCRIPTION .
                              " WHERE categories_id IN (" . implode(',', $unfilteredCategories) . ")" .
                              " AND language_id=" . (int)$_SESSION['languages_id'] . 
                              " ORDER BY categories_name");
08 Jun 2014, 21:07
#451
shk avatar

shk

New Zenner

Join Date:
Oct 2006
Posts:
62
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Did anyone figure out how to use this with SBA and not have the filter ignore products with no stock?

09 Jun 2014, 09:10
#452
shk avatar

shk

New Zenner

Join Date:
Oct 2006
Posts:
62
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Sorry, I meant not having the filter ignore products without a SBA stock value. It does work if every product with attribute has a SBA stock value, even zero if you alter the sql statement slightly. But this seems highly wasteful as it adds quite a few attributes.

09 Jun 2014, 13:39
#453
shk avatar

shk

New Zenner

Join Date:
Oct 2006
Posts:
62
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Seems I must have made some mistake when I installed this module. I did a complete reinstall, altered the sql to >= 0 and voila! It works.

09 Jun 2014, 14:17
#454
shk avatar

shk

New Zenner

Join Date:
Oct 2006
Posts:
62
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Im just going to be quiet now. :blush: When using SBA, every product with attribute must have a SBA stock id. So my question remain.

10 Jun 2014, 07:18
#455
wrickspam avatar

wrickspam

New Zenner

Join Date:
Dec 2011
Location:
Emmen, The Netherlands
Posts:
85
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

any chance you can help me and panservolvo to fix our problems with the filter not working for products with a lot of attributes?

10 Jun 2014, 07:19
#456
wrickspam avatar

wrickspam

New Zenner

Join Date:
Dec 2011
Location:
Emmen, The Netherlands
Posts:
85
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

wrickspam:

I have tried removing the english language, but that still doesnt fix the problems with filtering.

As the person above me i have the error:

[05-Jun-2014 12:15:58 Europe/Amsterdam] PHP Warning: trim() expects parameter 1 to be string, array given in /var/www/vhosts/domain/httpdocs/shop/includes/functions/functions_general.php on line 63
[05-Jun-2014 12:15:58 Europe/Amsterdam] PHP Warning: trim() expects parameter 1 to be string, array given in /var/www/vhosts/domain/httpdocs/shop/includes/functions/functions_general.php on line 63

> 
> 
> Here you can see how buggy it is:
> <http://www.etcoevorden.nl/shop/index.php?main_page=index&cPath=23_42>
> 
> This shows a lot of products, but when clicking on the "Discovery 1 1990-1998" Filter on the left side
> 
> It doesnt show me any results (in the bottom it shows -> Artikel 1 tot 10 (van 18 artikelen) (so it should have at least 1 result)
> 
> If you check one of the products in this category -> <http://www.etcoevorden.nl/shop/index.php?main_page=product_info&cPath=23_42&products_id=8>
> 
> It does show Attribute -> "Discovery 1 1990-1998" in the bottom so it should be able to find it ?
> 
> Im currently running Zencart 1.5.1 and i have tried to add the fixes posted by dr blyte


this quote explains the problems weve been having!
10 Jun 2014, 07:48
#457
design75 avatar

design75

Totally Zenned

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

Re: Dynamic Filter [Support Thread]

wrickspam:

this quote explains the problems weve been having!

PM send

01 Jul 2014, 06:42
#458
peteratdd avatar

peteratdd

New Zenner

Join Date:
May 2009
Posts:
8
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

SHK:

Seems I must have made some mistake when I installed this module. I did a complete reinstall, altered the sql to >= 0 and voila! It works.

Where did you alter the SQL to >=0? ...from what to what. Thanks

06 Aug 2014, 13:50
#459
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Dynamic Filter [Support Thread]

Baloo:

Hi all,

I've spent far to many hours pulling my hair out, and need to admit defeat and ask for help. It probably an easy fix for someone who knows what they're doing, there's a lot of similar issues posted before me, but implementing fixes suggested before hasn't helped.

The filter works perfectly in some categories (https://ainleyorganics.co.uk/breakfast-products-c-848/), but breaks the page in others (https://ainleyorganics.co.uk/breads-c-798/).

My functions_general.php file is as follows:

function zen_get_all_get_params($exclude_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 3
if ( (!in_array($key, $exclude_array)) && (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 3
if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {
// die ('here');
$get_url .= $key . '/' . rawurlencode(stripslashes($value)) . '/';
} else {
// bof dynamic filter 2 of 3
if (is_array($value)) {
foreach($value as $arr){
$get_url .= zen_sanitize_string($key) . '[]=' . rawurlencode(stripslashes($arr)) . '&';
}
} else {
// eof dynamic filter 2 of 3
$get_url .= zen_sanitize_string($key) . '=' . rawurlencode(stripslashes($value)) . '&';
// bof dynamic filter 3 of 3
}
// eof dynamic filter 3 of 3
}
}
}
}
while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);
while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);

return $get_url;

}

> 
> My log file is as follows:
> ```
PHP Warning:  strlen() expects parameter 1 to be string, array given in /home/....../public_html/includes/functions/functions_general.php on line 152

I'd really appreciate some help on this. Thanks in advance.
I know that this is a tad late :blush:, but here's the correction that I made to remove the referenced PHP Warning:

  function zen_get_all_get_params($exclude_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 3
//-bof-20140806-lat9-Make sure the value's a string before using strlen
        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-20140806-lat9
// eof dynamic filter 1 of 3
          if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {
//    die ('here');
            $get_url .= $key . '/' . rawurlencode(stripslashes($value)) . '/';
          } else {
// bof dynamic filter 2 of 3
            if (is_array($value)) {
              foreach($value as $arr){
                $get_url .= zen_sanitize_string($key) . '[]=' . rawurlencode(stripslashes($arr)) . '&';
              }
            } else {
// eof dynamic filter 2 of 3
              $get_url .= zen_sanitize_string($key) . '=' . rawurlencode(stripslashes($value)) . '&';
// bof dynamic filter 3 of 3
			}
// eof dynamic filter 3 of 3
          }
        }
      }
    }
    while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);
    while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);

    return $get_url;
  }

Note also that the installation SQL script, out-of-the-box, (a) wipes out the configuration_group_id of 0 and (b) performs "blind" SQL inserts into the configuration table (causing issues if you've installed a plugin that adds a field to that table). Here's the updated version:

SELECT @cid:=configuration_group_id FROM configuration_group WHERE configuration_group_title= 'Dynamic Filter';
DELETE FROM configuration WHERE configuration_group_id = @cid AND @cid != 0;
DELETE FROM configuration_group WHERE configuration_group_id = @cid AND @cid != 0;
INSERT INTO configuration_group VALUES (NULL, 'Dynamic Filter', 'Dynamic Filter Settings', '1', '1');
SET @cid=last_insert_id();
UPDATE configuration_group SET sort_order = @cid WHERE configuration_group_id = @cid;
INSERT INTO configuration ( configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function)
                          VALUES ('Enable on Category Pages', 'FILTER_CATEGORY', 'Yes', 'Enable the filter on category pages?', @cid, '10', now(), now(), NULL, "zen_cfg_select_option(array('Yes', 'No'),"),
                                 ('Enable on All Products Page', 'FILTER_ALL', 'Yes', 'Enable the filter on all products page?', @cid, '20', now(), now(), NULL, "zen_cfg_select_option(array('Yes', 'No'),"),
                                 ('Enable on New Products Page', 'FILTER_NEW', 'Yes', 'Enable the filter on new products page?', @cid, '30', now(), now(), NULL, "zen_cfg_select_option(array('Yes', 'No'),"),
                                 ('Enable on Featured Products Page', 'FILTER_FEATURED', 'Yes', 'Enable the filter on featured products page?', @cid, '40', now(), now(), NULL, "zen_cfg_select_option(array('Yes', 'No'),"),
                                 ('Enable on Specials Page', 'FILTER_SPECIALS', 'Yes', 'Enable the filter on specials page?', @cid, '50', now(), now(), NULL, "zen_cfg_select_option(array('Yes', 'No'),"),
                                 ('Enable on Search Page', 'FILTER_SEARCH', 'Yes', 'Enable the filter on advanced search page?', @cid, '60', now(), now(), NULL, "zen_cfg_select_option(array('Yes', 'No'),"),
                                 ('Filter Style', 'FILTER_STYLE', 'Link', 'How are the filters to be applied?<br /><br /><strong>Link</strong> - Each option is a link; Only one filter can be applied at a time.<br /><strong>Dropdown (Single)</strong> - Each option is part of a drop down list; Only one filter can be applied at a time.<br /><strong>Dropdown (Multi)</strong> - Each option is part of a drop down list; Multiple filters can be applied at a time.<br /><strong>Checkbox (Single)</strong> - Each option is a checkbox; Only one filter can be applied at a time.<br /><strong>Checkbox (Multi)</strong> - Each option is a checkbox; Multiple filters can be applied at a time.', @cid, '70', now(), now(), NULL, "zen_cfg_select_option(array('Link', 'Dropdown - Single', 'Dropdown - Multi', 'Checkbox - Single', 'Checkbox - Multi'),"),
                                 ('Disabled Options Method', 'FILTER_METHOD', 'Greyed', 'How are the unavailable filter options to be disabled?<br /><br /><strong>Greyed</strong> - Grey out the unavailable options.<br /><strong>Hidden</strong> - Hide the unavailable options.', @cid, '80', now(), now(), NULL, "zen_cfg_select_option(array('Greyed', 'Hidden'),"),
                                 ('Options Box Style', 'FILTER_OPTIONS_STYLE', 'Scroll', 'Which style of box should be used when the maximum number of options has been reached?<br /><br /><strong>Scroll</strong> - Scroll box.<br /><strong>Expand</strong> - Expanding box with More/Less link.<br /><br /><strong>Note: This option is only applicatble with Link or Checkbox filter styles.</strong>', @cid, '90', now(), now(), NULL, "zen_cfg_select_option(array('Scroll', 'Expand'),"),
                                 ('Maximum Number of Options', 'FILTER_MAX_OPTIONS', '9', 'What is the maximum number of options to be displayed before scroll bar/More link is visible?<br /><br /><strong>Note: This option is only applicatble with Link or Checkbox filter styles.</strong>', @cid, '100', now(), now(), NULL, NULL),
                                 ('Maximum Number of Price Ranges', 'FILTER_MAX_RANGES', '5', 'What is the maximum number of price range groups?<br /><br /><strong>Note: This can be overridden by the Maximum Price Range parameter</strong>', @cid, '110', now(), now(), NULL, NULL),
                                 ('Minimum Price Range', 'FILTER_MIN_PRICE', '10', 'What is the minimum gap in the price ranges?<br />Set as zero to deactivate.', @cid, '120', now(), now(), NULL, NULL),
                                 ('Maximum Price Range', 'FILTER_MAX_PRICE', '25', 'What is the minimum gap in the price ranges?<br />Set as zero to deactivate.', @cid, '130', now(), now(), NULL, NULL),
                                 ('Include Options', 'FILTER_OPTIONS_INCLUDE', '', 'Enter the list of option IDs to be included in the filter, separated by commas (i.e. 1,2,3)<br />Only the option numbers listed here will appear in the filter.<br />Leave blank to deactivate.', @cid, '140', now(), now(), NULL, NULL),
                                 ('Exclude Options', 'FILTER_OPTIONS_EXCLUDE', '', 'Enter the list of option IDs to be excluded from the filter, separated by commas (i.e. 1,2,3)<br />The option numbers listed here will <strong>not</strong> appear in the filter.<br />Leave blank to deactivate.', @cid, '150', now(), now(), NULL, NULL),
                                 ('Google Event Tracking', 'FILTER_GOOGLE_TRACKING', 'No', 'Use Google Event Tracking?<br /><br /><strong>No</strong> - Do not use Google Event Tracking<br /><strong>ga.js</strong> - Use traditional ga.js Google Event Tracking method<br /><strong>Asynchronous</strong> - Use new asynchronous Google Event Tracking method<br /><br /><strong>Note: Requires Google Analytics Code</strong>', @cid, '160', now(), now(), NULL, "zen_cfg_select_option(array('No', 'ga.js', 'Asynchronous'),");


/*
zencart 1.5 mods
*/
DELETE FROM admin_pages WHERE page_key='configDynamicFilter';
INSERT INTO admin_pages (page_key,language_key,main_page,page_params,menu_key,display_on_menu,sort_order) VALUES ('configDynamicFilter','BOX_CONFIGURATION_DYNAMIC_FILTER','FILENAME_CONFIGURATION',CONCAT('gID=',@cid), 'configuration', 'Y', @cid);  
07 Aug 2014, 02:17
#460
mandolin avatar

mandolin

New Zenner

Join Date:
Aug 2014
Location:
United States
Posts:
9
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Hi,

I installed the Dynamic Filter version 1.5.0 on my test zen cart version 1.5.1, according to the instructions, including the SQL install. I did not have any errors or conflicts on the files. After configuring the plugin in the Admin backend, the front-end display JUST a blank page with a 500 error. The front-end worked properly before I backed up the files/database and installed the plugin.

Anyone have any ideas on what the problem is or how I can troubleshoot it? Although I have programmed php and mysql for years, I am stuck right now.

Here is some more info:
PHP Version: 5.4.29 (Zend: 2.4.0) PHP Memory Limit: 256M
Database: MySQL 5.5.37-35.1

Thanks