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

Dynamic Filter [Support Thread]

Views: 652,521

Results 421 to 440 of 809
18 Mar 2014, 8:37 AM
#421
wrickspam avatar

wrickspam

New Zenner

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

Dynamic Filter [Support Thread]

wrickspam:

has probably to do with bugs in function_general file, this mod is horrible it functions for 30% .. dont install

Managed to fix my problems (PHP Warning: trim() expects parameter 1 to be string, array given in);

Updated my zencart to 1.5.1, edited functions_general with the fixed dr_blyte supplied.

Now everything is working okay !

If you dont have experience with editing core files stay away from this 1.5.1 update since it requires modding of the core files...

20 Mar 2014, 2:53 PM
#422
wrickspam avatar

wrickspam

New Zenner

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

Re: Dynamic Filter [Support Thread]

Anybody know if it is possible to change the sort order of the items in the sidebox ?

i have tried playing around with the sort order in the zencart admin but it does not give any results !

Attachment 13902

Im also looking for a method to collapse the panels withing the sidebox, anybody got something working for this ?

I would like to be able to click the option name (the filter name) and then collapse the available filter options !

maybe somebody can point me in the right direction

20 Mar 2014, 4:06 PM
#423
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:

Anybody know if it is possible to change the sort order of the items in the sidebox ?

i have tried playing around with the sort order in the zencart admin but it does not give any results !

Attachment 13902

Im also looking for a method to collapse the panels withing the sidebox, anybody got something working for this ?

I would like to be able to click the option name (the filter name) and then collapse the available filter options !

maybe somebody can point me in the right direction

I think the sort order can be changed by changing the sort order of the attributes.
For the collapse of the items I may have something for that at home, I'll get back to that later.

21 Mar 2014, 8:25 AM
#424
raunharman avatar

raunharman

Zen Follower

Join Date:
Dec 2005
Posts:
165
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Hi,
I visited your website snowrepublic.co.uk.
Very nice layout and the filters also have been working well.
The product information page looks superb. I would want a similar page for my website.
Which template have you used here?

davowave:

Hi there, I'm using dynamic filter mod by damian taylor - which is an awesome mod btw, you can see it at work on his website http://www.snowrepublic.co.uk/ (click on a category). It's a product filter for prices, manufacturer, attributes etc...

Anyway, the mod has been updated to work with 1.5 and I'm testing it on a brand new install with no other mods.

When I switch admin->configure->productlisting->display category/manufacturer filter off (which is the default zencart product filter and required to be turned off to make parts of damians mod to work) I get errors.

Here's one:

So the problem is the SQL, but which is more correct - the mod's version (which presumably is uptodate coz it's been passed for 1.5) or my xampp version?

Also, I don't suppose if anyone knows if this is an easy fix? :)

thanks

21 Mar 2014, 8:34 AM
#425
wrickspam avatar

wrickspam

New Zenner

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

Re: Dynamic Filter [Support Thread]

this will explain the problem i have a little better

when i change the sort order around (like change number 2 to 98) it still shows in the first position

here some screenshots to explain better

Attachment 13904
Attachment 13905

changing the sort order around does not result in another order :P

who can point me in the right direction ?

21 Mar 2014, 9:31 AM
#426
wrickspam avatar

wrickspam

New Zenner

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

Re: Dynamic Filter [Support Thread]

Managed to fix the sort order;

open includes/templates/YOUR_TEMPLATE/sideboxes/tpl_dynamic_filter.php

FIND:

	if(count($filteredProducts) > 0){
		// Below line counts up all quantities of each item. e.g. if a glove is available in Small and Medium, quantity = 2.
		//$attributes = $db->Execute("SELECT po.products_options_name, pov.products_options_values_name, count( p2as.quantity ) as quantity" .
		    $attributes = $db->Execute("SELECT COUNT(DISTINCT p2a.products_id) as quantity, po.products_options_name, pov.products_options_values_name," . 
         " SUM(IF(p2a.products_id IN(" . implode(',', $filteredProducts) . "), 1, 0)) as flag" . 
         " FROM " . TABLE_PRODUCTS_ATTRIBUTES . " p2a ". 
         " JOIN " . TABLE_PRODUCTS_OPTIONS . " po ON p2a.options_id = po.products_options_id AND po.language_id=" . (int)$_SESSION['languages_id'] . 
         " JOIN " . TABLE_PRODUCTS_OPTIONS_VALUES ." pov ON p2a.options_values_id = pov.products_options_values_id AND pov.language_id=" . (int)$_SESSION['languages_id'] . 
         (defined('TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK') ? " JOIN " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " p2as ON p2a.products_id = p2as.products_id AND p2as.stock_attributes LIKE CONCAT('%', p2a.products_attributes_id, '%')" : "") . 
         " WHERE p2a.products_id IN (" . implode(',', $unfilteredProducts) . ")" . 
         (FILTER_OPTIONS_INCLUDE != '' ? " AND p2a.options_id IN (" . FILTER_OPTIONS_INCLUDE . ")" : '') . 
         (FILTER_OPTIONS_EXCLUDE != '' ? " AND p2a.options_id NOT IN (" . FILTER_OPTIONS_EXCLUDE . ")" : '') . 
         (defined('TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK') ? " AND p2as.quantity > 0" : "") . 
         " GROUP BY po.products_options_name, pov.products_options_values_name" . 
         " ORDER BY po.products_options_name, pov.products_options_values_sort_order");  

REPLACE WITH:"

	if(count($filteredProducts) > 0){
		// Below line counts up all quantities of each item. e.g. if a glove is available in Small and Medium, quantity = 2.
		//$attributes = $db->Execute("SELECT po.products_options_name, pov.products_options_values_name, count( p2as.quantity ) as quantity" .
		    $attributes = $db->Execute("SELECT COUNT(DISTINCT p2a.products_id) as quantity, po.products_options_name, pov.products_options_values_name," . 
         " SUM(IF(p2a.products_id IN(" . implode(',', $filteredProducts) . "), 1, 0)) as flag" . 
         " FROM " . TABLE_PRODUCTS_ATTRIBUTES . " p2a ". 
         " JOIN " . TABLE_PRODUCTS_OPTIONS . " po ON p2a.options_id = po.products_options_id AND po.language_id=" . (int)$_SESSION['languages_id'] . 
         " JOIN " . TABLE_PRODUCTS_OPTIONS_VALUES ." pov ON p2a.options_values_id = pov.products_options_values_id AND pov.language_id=" . (int)$_SESSION['languages_id'] . 
         (defined('TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK') ? " JOIN " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " p2as ON p2a.products_id = p2as.products_id AND p2as.stock_attributes LIKE CONCAT('%', p2a.products_attributes_id, '%')" : "") . 
         " WHERE p2a.products_id IN (" . implode(',', $unfilteredProducts) . ")" . 
         (FILTER_OPTIONS_INCLUDE != '' ? " AND p2a.options_id IN (" . FILTER_OPTIONS_INCLUDE . ")" : '') . 
         (FILTER_OPTIONS_EXCLUDE != '' ? " AND p2a.options_id NOT IN (" . FILTER_OPTIONS_EXCLUDE . ")" : '') . 
         (defined('TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK') ? " AND p2as.quantity > 0" : "") . 
         " GROUP BY po.products_options_name, pov.products_options_values_name" . 
         " ORDER BY po.products_options_sort_order");  

Now the filters are sorted by products_options_sort_order (the order u set in the admin when adding the new attributes) instead of alphabetically

8 May 2014, 8:31 AM
#427
wrickspam avatar

wrickspam

New Zenner

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

Re: Dynamic Filter [Support Thread]

No support for this plugin, dont use in live shop with lots of products since it will screw up

17 May 2014, 10:23 PM
#428
computerfamily avatar

computerfamily

New Zenner

Join Date:
Apr 2014
Location:
Roma, Italy
Posts:
3
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Hello everyone, I use the attributes (read only).
I'm trying to run this plugin with zencart 1.5.1 but there is no way that it works.
I would be interested to simply filter the products based on the attributes (read only), without the filter of the price or other features of attributes (prices vary, types of product in the cart, or similar functions). I do not need.
I do not care a sidebox that creates the filter attributes.
I wish that in the product listing where I put the sort order by price, add a filter for attributes. And nothing else :)
Thanks in advance to those who answer :)

25 May 2014, 9:55 AM
#429
baloo avatar

baloo

New Zenner

Join Date:
Jul 2007
Location:
Hull, UK
Posts:
28
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

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.

26 May 2014, 12:38 AM
#430
yaritai avatar

yaritai

Zen Follower

Join Date:
Apr 2014
Posts:
154
Plugin Contributions:
0

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.

It does not help when you post links and then decide to disable the mod in question. There is no way to troubleshoot the issue. If you want help and need to run a live site at the same time, make a testing site and do all changes there. FYI, this mod does work with v1.5 and v1.51. The only tricky part is doing merges to a few core files as alot has changed since this mod came out.

28 May 2014, 8:19 PM
#431
baloo avatar

baloo

New Zenner

Join Date:
Jul 2007
Location:
Hull, UK
Posts:
28
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

yaritai:

It does not help when you post links and then decide to disable the mod in question. There is no way to troubleshoot the issue. If you want help and need to run a live site at the same time, make a testing site and do all changes there. FYI, this mod does work with v1.5 and v1.51. The only tricky part is doing merges to a few core files as alot has changed since this mod came out.

Thanks for your response, I left it active for 24 hours but as it screwed up various parts of the site (footer disappeared, menu moved etc), and I got an email from a customer complaining she had issues, I decided to deactivate it, and give up. Instead I added a suffix to the titles, so the attributes could be easily identified without entering the details for each product individually. It is something I'd love to fix though.

As a short term measure, I have activated it on a similar site (virtually a copy of the site I previously linked to, where I have exactly the same issues).

You will see on this page that the menu has moved to the very top of the page, and sideboxes seem to have moved to the centre: http://healthandwholefoods.co.uk/m-c-2689/maximuscle-c-2689_3128/

The symptoms are virtually the same, so I'm certain if I fix one, I'll be able to fix the other.

Thanks

Martin

28 May 2014, 11:24 PM
#432
k1ra avatar

k1ra

New Zenner

Join Date:
Jul 2013
Posts:
57
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

I just installed this mod, it seems to be exactly what I need, however none of my read-only attributes show. I have to have read-only attributes for the Google Merchant Feeder mod and would like some of these [pattern, color, etc] to be searchable with Dynamic Filter. I do have SBA installed and don't apply stock levels to read-only attributes.

Is there a way to show attributes that are read-only with Dynamic Filter?

29 May 2014, 5:30 AM
#433
design75 avatar

design75

Totally Zenned

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

Re: Dynamic Filter [Support Thread]

k1ra:

I just installed this mod, it seems to be exactly what I need, however none of my read-only attributes show. I have to have read-only attributes for the Google Merchant Feeder mod and would like some of these [pattern, color, etc] to be searchable with Dynamic Filter. I do have SBA installed and don't apply stock levels to read-only attributes.

Is there a way to show attributes that are read-only with Dynamic Filter?

I an ZC installation without SBA the read only attributes should show just fine, I have now idea how SBA handles them.

31 May 2014, 7:22 AM
#434
panservolvo avatar

panservolvo

New Zenner

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

Re: Dynamic Filter [Support Thread]

do anyone know if there is a way to add an "in stock" filter option?

31 May 2014, 8:31 AM
#435
yaritai avatar

yaritai

Zen Follower

Join Date:
Apr 2014
Posts:
154
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

panservolvo:

do anyone know if there is a way to add an "in stock" filter option?

The simplest method is to create a read only attribute as in-stock and out-of-stock and then hide that attribute with css. But this may not be feasible if you have a large number of products or products that change frequently. If you wanted a method that is automatic based on when product quantity goes to "0" then this would take a modification approach to the core code of dynamic filter.

The approach is up to you and depends on your expertise to do the latter approach. The way dynamic filter is coded, it shouldn't be too difficult to get it to work.

2 Jun 2014, 9:14 AM
#436
panservolvo avatar

panservolvo

New Zenner

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

Re: Dynamic Filter [Support Thread]

Thanks for your reply.
The hidden attribute solution will not be good enough as I have products going in and out of stock. It'd be too much maintenance.
I have some php-skills and good sql-skills, but I guess I need some guidence to where to start.

2 Jun 2014, 9:25 AM
#437
panservolvo avatar

panservolvo

New Zenner

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

Re: Dynamic Filter [Support Thread]

Or maybe I could make a db-trigger to update the attribute when stock is <=0 thoughts?

2 Jun 2014, 11:04 AM
#438
yaritai avatar

yaritai

Zen Follower

Join Date:
Apr 2014
Posts:
154
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

panservolvo:

Or maybe I could make a db-trigger to update the attribute when stock is <=0 thoughts?

I have not touched the core code of this mod in a while so I would have to relook at what routes can be done. But I would say that would be a good place to start. This is a bit of code from the core that I used to do a custom dropdown for a friend which basically disables the products from the dropdown when stock reaches a predetermined level he targets.

  function zen_get_product_quantity_form($product_id) {
    global $db;
    $sql = "select products_quantity from " . TABLE_PRODUCTS . (zen_not_null($product_id) ? " where products_id=" . (int)$product_id : "");
    $check_quantity = $db->Execute($sql);
    return $check_quantity->fields['products_quantity'];
  }

So you could use this logic in your code to trigger the change of the attribute. Bascially just make sure to loop through the products and then the function will assign "instock" and "outofstock" automatically.

But another approach is to just go in the tpl file for dynamic filter and basically make a custom filter selection to loop through all products and either give the 2 choices of "instock" and outofstock" based on the function above results on the quantity. This would be the easier way as you won't have to touch the core code of messing with the attributes but instead just have the filter give selections based on the quantity value. This would be the way I would approach it.

2 Jun 2014, 12:51 PM
#439
panservolvo avatar

panservolvo

New Zenner

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

Re: Dynamic Filter [Support Thread]

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 :)

4 Jun 2014, 7:14 AM
#440
panservolvo avatar

panservolvo

New Zenner

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

Re: Dynamic Filter [Support Thread]

Ok, so I turned on the sidebox, and it seems to act kind of strangely.
In all categories/subcategories but one it works like a charm, but in one subcategory when I filter on an attribute the result is empty, but the text underneath where the products should have been show: "Showing 9 of 9 products"
9 products is the correct amount, but none of the 9 is shown.
I cant show you on my site as I have disabled it to not confuse my customers.
Anyone heard of this kind of behaviour?