"Sort by" Section Disappears When Selecting "Price"

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
ahmad.rml
Posts: 6
Joined: 19 Feb 2024, 14:26

"Sort by" Section Disappears When Selecting "Price"

Post by ahmad.rml » 20 Aug 2024, 13:55

I encountered an issue. When users select the "Price" option in the "Sort by" functionality, the entire "Sort by" section disappears from the page.

Steps to Reproduce:

remove all mshop_index_price records

1. Navigate to the catalog page.
2. Click on the "Sort by" dropdown.
3. Select "Price" as the sort option.

Expected Behavior:
- The "Sort by" section should remain visible, with the "Price" option highlighted as active.

Actual Behavior:
- The entire "Sort by" section disappears, leaving no visible options to change the sort order.

Analysis:
Upon inspecting the PHP code, it appears the issue might be related to how the `$priceDir` variables is set and used in the conditional logic. Specifically, the issue could occur because the code doesn’t properly handle cases where the sort value is null or there’s no content to show. When the "Price" option is selected, this condition may cause the HTML for the "Sort by" section to fail to render.


---
vendor\aimeos\ai-client-html\templates\client\html\catalog\lists\pagination.php

laravel 10
php 8.2
aimeos 2023.10

User avatar
aimeos
Administrator
Posts: 8148
Joined: 01 Jan 1970, 00:00

Re: "Sort by" Section Disappears When Selecting "Price"

Post by aimeos » 22 Aug 2024, 10:13

If no products for the selected currency are found, then no products are returned and the total count is 0. This also removes the pagination including the sort options: https://github.com/aimeos/ai-client-htm ... #L147-L158
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

ahmad.rml
Posts: 6
Joined: 19 Feb 2024, 14:26

Re: "Sort by" Section Disappears When Selecting "Price"

Post by ahmad.rml » 23 Aug 2024, 09:43

I have two products that have a price, and they are available in the database index_price table. However, the total count is always returning 0. I checked the currency, and it is correct too.

User avatar
aimeos
Administrator
Posts: 8148
Joined: 01 Jan 1970, 00:00

Re: "Sort by" Section Disappears When Selecting "Price"

Post by aimeos » 24 Aug 2024, 15:11

Enable debug logging and check the conditions in the SQL statement:
https://aimeos.org/docs/2024.x/config/m ... /#loglevel
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply