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

Dynamic Filter [Support Thread]

Views: 652,516

Results 181 to 200 of 809
15 Jan 2013, 18:44
#181
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Dynamic Filter [Support Thread]

Fixed. All very weird, bit of a clash with something else I use that needs jquery but seems one needs to load before CSS and one after.. Also both seem to need different flavours of jquery? Which I'm confused about, I thought putting the most up to date would cover both??

17 Jan 2013, 23:56
#182
gameoverbeyond avatar

gameoverbeyond

New Zenner

Join Date:
May 2007
Posts:
41
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

I am attempting to install the Dynamic Filter 1.1 mod on my site, but with no success. I have the site running on a test server. I attempted an install on my modified site and then a backup of a clean (non modded) install and get the following error on both, with the good ol' blank page:

PHP Fatal error: Cannot redeclare zen_create_random_value() (previously declared in C:\server\xammp\xampp\htdocs\gameovergames\includes\functions\functions_general.php:626) in C:\server\xammp\xampp\htdocs\gameovergames\includes\functions\password_funcs.php on line 86

I looked at both files but I'm a newbie to php, (working on it :smile:), and am not sure where to start to resolve the issue. Is this something I can resolve with coding or is the mod just not compatible with Zen 1.5.1? If so I may downgrade to 1.5.0 as I'm in desperate need of a module such as this.

Any suggestions would be great!

19 Jan 2013, 21:43
#183
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Dynamic Filter [Support Thread]

boby:

Hi,
my dynamic filter works well when I search at "featured products" page, but when I search at other pages "products all, new products, categories, brands, and ..., that show error :

at top of page:

Warning: trim() expects parameter 1 to be string, array given in /home/o112445/public_html/includes/functions/functions_general.php on line 63

and at search results:
Warning: strlen() expects parameter 1 to be string, array given in /home/o112445/public_html/includes/functions/functions_general.php on line 153

can somebody help me ?

many thanks;

Can I bump this issue please, I'm suffering from it too.
I have used the Doc's solution posted here http://www.zen-cart.com/showthread.php?176804-Fixed-v1-5-1-PHP-Warning-strlen%28%29-expects-parameter-1-to-be-string/page4 for the issue ref line 153 but still can't resolve it for ref line 63.
Thanks

19 Jan 2013, 21:50
#184
picandnix avatar

picandnix

Totally Zenned

Join Date:
Dec 2010
Location:
UK
Posts:
1,780
Plugin Contributions:
2

Re: Dynamic Filter [Support Thread]

Hi folks.
As this thread appears to be supported the the clever maker of this handy mod I thought I mirror my issue here rather than duplicate posting.
If anyone gets a moment could you please have a quick look at my post here http://www.zen-cart.com/showthread.php?199006-dynamic-filter-problems-with-multilinguage-sites and the post that I have quoted from please as they too don't appear to have resolved.
Many thanks, and thanks for a great mod Damian.

20 Jan 2013, 08:59
#185
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

At first I panicked as I thought this wasn't working with URI Mappings, however, I realised it only works with pages that have Been set with a non zen cart urls.

Ultimately I guess this isn't a problem if I set all pages that have a filter with a CEON URL but interested to know if there is a work around so it works on both types?

Thanks in advance.

Phil

23 Jan 2013, 13:44
#186
crazycucumber avatar

crazycucumber

Zen Follower

Join Date:
Jan 2006
Posts:
403
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Hello "fancie" Phil
Glad you got it sorted - I too am using this addon but could not find an official support thread for it !

Have you worked out how to remove price ?
price isn't something i need my customers to search on - just all the attributes that I am adding to the products as a read only.

2nd on my wish list is to pull this from being a sidebox to include in the main page ( category page ) so it would dynamically change for each different category but in the main page rather than on a sidebox.

Other than that loving it - keep it up Phil !

23 Jan 2013, 13:56
#187
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

crazycucumber:

Hello "fancie" Phil
Glad you got it sorted - I too am using this addon but could not find an official support thread for it !

Have you worked out how to remove price ?
price isn't something i need my customers to search on - just all the attributes that I am adding to the products as a read only.

2nd on my wish list is to pull this from being a sidebox to include in the main page ( category page ) so it would dynamically change for each different category but in the main page rather than on a sidebox.

Other than that loving it - keep it up Phil !

Hello crazycucumber!

Pretty sure you can just remove the price code from the template though I havent tried it.. no sure if it need 'blank' entries when a query is submitted on the form or if it will just be as if none were selected.

as for having different things on different categories, I would suggest you use the normal functionality of sideboxes and use IF statements based on the currenty category id and wrap it around your various boxes.. same aplies for this though I guess, if it needs all to be visible it wont work.

so in

includes/templates/your_template/sideboxes/tpl_dynamic_filter.php

try commenting out this code:

/********************************************start price range link/check boxes***************************************************/
	if (count($priceArray) > 0) {
		$priceGap = floor(($max - $min) / (FILTER_MAX_RANGES - 1)); 
		if (FILTER_MIN_PRICE > 0 && $priceGap < FILTER_MIN_PRICE) $priceGap = FILTER_MIN_PRICE;
		if (FILTER_MAX_PRICE > 0 && $priceGap > FILTER_MAX_PRICE) $priceGap = FILTER_MAX_PRICE;
		
		$group = DYNAMIC_FILTER_PREFIX . str_replace(' ', '', DYNAMIC_FILTER_PRICE_GROUP);
		$resetParms[] = $group;
		$parameters = zen_get_all_get_params();
		$dropdownDefault = str_replace('%n', DYNAMIC_FILTER_PRICE_GROUP, DYNAMIC_FILTER_DROPDOWN_DEFAULT);
		$priceCount = 0;
		$prices = '';
		
		for ($start = $min - 0.5; $start < $max; $start = $end + 0.01) {
			$end = round($start + $priceGap);
			if ($end < $max) $text = $currency_symbol . round($start * $conversion_rate) . ' -- ' . $currency_symbol . round($end * $conversion_rate);
			else $text = $currency_symbol . round($start * $conversion_rate) . ' and over';
			foreach($priceArray as $price ){
			    if ($start <= $price && $end >= $price) {
					if (isset($_GET[$group]) && in_array($start . '--' . $end,$_GET[$group])) $linkClass = 'selected';
					else $linkClass = 'enabled';
					break;
				} else $linkClass = 'disabled';
			}
			
			$onClick = '';
			if (FILTER_GOOGLE_TRACKING != 'No') $onClick .= $trackingStart . '\'filterAction\', \'' . ($linkClass != 'selected' ? 'addFilter' : 'removeFilter') . '\', \'' . $pageName . ';' . DYNAMIC_FILTER_PRICE_GROUP . '=' . $start . '-' . $end . '\'' . $trackingEnd;
			if (FILTER_STYLE == 'Checkbox - Single') $onClick .= ' this.form.submit();';

			if (FILTER_METHOD != 'Hidden' || $linkClass != 'disabled') {
				$hrefLink = $group . '[]=' . $start . '--' . $end;
				switch(strtok(FILTER_STYLE, " ")) {
				case 'Checkbox':
					$prices .= '<li class="dFilterLink">' . zen_draw_checkbox_field($group . '[]', $start . '--' . $end, (isset($_GET[$group]) && in_array($start . '--' . $end,$_GET[$group]) ? true : false), ($linkClass == 'disabled' ? 'disabled="disabled"' : '') . ($onClick != '' && FILTER_STYLE == 'Checkbox - Single' ? ' onclick="' . $onClick . '"' : '')) . $text . '</li>';
					break;
				case 'Link':
					$prices .= '<li class="dFilterLink"><a class="' . $linkClass . '"' . ($linkClass != 'disabled' ? ' rel="nofollow" href="' . zen_href_link($_GET['main_page'], ($linkClass != 'selected' ? $parameters . $hrefLink : str_replace(array($hrefLink,'&'.$hrefLink), array("",""), $parameters)), 'NONSSL') . '"' . ($onClick != '' ? ' onclick="' . $onClick . '"' : '') : '') . ' >' . $text . '</a></li>';
					break;
				case 'Dropdown':
					$prices .= '<option value="' . $start . '--' . $end . '"' . ($linkClass == 'selected' ? ' selected="selected"' : '') . ($linkClass == 'disabled' ? ' disabled="disabled"' : '') . ($onClick != '' && FILTER_STYLE == 'Dropdown - Single' ? ' onclick="' . $onClick . '"' : '') . ' >' . $text . '</option>';
					break;
				}
			}
			++$priceCount;
		}
		
		$content .= '<hr width="90%" size="0" />';
		$content .= '<div><div class="dFilter"><p class="dFilterHeading">' . DYNAMIC_FILTER_TEXT_PREFIX . DYNAMIC_FILTER_TEXT_PRICE . DYNAMIC_FILTER_TEXT_SUFFIX . '</p>';
		if (isset($_GET[$group]) && array_filter($_GET[$group])) $content .= '<div class="dFilterClear"><a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array($group)), 'NONSSL') . '">' . zen_image(DIR_WS_TEMPLATE_IMAGES . 'clear_filter.png', DYNAMIC_FILTER_BUTTON_CLEAR_FILTER_ALT) . '</a></div>';
		if (strtok(FILTER_STYLE, " ") == 'Dropdown') $content .= '<select name="' . $group . '[]" class="dFilterDrop"' . (FILTER_STYLE == 'Dropdown - Single' ? ' onchange="this.form.submit();"' : '') . '>' . '<option value=""' . (!isset($_GET[$group]) || !array_filter($_GET[$group]) ? ' selected="selected"' : '') . '>' . $dropdownDefault . '</option>';
		else $content .= '<ul' . ($priceCount > FILTER_MAX_OPTIONS ? (FILTER_OPTIONS_STYLE == 'Scroll' ? ' class="dFilterScroll">' : ' class="dFilterExpand">') : '>');
		$content .= $prices;
		if (strtok(FILTER_STYLE, " ") == 'Dropdown') $content .= '</select>';
		else $content .= '</ul>';
		if (FILTER_OPTIONS_STYLE == 'Expand' && $priceCount > FILTER_MAX_OPTIONS) $content .= '<a class="dFilterToggle" href="#">More' . zen_image(DIR_WS_TEMPLATE_IMAGES . 'arrow_more.gif', 'More', '', '', 'class="dFilterToggleImg"') . '</a>';
		$content .= '</div></div>';
	}
		
/********************************************end price range link/check boxes***************************************************/

not tried and tested, so back up beofre you try..

23 Jan 2013, 14:14
#188
crazycucumber avatar

crazycucumber

Zen Follower

Join Date:
Jan 2006
Posts:
403
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Nope that broke the whole addon -

I just changed the first line to

    if (count($priceArray) [B]<[/B] 0) { 

so it is never true ! Seems to work.

23 Jan 2013, 14:50
#189
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

crazycucumber:

Nope that broke the whole addon -

I just changed the first line to

if (count($priceArray) [B]<[/B] 0) { 
> 
> so it is never true ! Seems to work.

that'll do it ;)
23 Jan 2013, 14:52
#190
crazycucumber avatar

crazycucumber

Zen Follower

Join Date:
Jan 2006
Posts:
403
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Now if I could get that info to appear where the category description normally sits , I would be on to a winner !

23 Jan 2013, 14:55
#191
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

you should be able to include that file in the category template file where you want it, but you would need to do alot of style changin as assumably it will go from being vertical to horizantal?

03 Feb 2013, 20:39
#192
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Hope someone can help.

I thought all was going fine with dynamic filter.. well it kinda is as nothing is breaking as such front end but I am getting the following error throwing and hoping someone may be able to make sense of it?

the error is:

[03-Feb-2013 19:04:19 UTC] PHP Warning: strlen() expects parameter 1 to be string, array given in /home/website/public_html/includes/functions/functions_general.php on line 156

the code its referring to is:

// 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

Anyone know if this is a known bug? any one know how I can fix it?

Many Thanks

Phil

03 Feb 2013, 21:25
#193
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Blimey I think I fixed it!

where I had merged the older functions_general.php file with the new, I commented this:

if (is_array($value) || in_array($key, $exclude_array)) continue;

it was just above the line that was throwing the error! with that in place it now doesnt error!

:laugh:

11 Feb 2013, 20:13
#194
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

oh nooooo. just realised although this seemed to stop the errors building up its now stopped the filter working when you navigate to page 2 of the results!!! anyone able to suggest anything??

12 Feb 2013, 19:16
#195
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

This is kinda neat as it is a little annoying (to me at least) that manufacturers do not have sort orders and there fore can not be listed as per a sort order by default.

so if you're like me, here is a neat little fix that allows you to either sort ALL your manufactures of simply just bring a few to the top of the list (without having to rename them.)

lets assume that you have manufactures id's 1-5

  1. Ford
  2. Vauxhall
  3. Audi
  4. Seat
  5. Honda

when displayed they will show in this order:
3. Audi

  1. Ford
  2. Honda
  3. Seat
  4. Vauxhall

but what if you wanted to have Honda at the top followed by Ford and then everything else..

here's how...

backup includes/templates/YOUR_TEMPLATE/templates/tpl_dynamic_filter.php

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

find this:
```php
$manufacturers = $db->Execute("SELECT manufacturers_id, manufacturers_name, IF(manufacturers_id IN(" . implode(',', $filteredManufacturers) . "), 'Y', 'N') as flag" .
" FROM " . TABLE_MANUFACTURERS .
" WHERE manufacturers_id IN (" . implode(',', $unfilteredManufacturers) . ")" .
" ORDER BY manufacturers_name");

and replace with this:
			```php
	$manufacturers = $db->Execute("SELECT manufacturers_id, manufacturers_name, IF(manufacturers_id IN(" . implode(',', $filteredManufacturers) . "), 'Y', 'N') as flag" .
			 	" FROM " . TABLE_MANUFACTURERS . 
		 	    " WHERE manufacturers_id IN (" . implode(',', $unfilteredManufacturers) . ")" .
				" ORDER BY FIELD(manufacturers_id,1,5) DESC");

so notice how we are replacing the standard ORDER BY manufacturers_name and now replacing it with
ORDER BY FIELD(manufacturers_id,1,5) DESC

by doing this we are able to specify the field we wish to sort by, in this case manufacturers_id and then we specify the order starting with the one you want at the very top furthest away.

so in this format:

ORDER BY FIELD({FEILD ID},{forth...},{third},{second},{first}) DESC

so now the order would be:

  1. Honda
  2. Ford
    followed by the rest..

Hope someone finds this of use! :smile:

23 Feb 2013, 04:55
#196
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

It works, then it fails to function after clicking to test for filters. I get the white page.

I am getting the following error message:
[22-Feb-2013 21:50:56] PHP Fatal error: Cannot redeclare zen_create_random_value() (previously declared in
/home/content//html//cart/includes/functions/functions_general.php:626) in
/home/content/
/html//cart/includes/functions/password_funcs.php on line 86
Any idea where it's coming from?

23 Feb 2013, 05:03
#197
drbyte avatar

drbyte

Sensei

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

Re: Dynamic Filter [Support Thread]

Kevin205:

I am getting the following error message:
[22-Feb-2013 21:50:56] PHP Fatal error: Cannot redeclare zen_create_random_value() (previously declared in
/home/content//html//cart/includes/functions/functions_general.php:626) in
/home/content/
/html//cart/includes/functions/password_funcs.php on line 86
Any idea where it's coming from?
Ya. It's coming from the fact that those 2 files were updated in v1.5.1 but you've replaced one of them with an older version, presumably because your addon was made for something older than v1.5.1.

23 Feb 2013, 05:27
#198
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

Files were copied from the folder called "Installation for Zen Cart version 1.5.0" of mod "Dynamic Filter v1.0"

Is this mod not compatible with 1.5.1?

23 Feb 2013, 05:32
#199
drbyte avatar

drbyte

Sensei

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

Re: Dynamic Filter [Support Thread]

Kevin205:

Files were copied from the folder called "Installation for Zen Cart version 1.5.0" of mod "Dynamic Filter v1.0"

Is this mod not compatible with 1.5.1?
Based on your posts, evidently not.
To make it compatible will require doing some re-merging and updating of files to work correctly with the new version.

23 Feb 2013, 06:25
#200
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Dynamic Filter [Support Thread]

OK. I will merge the following with my previous files.

includes/functions/functions_general.php
includes/functions/password_funcs.php

and will let you know.

Apparently no one else has issues with Zen 1.5.1 and "Dynamic Filter v1.0"!