Re: Dynamic Filter - filter does not work on product listing
Quote:
Originally Posted by
Design75
Sorry to tell you, but currently the one column feature is not yet supported by this module. It is on my (very long) to do list, but I really can't promise any time frame. I you are haing some spare time, feel free to help with this module, and I'll add your code to it.
I've managed to get this mod to play happily with some responsive templates (stirling grand and westminster new) by using javascript to toggle the dynamicfilterContent on smaller responsive displays (I'm using max-width:767px).
Is this something you've got planned for the next release? If not, and you think it's worth it, would it help if I package it up and send it you for including in the mod?
Re: Dynamic Filter - filter does not work on product listing
Quote:
Originally Posted by
simon1066
I've managed to get this mod to play happily with some responsive templates (stirling grand and westminster new) by using javascript to toggle the dynamicfilterContent on smaller responsive displays (I'm using max-width:767px).
Is this something you've got planned for the next release? If not, and you think it's worth it, would it help if I package it up and send it you for including in the mod?
Greetings simon1066,
I would be interested in your mods for the westminster new template!
BTW, would you know how to only show the dynamic filter sidebox if there are products with attributes in a given category? It seems to display regardless and when there are no filters to list in the sidebox, it breaks the template layout!
Thanks!:D
Re: Dynamic Filter - filter does not work on product listing
Quote:
Originally Posted by
kwright
Greetings simon1066,
I would be interested in your mods for the westminster new template!
BTW, would you know how to only show the dynamic filter sidebox if there are products with attributes in a given category? It seems to display regardless and when there are no filters to list in the sidebox, it breaks the template layout!
Thanks!:D
Hi, what I can do is to deactivate the sidebox for a given category - is that what you are looking for?
I found it useful for document_general product category types - my template broke aswell!
Re: Dynamic Filter - filter does not work on product listing
Quote:
Originally Posted by
simon1066
Hi, what I can do is to deactivate the sidebox for a given category - is that what you are looking for?
I found it useful for document_general product category types - my template broke aswell!
Yes, but only for the categories that have products with no attributes! It seems that the default function of the dynamic filter sidebox is to always show in categories with products regardless if they have attributes or not (shows empty sidebox with heading text).
I guess one would need to test if a given category has products with attributes and show the filter sidebox if true. Just don't know where or how to do this? Any suggestions? I'm sure others would like this feature as well!
Re: Dynamic Filter - filter does not work on product listing
Yes, I see what you mean, it would need a test to see if attributes are present. No doubt there's one hidden in the Zencart code somewhere. If you find it (or if you actually know the category that has no attributes) you can use this code to show/hide the sidebox for an 'if' statement
Replace the contents of includes/modules/sideboxes/YOUR_TEMPLATE/dynamic_filter.php with:
PHP Code:
<?php
/**
* dynamic_filter.php
*
*Zen Cart dynamic filter module
*Damian Taylor, March 2010
*
*/
if(FILTER_CATEGORY == 'Yes' && $current_page_base == 'index' && !$this_is_home_page && ($category_depth == 'products' || $category_depth == 'top') || FILTER_ALL == 'Yes' && $current_page_base == 'products_all' || FILTER_NEW == 'Yes' && $current_page_base == 'products_new' || FILTER_FEATURED == 'Yes' && $current_page_base == 'featured_products' || FILTER_SPECIALS == 'Yes' && $current_page_base == 'specials' || FILTER_SEARCH == 'Yes' && $current_page_base == 'advanced_search_result'){$show_dynamic_filter = true;
}
if ($cPath == '14'){
$show_dynamic_filter = false;}
if ($cPath == '6'){
$show_dynamic_filter = false;}
if ($show_dynamic_filter == true) {
require($template->get_template_dir('tpl_dynamic_filter.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_dynamic_filter.php');
$title = BOX_HEADING_FILTER;
$title_link = false;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
}
?>
You can either change the [if ($cPath == '??')] value to your category or replace that code with the magical attribute test we've yet to find.
Re: Dynamic Filter - filter does not work on product listing
Quote:
Originally Posted by
simon1066
Yes, I see what you mean, it would need a test to see if attributes are present. No doubt there's one hidden in the Zencart code somewhere. If you find it (or if you actually know the category that has no attributes) you can use this code to show/hide the sidebox for an 'if' statement
Replace the contents of includes/modules/sideboxes/YOUR_TEMPLATE/dynamic_filter.php with:
PHP Code:
<?php
/**
* dynamic_filter.php
*
*Zen Cart dynamic filter module
*Damian Taylor, March 2010
*
*/
if(FILTER_CATEGORY == 'Yes' && $current_page_base == 'index' && !$this_is_home_page && ($category_depth == 'products' || $category_depth == 'top') || FILTER_ALL == 'Yes' && $current_page_base == 'products_all' || FILTER_NEW == 'Yes' && $current_page_base == 'products_new' || FILTER_FEATURED == 'Yes' && $current_page_base == 'featured_products' || FILTER_SPECIALS == 'Yes' && $current_page_base == 'specials' || FILTER_SEARCH == 'Yes' && $current_page_base == 'advanced_search_result'){$show_dynamic_filter = true;
}
if ($cPath == '14'){
$show_dynamic_filter = false;}
if ($cPath == '6'){
$show_dynamic_filter = false;}
if ($show_dynamic_filter == true) {
require($template->get_template_dir('tpl_dynamic_filter.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_dynamic_filter.php');
$title = BOX_HEADING_FILTER;
$title_link = false;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
}
?>
You can either change the [if ($cPath == '??')] value to your category or replace that code with the magical attribute test we've yet to find.
OK, I see now. Most likely would want to test since I have several categories that currently don't have any attributes, but may in the future. Also, by testing, would make the dynamic filter more universal for others. May be add an admin switch to not show sidebox when products with no attributes in a category exist.
I'll work on this to see what I can come up with. Also, still interested in your responsive mods if you have them available!
Thanks,
kwright
Re: Dynamic Filter - filter does not work on product listing
Sounds good, adding an admin switch might be a bit beyond me though.
I'll put together a quick and dirty post on the responsive layout. I have found that there might still be a bit of work to finalise it - mainly that the filter collapses once an attribute is selected and it needs to be opened again to select another, you'll see what I mean though. I'll do it now and post shortly.
1 Attachment(s)
Re: Dynamic Filter - filter does not work on product listing
Responsive template mods - this should put an expandable 'filter button' at the top of the product listing page on displays less than 767px width.
---------------------------------------
in includes/templates/YOUR_TEMPLATE/sideboxes/tpl_dynamic_filter.php
replace:
PHP Code:
// draw filter form
$content = '';
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';
$content .= zen_draw_form('product_filter_form','', 'get');
with:
PHP Code:
// draw filter form
$content = '';
$content .= '<div id="filterToggle"><a href="javascript:;" onclick="toggle_visibility(\'dynamicfilterContent\');">' . zen_image_button(BUTTON_IMAGE_TOGGLE_FILTER, BUTTON_TOGGLE_FILTER_ALT, 'class="listingBuyNowButton"') . '</a></div>';
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';
$content .= zen_draw_form('product_filter_form','', 'get');
----------------------------------------
in your responsive.css or responsive_default.css file (depending on the template used) add under the @media (max-width:767px) section add:
Code:
#dynamicfilter { display: block;visibility: visible;}
#dynamicfilterContent{display:none;}
#filterToggle {display: block;margin: 18px 0 0;}
#dynamicfilterHeading {display: none;}
in stylesheet.css add:
Code:
#filterToggle {display:none;}
----------------------------------------
in includes/languages/english/YOUR_TEMPLATE/button_names.php add:
PHP Code:
define('BUTTON_IMAGE_TOGGLE_FILTER', 'buttonimage.gif');
define('BUTTON_TOGGLE_FILTER_ALT', 'Filter results');
BUTTON_TOGGLE_FILTER_ALT as well as being the image alt tag is also used for the css button text.
BUTTON_IMAGE_TOGGLE_FILTER is an image file of the button if using images, if using css buttons this is not required but should be left blank like:
Code:
define('BUTTON_IMAGE_TOGGLE_FILTER', '');
---------------------------------------
in /includes/modules/pages/index add the attached jscript_toggle.js
Attachment 15441
----------------------------------------
and that's it.
Quote:
Originally Posted by
simon1066
... I have found that there might still be a bit of work to finalise it - mainly that the filter collapses once an attribute is selected and it needs to be opened again to select another, you'll see what I mean though.
Now I come to think about it might be acceptable or even desirable for the filter box to collapse on page refresh especially on small screens. It would be good to know what others think.
Re: Dynamic Filter - filter does not work on product listing
Thanks simon1066 for your help and mods!:clap:
Re: Dynamic Filter - Narrow Results By In Stock Products
Greetings,
Thinking it would be a good feature, I would like to add an additional "Narrow Results By Products In Stock" feature to the sidebox. Looking through the tpl_dynamic_filter.php file, I'm a bit confused as to where and how I would add this?
Code suggestions?
Thanks