Page 2 of 2
Re: Multiple Specifications as Filters
Posted: 28 May 2025, 09:35
by itn-ms
Hi Jan,
the Search And Filter Options are also at their default.
I changed the filter options for specifications from any to all:
https://i.imgur.com/a/bxByfln
So the behaviour I would expect (and need) for example in your case is, that the Coat is not shown because it is not blue. The Cleaner should only be shown if it is blue AND the packaging convenient. If I have no products that fulfill every filter criteria, no product should be shown.
When I leave the filter options to Any, everything works as expected, as I get more and more products the more filters I activate - but I want the opposite behaviour; which I thought must be the option all, which is not working as expected for me.
Kind regards,
Marco
Re: Multiple Specifications as Filters
Posted: 31 May 2025, 01:13
by Jan
Hi, thank you very much for the detailed info, now I understand and seems I found the problem, if you are able to edit files on your server, go to:
administrator/components/com_phocacart/libraries/phocacart/search/search.php
and on line cca 441 change
FROM:
Code: Select all
if (I18nHelper::isI18n()) {
$where .= " INNER JOIN #__phocacart_specifications AS s2bx" . $i . " ON s2x" . $i . ".product_id = s2x" . $i . ".product_id AND " . $v;
} else {
$where .= " INNER JOIN #__phocacart_specifications AS s2x".$i." ON s2x" . $i . ".product_id = s2x".$i.".product_id AND ". $v;
}
TO:
Code: Select all
if (I18nHelper::isI18n()) {
$where .= " INNER JOIN #__phocacart_specifications AS s2bx" . $i . " ON s2x0.product_id = s2x" . $i . ".product_id AND " . $v;
} else {
$where .= " INNER JOIN #__phocacart_specifications AS s2x".$i." ON s2x0.product_id = s2x".$i.".product_id AND ". $v;
}
This should solve the problem with "All" - only items which will have all selected parameters will be displayed.
Let me know if this works for you.
Jan
Re: Multiple Specifications as Filters
Posted: 02 Jun 2025, 12:42
by itn-ms
Hi Jan,
thanks for your efforts!
I replaced the mentioned code - now it partly works:
The items are filtered so only products where all filters are true are shown but there's still the issue, that only the last filter of the URL is used.
In my test-site I checked Packaging = Eco, Color = Blue and Flavour = Apple, Pear - only the Flavour-filters are used, also shown in the resulting sql:
Code: Select all
.. AND a.id IN (
SELECT
s2x0.product_id
FROM
b2h05_phocacart_specifications AS s2x0
INNER JOIN b2h05_phocacart_specifications AS s2x1 ON s2x0.product_id = s2x1.product_id
AND s2x1.alias = 'flavour'
AND s2x1.alias_value = "pear"
WHERE
s2x0.alias = 'flavour'
AND s2x0.alias_value = "apple"
)
GROUP BY..
The filters in the URL are:
https://imgur.com/a/DjfOEHL
The filtered products for the flavour are now after the code change correct
Kind regards,
Marco
Re: Multiple Specifications as Filters
Posted: 03 Jun 2025, 15:38
by Jan
Hi,
try to reinstall with 5.1.1Beta2:
https://github.com/PhocaCz/PhocaCart/re ... 1Beta2.zip
and let me know.
Jan
Re: Multiple Specifications as Filters
Posted: 04 Jun 2025, 10:41
by itn-ms
Hi Jan,
thank you, the filters now work properly
Kind regards,
Marco