Forums / Addon Sideboxes / Dynamic Filter [Support Thread]

Dynamic Filter [Support Thread]

Views: 653,483

Results 61 to 80 of 809
23 May 2012, 7:15 AM
#61
damiantaylor avatar

damiantaylor

Zen Follower

Join Date:
Aug 2009
Posts:
244
Plugin Contributions:
0

Dynamic Filter [Support Thread]

BTW, is there a semi-simple way to have number of items per attribute in brackets after the attribute in the filter listing, as per my other thread? Just asking....

If you look in the ....templates/sideboxes/tpl_dynamic_filter.php file, in the section that generates the attribute filters, I think I put a column called quantity in the select statement. You can use that to display a count but it will only work for attributes which is why it never went live. Categories, brands, price range won't show a count.
That's as far as I got with it I'm afraid!

23 May 2012, 8:12 AM
#62
damiantaylor avatar

damiantaylor

Zen Follower

Join Date:
Aug 2009
Posts:
244
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

kamelion,
I've been working with Jimproz on this and have tracked it down to what may be a MySQL bug.
There's a query that is generated with an 'order by' clause, which when executed returns an incorrect number of rows. If the order by clause is removed, the query works correctly. I can't see a reason for it except a bug in the version of MySQL he's running, although I'm no SQL expert!
Do you have another server which is running a different version of MySQL you can try this on?

23 May 2012, 9:50 AM
#63
gavwright avatar

gavwright

New Zenner

Join Date:
Jul 2010
Posts:
30
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

So you did....another thing I didn't notice. I tried using 'p2as.quantity' and got nothing...but 'quantity' works like a dream. The great thing is....I'm only using attributes, so it's precisely what I'm looking for! I've now added the code so after the attribute name I have the quantity in brackets. Well, braces, actually - they look pretty cool.

Thanks again for a great mod. Still got misaligned sideboxes underneath, though - have to do some more digging when I get chance.

Cheers!
Gavin

23 May 2012, 9:59 AM
#64
long_john avatar

long_john

New Zenner

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

Re: Dynamic Filter [Support Thread]

There is a line in tpl_dynamic_filter.php that I believe is intended to give this functionality, but I could not get it to work myself, maybe you have more luck and can share your results?

		// 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" .
23 May 2012, 10:57 AM
#65
gavwright avatar

gavwright

New Zenner

Join Date:
Jul 2010
Posts:
30
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Hi there,

Glad to share...code required is around l.324 and is as follows (extra bit is in BOLD);

				case 'Checkbox':
					$filters .= '<li class="dFilterLink">' . zen_draw_checkbox_field($group . '[]', $attributes->fields['products_options_values_name'], (isset($_GET[$group]) && in_array($attributes->fields['products_options_values_name'],$_GET[$group]) ? true : false), ($linkClass == 'disabled' ? 'disabled="disabled"' : '') . ($onClick != '' && FILTER_STYLE == 'Checkbox - Single' ? ' onclick="' . $onClick . '"' : '')) . htmlspecialchars(html_entity_decode($attributes->fields['products_options_values_name'], ENT_QUOTES)) **.' {' . htmlspecialchars(html_entity_decode($attributes->fields['quantity'], ENT_QUOTES)). '}' **. '</li>';
23 May 2012, 1:09 PM
#66
long_john avatar

long_john

New Zenner

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

Re: Dynamic Filter [Support Thread]

Works great, thanks!

23 May 2012, 3:51 PM
#67
kamelion0927 avatar

kamelion0927

Zen Follower

Join Date:
Dec 2009
Posts:
208
Plugin Contributions:
1

Re: Dynamic Filter [Support Thread]

I think I do - my test site (burningbutterfly.com) is on 5.0 while my live site is on 5.5. I don't know if that will be enough of a difference in version to make a difference but it's worth a shot. As soon as my test server comes back up, I'll transfer the test files to my live site's server and see if there's any difference.

What file is the incorrect orderby clause in? I'm no MySQL expert by any means but if I stare at a problem long enough, sometimes I can figure out what the problem is :)

Thanks again! This mod is awesome and makes such a difference in making a site look more professional.

23 May 2012, 4:56 PM
#68
kamelion0927 avatar

kamelion0927

Zen Follower

Join Date:
Dec 2009
Posts:
208
Plugin Contributions:
1

Re: Dynamic Filter [Support Thread]

Unfortunately it didn't work on MySQL 5.5. I'll keep digging through the files for the order by clause and see what I can come up with.

23 May 2012, 5:44 PM
#69
damiantaylor avatar

damiantaylor

Zen Follower

Join Date:
Aug 2009
Posts:
244
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Thanks for trying.
The only other thing I've spotted that your site and jimproz have in common is the lack of the sort box....the one that let's you sort by price, date added, etc.
I can't see why that would make a difference...I'm kind of grabbing at straws now!

The SQL that is responsible for generating the product listing is in includes/modules/product_listing.php.
Around line 75 $listing = $db->Execute($listing_split->sql_query);

$listing_split->sql_query is generated by the supplied modified file includes/classes split_page_results.php

Your problem may not actually be the same as jimproz's because when he gets no products displayed in the list, he still gets the 'Displaying 1 to 2 (of 2 products)' message, just no products displayed.
Your site doesn't show that message.

24 May 2012, 3:17 PM
#70
kamelion0927 avatar

kamelion0927

Zen Follower

Join Date:
Dec 2009
Posts:
208
Plugin Contributions:
1

Re: Dynamic Filter [Support Thread]

damiantaylor:

The only other thing I've spotted that your site and jimproz have in common is the lack of the sort box....the one that let's you sort by price, date added, etc.
I can't see why that would make a difference...I'm kind of grabbing at straws now!

I'll turn on the sort box and see if that makes a difference because sometimes grabbing at straws works :)

I added an admin switch to 'includes/templates/custom/sideboxes/tpl_dynamic_filter.php' so that I can turn off the manufacturer filter, price filter and category filter in the filter sidebox as well as a switch for the price filter so that it will only show up only if there is more than one option. I tried replacing that file with the default one but it didn't make a difference.

damiantaylor:

The SQL that is responsible for generating the product listing is in includes/modules/product_listing.php.
Around line 75 $listing = $db->Execute($listing_split->sql_query);

$listing_split->sql_query is generated by the supplied modified file includes/classes split_page_results.php

Thanks!

damiantaylor:

Your problem may not actually be the same as jimproz's because when he gets no products displayed in the list, he still gets the 'Displaying 1 to 2 (of 2 products)' message, just no products displayed.
Your site doesn't show that message.

I actually have it coded so that it doesn't show that message unless there is more than one page of products to display. I changed it back to the default code, but it didn't make a difference.

The only products I have the problem on are ones that have more than one attribute that is required to add it to the cart - does jimproz have the same issue? Or is it not sorting for any of their products?

24 May 2012, 5:54 PM
#71
damiantaylor avatar

damiantaylor

Zen Follower

Join Date:
Aug 2009
Posts:
244
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

I'm not sure if jimproz has the problem with multiple attributes or not, although I tested that on my own site and it didn't give me any problems.

You're probably best adding

die($listing_split->sql_query);

before the $listing = $db->Execute($listing_split->sql_query); line in includes/modules/product_listing.php.
That will show you the SQL statement that is being generated. You can then hopefully see what is causing the issue....why that statement is returning an incorrect number of rows.

Remeber to remove the statement after though!

25 May 2012, 4:54 AM
#72
kamelion0927 avatar

kamelion0927

Zen Follower

Join Date:
Dec 2009
Posts:
208
Plugin Contributions:
1

Re: Dynamic Filter [Support Thread]

damiantaylor:

I'm not sure if jimproz has the problem with multiple attributes or not, although I tested that on my own site and it didn't give me any problems.

You're probably best adding

die($listing_split->sql_query);

> 
> before the $listing = $db->Execute($listing_split->sql_query); line in includes/modules/product_listing.php.
> That will show you the SQL statement that is being generated. You can then hopefully see what is causing the issue....why that statement is returning an incorrect number of rows.
> 
> Remeber to remove the statement after though!

LOL I actually did that before I replied to this thread and got the same result as jimproz. There is an error in my cache that says 

PHP Warning:  strlen() expects parameter 1 to be string, array given in ...includes/functions/functions_general.php on line 154

I did some searching on the forums and I guess it is/used to be a somewhat common problem but none of the fixes suggested worked for this case (probably because I'm still trying to decipher the code in functions_general.php).

I replaced all of the dynamic filter and product listing pages with defaults and now I'm not even showing any product results at all but I am getting the 'Displaying 1 to 7 (of 7 products)' <sigh>.
29 May 2012, 3:44 PM
#73
kamelion0927 avatar

kamelion0927

Zen Follower

Join Date:
Dec 2009
Posts:
208
Plugin Contributions:
1

Re: Dynamic Filter [Support Thread]

I managed to get this mostly working on the search listing after changing the header for the page - for some reason on my site, I needed to disable most of the $order_str lines to get it to work properly.

The only problem I have now is that if the product has an attribute with more than 28 options, it says the product cannot be found when you try to filter by the attribute even though that attribute is not included in the filter. I updated the only attribute I have with so many options so that the products_options_length and products_options_size have limits of 100. But no go.

Any clues on where to start looking?

Oh, and in split_page_results.php on or about line 25 there is an option to turn on debugging so you can see the sql that's being generated for the query if you didn't know already.

30 May 2012, 12:30 AM
#74
warroyo90 avatar

warroyo90

New Zenner

Join Date:
Jan 2012
Posts:
59
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

i am trying to use this plugin http://www.zen-cart.com/downloads.php?do=file&id=1361 which is great by the way on my store with 1.3.9g. but it gives an error on the product listing pages about an unknow field m.manufacturer_name.

has anyone been able to use this with 1.3.9g?

30 May 2012, 12:41 AM
#75
warroyo90 avatar

warroyo90

New Zenner

Join Date:
Jan 2012
Posts:
59
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

here is the error...
1054 Unknown column 'm.manufacturers_name' in 'field list'
in:
[SELECT DISTINCT p.products_model, m.manufacturers_name, p.products_image, pd.products_name, 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 = '449' GROUP BY p.products_id order by p.products_sort_order, pd.products_name]

30 May 2012, 2:30 AM
#76
warroyo90 avatar

warroyo90

New Zenner

Join Date:
Jan 2012
Posts:
59
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

alright I found the fix for this the plugin is still a bit shaky for 1.3.9g especially with the css it doesnt match my template at all...

in the file override includes/index_filters/YOURTEMPLATE/default_filter.php

find lines 113-127 this sql query that is built in here calls for the m.manufacturers_name field but it never specifies the manufacturers tables in the join statements.

add this

" LEFT JOIN " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id" .

right below this

  " LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id" .

and your all set .

5 Jun 2012, 7:44 PM
#77
jeking avatar

jeking

Totally Zenned

Join Date:
Oct 2005
Location:
Chicago, IL USA
Posts:
1,592
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Great add-on! But, is it possible for it to use the sort order of the option Name? It seems to sort alphabetically with no way to change it.

Jim
Wheaton Website Services

6 Jun 2012, 10:09 PM
#78
jeking avatar

jeking

Totally Zenned

Join Date:
Oct 2005
Location:
Chicago, IL USA
Posts:
1,592
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Bump. Hoping damiantaylor sees this to respond. Thanks!

Jim
Wheaton Website Services

8 Jun 2012, 5:48 PM
#79
shopsfm avatar

shopsfm

New Zenner

Join Date:
Jan 2012
Location:
California
Posts:
36
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

I just installed "Dynamic Filter v1.0" It works in the back end the lay out box control is active and Conf>dynamic filter is on.
But It dosent show up on the front page.
I want to filter categories and sub-categories (for now) I downloaded the new version of Jquery and renamed it 'jscript_jquery-1.4.0.min.js'. as stated in the instructions.

can anyone help?
website Corvetteanything.com

"THANK YOU" to all the contributors for the help.
Current site we are working on is
SFM Auto Parts

8 Jun 2012, 10:42 PM
#80
sph avatar

sph

Totally Zenned

Join Date:
Jan 2006
Posts:
1,556
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

This mod?

http://www.zen-cart.com/downloads.php?do=file&id=1361

It is now version 1.1

Just last evening I installed it on my main demo site here:

http://www.webdivision.prommart.com/zencart-demo/index.php?main_page=index&cPath=65_66

I took you straight to the filter's page, as it does not show on the homepage and only in categories with products. This is a subcategory with products, so it shows.

Prior to this, I installed the Dynamic Filter on yet another test site with the Rubik template. This is a more sophisticated template - like your TM template probably is - and it busted some pages. Perhaps if I can merge better I can get it working.

My first link where it does work required no merging.

You might also get more help if you post in the Other Contributions Sideboxes forum, where this mod has been more active.

BTW, I don't recall having to download anything special.

Steve
prommart.com