concretecms-community-store / community_store

An open, free and community developed eCommerce system for Concrete CMS
https://concretecms-community-store.github.io/community_store/
MIT License
106 stars 66 forks source link

Adding a new product list filter - Undefined variable $groupMatchAny #709

Closed mdius closed 1 year ago

mdius commented 1 year ago

This happens on my fresh install and my test site. But when I try to add a new product filter I get the following error.

Undefined variable $groupMatchAny

/packages/community_store/blocks/community_product_filter/edit.php(92): Whoops\Exception\ErrorException->null

Putting the following just before that line seems to fix it.

<?php if (!isset($groupMatchAny)) {
    $groupMatchAny = '';
} ?>

Also, I get an error on my test site. It appears to be if you delete an attribute before removing it from your filter, it causes the following error. It does not cause the error if I switch it to PHP 7.4.

Undefined array key 103

/packages/community_store/blocks/community_product_filter/edit.php(182): Whoops\Exception\ErrorException->null

I have not found a way to fix this yet.

mdius commented 1 year ago

On there second part, I changed line 182 from:

echo '<li data-id="' . ($selectedatt['akID'] > 0 ? $selectedatt['akID'] : $selectedatt['type']) . '" data-type="' . $selectedatt['type'] . '" class="clearfix list-group-item"><a href="#" class="attremove pull-right float-end">&nbsp;&nbsp;<i class="fa fa-times"></i></a><i class="fa fa-arrows-v fa-arrows-alt-v"></i>&nbsp;&nbsp;' . ($selectedatt['type'] == 'attr' ? $attlookup[$selectedatt['akID']] : $typelookup[$selectedatt['type']]);

To

echo '<li data-id="' . ($selectedatt['akID'] > 0 ? $selectedatt['akID'] : $selectedatt['type']) . '" data-type="' . $selectedatt['type'] . '" class="clearfix list-group-item"><a href="#" class="attremove pull-right float-end">&nbsp;&nbsp;<i class="fa fa-times"></i></a><i class="fa fa-arrows-v fa-arrows-alt-v"></i>&nbsp;&nbsp;' . ($selectedatt['type'] == 'attr' ? empty($attlookup[$selectedatt['akID']]) ? '<b>DELETE *Removed Attributes* DELETE</b>' : $attlookup[$selectedatt['akID']] : $typelookup[$selectedatt['type']]);
Mesuva commented 1 year ago

I believe this one has been fixed in the master branch