Zen cart installation / maintenance / customisation / hosting
Supported Modules: Dutch language pack, Multi site, Dynamic Price Updater and more.
I've been running version 1.0 of this filter (with some issues as it doesn't work or look quite right) on a manually installed ver 1.51 of Zencart. Now that I see there's an upgrade, are there any specific upgrading instructions? I searched this thread with no results. Thank you
any chance a working version of this mod will be released? I can't seem to get this to work like at all. Everything about it breaks. Error logs fill up with everything from improper use of php functions to missing table names in queries. The sidebox breaks and all other sidebox contents end up all over the main page.
What a major let down.
So still working on this mod from time to time, but lacking the time to fish it up.
But I wanted to at least show you this update.
I did by accident more or less discover how to change the number of filtered products shown between the brackets.
If you search in file includes/templates/YOUR_TEMPLATE/sideboxes/tpl_dynamic_filter.php.
and change
toPHP Code:
htmlspecialchars(html_entity_decode($attributes->fields['quantity'], ENT_QUOTES))
the number also changes to the number of products left on which to filter.PHP Code:
htmlspecialchars(html_entity_decode($attributes->fields['flag'], ENT_QUOTES))
You can see it in action here
Zen cart installation / maintenance / customisation / hosting
Supported Modules: Dutch language pack, Multi site, Dynamic Price Updater and more.
Well done! Such a seemingly simple change for such a big effect. Thank you.
(For some reason the number of products left does not decrease on one of my attributes - it actually increases, I'll need to dig deeper on that one)
Hello, Will this dynamic filter work under ZenCart 1.5.4?
If yes, can you please provide me with a download link?
Thank you very much,
Admir M.
Sucess is the Sum of Small Efforts
It will work with 1.5.4. You can download the latest version of the module and use the file set for Zen Cart 1.5.1
except for the file includes/functions/functions_general.php. There you will need to make only 1 small change
find:
and replace withPHP Code:
function zen_get_all_get_params($exclude_array = 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)) {
if (!in_array($key, $exclude_array)) {
if (!is_array($value)) {
if (strlen($value) > 0) {
$get_url .= zen_sanitize_string($key) . '=' . rawurlencode(stripslashes($value)) . '&';
}
} else {
foreach(array_filter($value) as $arr){
$get_url .= zen_sanitize_string($key) . '[]=' . rawurlencode(stripslashes($arr)) . '&';
}
}
}
}
}
while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);
while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);
return $get_url;
}
PHP Code:
function zen_get_all_get_params($exclude_array = 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 1
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 dynamic filter 1 of 1
if (!is_array($value)) {
if (strlen($value) > 0) {
$get_url .= zen_sanitize_string($key) . '=' . rawurlencode(stripslashes($value)) . '&';
}
} else {
foreach(array_filter($value) as $arr){
$get_url .= zen_sanitize_string($key) . '[]=' . rawurlencode(stripslashes($arr)) . '&';
}
}
}
}
}
while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);
while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url);
return $get_url;
}
Zen cart installation / maintenance / customisation / hosting
Supported Modules: Dutch language pack, Multi site, Dynamic Price Updater and more.
Design75 ... do you mind if I challenge that?
I'm thinking that code change is redundant. Can you help me understand what I'm missing?
Note the things I've highlighted below, as I think your suggested code change is duplicating what's already in that function's logic:
My point is really: if no changes are needed, then it's better not to touch the file.Code:function zen_get_all_get_params($exclude_array = 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 1 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 dynamic filter 1 of 1 if (!is_array($value)) { if (strlen($value) > 0) { $get_url .= zen_sanitize_string($key) . '=' . rawurlencode(stripslashes($value)) . '&'; } } else { foreach(array_filter($value) as $arr){ $get_url .= zen_sanitize_string($key) . '[]=' . rawurlencode(stripslashes($arr)) . '&'; } } } } } while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url); while (strstr($get_url, '&&')) $get_url = str_replace('&&', '&', $get_url); return $get_url; }
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
I must admit I do not fully understand the code , but just compared old 1.5.1 and new 1.5.4 vanilla files end the code from the mod.
This was the line that was left after comparing, but is you say it is not needed, (and after some better reading of that code block) I agree it seems unnecessary.
I am going to test it right now, and will report back.
Zen cart installation / maintenance / customisation / hosting
Supported Modules: Dutch language pack, Multi site, Dynamic Price Updater and more.
Thank you for pointing this out. I received a "403 page not found" error when selecting price as part of the filter. I searched high and low over the last week or so to see if I could find a solution but to no avail. After seeing this post over the weekend, I contacted my host this morning and they made some changes on their side and voila, the price filter is working again.
Power to the people that support community based projects!
Bookmarks