Good day Design75,
I'm back in town. Just wondering if you had a chance to look at adding a filter by In Stock items feature?
Thanks :D
Printable View
I have tried installing this plugin on a Zen Cart version 1.5.4
Have followed all the instructions in the documentation when setting it up. I was using Ultimate SEO URL's, so disabled it.
Still cannot get this to work. Any suggestions?
http://dev.vincoshooters.com/index.p...&cPath=442_737
Thank You
This the SQL query I ran to get the products filter to work.
Update `products` set `products_price_sorter` = `products_price` WHERE 1
Heeeeyyyy!
So I got it installed and working with only a few hiccups. One being the SQL install code not taking into consideration extra columns in my database. I had to add "NULL" to the end of each insert to get it in there and add the "zen_" prefix to the table names. Then using the git hub version of the plugin, it installed correctly and it didn't do that thing where it messes up the CSS in categories with no attributes.
But now I'm running into a funny bug.
You can see it yourself on this page: http://www.firstcallautosupply.com/f...ead-cap-screws
Let's say you try sorting it by bolt width #6. It looks great!
But try sorting it by bolt width 1/4", and you get no results.:huh:
What's weird is that this seems to only be a problem with the standard bolts, which obviously isn't the bolts fault.
Playing around with it just now, I think it's having a problem with the quotation mark. That seems to be the only constant when it's not showing results.
Could someone help me with a fix for this?
I tried on my test site this morning and all works as supposed.
I added an option value to one of the products wit a value of 4" , and when I filter on that value, 2 products(which i gave the attribute) show up.
After that I added a 1/4" attribute, and that where it get interesting, because all the attribute counts show up as 1, although the filtering still work as it should be. I will need to investigate this further.
This is working great except for one peculiarity.
Since installing it I can filter fine on existing attributes, however if I add new ones, and try to filter, the option is visible and the product count is correct but selecting the option returns no results?
Any idea why this might be the case? I suppose I could install it again but would rather not in case i've tweaked any files since.
And is there a way to prevent read only attributes from showing up?
Yes there is. And a similar thing was already in a test version for "text" and "file" types
locate includes/modules/sideboxes/YOUR_TEMPLATE/dynamic_filter.php and find the lines
and change them toPHP Code:
$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");
this eliminates file and text.PHP Code:
$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" : "") . "
AND po.products_options_type != '1'
AND po.products_options_type != '4'
GROUP BY po.products_options_name, pov.products_options_values_name
ORDER BY po.products_options_name, pov.products_options_values_sort_order");
If you want to add readonly to that list:
PHP Code:
$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" : "") . "
AND po.products_options_type != '1'
AND po.products_options_type != '4'
AND po.products_options_type != '5'
GROUP BY po.products_options_name, pov.products_options_values_name
ORDER BY po.products_options_name, pov.products_options_values_sort_order");