Multiple dynamic filters and 'trim()' error in filter.php (line 67)

  • Posts: 148
  • Thank you received: 21
  • Hikashop Business
2 years 11 months ago #337647

-- HikaShop version -- : 4.4.4
-- Joomla version -- : 4.0.4
-- PHP version -- : 8.0.12

Hi,

I had a lot of issues with the filters. (I think that I resolved those with the 'price range' filter).

I'm regularly facing to a similar problem that here : www.hikashop.com/forum/reports-statistic...given-in.html#337635
In my case it was not a warning but a blocking error ('Joomla 500 error' or 'trim() expects parameter 1 to be string[...]' after some changes).



With debug 'ON' :
[...]\components/com_hikashop/views/product/tmpl/filter.php on line 67



My page is unreachable but by editing random parameters, switching pages, etc., I manage to reset filters and my page is accessible again.

At this moment (and when I can access to my page), I try using 3 dynamic filters but when 1 filter is selected others are resetted.



And I dont understand why.

Do you have any solutions ? Thanks.


EDIT : Attachments (with the 3 filter settings) added

Attachments:
Last edit: 2 years 11 months ago by FDBI. Reason: EDIT : Attachments (with the 3 filter settings) added

Please Log in or Create an account to join the conversation.

  • Posts: 148
  • Thank you received: 21
  • Hikashop Business
2 years 11 months ago #337649

Hum...
I currently have better results.

I have for example changed 1 option for my 'price Range' filter :
--


--

My 3 dynamic filters work together except if I change the minimum price range (maximum is ok).

Last edit: 2 years 11 months ago by FDBI.

Please Log in or Create an account to join the conversation.

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
2 years 11 months ago #337656

Hi,

I've actually answered about the issue on the other thread with a patch:
www.hikashop.com/forum/reports-statistic...given-in.html#337641
I believe this will help you too.
Please download again the HikaShop install package on our website and install it on yours to get the patches mentionned on that other thread.
The reason why you have a blocking error while the other user only has a warning is because you're using PHP8 while he is on PHP7 and PHP8 is more strict.

Please Log in or Create an account to join the conversation.

  • Posts: 148
  • Thank you received: 21
  • Hikashop Business
2 years 11 months ago #337688

Hi,

I have seen this thread but I was not sure that my problem was exactly the same.

I have installed your new version and maybe that my error 'trim()' is gone, I'll keep you informed if not.

But when I increase my minimum 'price range' my other dynamic filters are again resetted.

Ficticious example :
I have products with colours black, white, and red. Red cost 1$; black and white 100$.
If I set my minimum price to 10$, all colours are displayed (including red) in my colour filter.

Notes :
- No problem with maximum
- If I ignore the 'price range' filter and select the red colour. My price range' filter is properly setted to 1$.

Last edit: 2 years 11 months ago by FDBI.

Please Log in or Create an account to join the conversation.

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
2 years 11 months ago #337703

Hi,

I would need screenshots of of the settings of your filters and the URL to the products listing with the filters on the frontend to check on the situation. Could you provide that ?

Please Log in or Create an account to join the conversation.

  • Posts: 148
  • Thank you received: 21
  • Hikashop Business
2 years 11 months ago #337750

This message contains confidential information

Please Log in or Create an account to join the conversation.

  • Posts: 148
  • Thank you received: 21
  • Hikashop Business
2 years 11 months ago #337758

Update :

I think that I have to do things differently :

To display all my variants (my need) and not a product with 'Options' button, it seems that solution is to add some custom fields restricted by categories.

Are the filters based of custom fields worked in the same way that characteristics ?
And maybe that in this case, it will work properly.

Please Log in or Create an account to join the conversation.

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
2 years 11 months ago #337783

Hi,

The filtering is done on the products not on the variants.
So if you have a product with several variants with different prices and you filter on a characteristic, as long as at least one variant match the product will keep being in the listing.
And since you have the the "dynamic display" setting activated in the filter, it will display the values of all the variants of all the filtered products. But it cannot filter out the values of the variants which wouldn't match for the other filters already selected. That would be too complex.
The only solution I can see would be to split the product into different products, one per variant of your current product.
And yes, in that case, it would make more sense to use custom product fields than characteristics.

The following user(s) said Thank You: FDBI

Please Log in or Create an account to join the conversation.

  • Posts: 148
  • Thank you received: 21
  • Hikashop Business
2 years 11 months ago #337891

Hi,

Thanks for your answer.

Using product fields instead of characteristics solved my issue. (on my first try and with similar settings).
I still believe that there is a problem with characteristics filters when we change the minimum price, but I no longer use them.

Please Log in or Create an account to join the conversation.

Time to create page: 0.082 seconds
Powered by Kunena Forum