magento2-FAQ icon indicating copy to clipboard operation
magento2-FAQ copied to clipboard

FAQs in group 10 also appear in group 1

Open boneyelbows opened this issue 2 years ago • 0 comments

Hello,

KirillRock reported this in the MarketPlace page for this module, but I don't see an issue here.

When we had 10 faqgroups, numbered 1 - 10, we found that when we displayed the faq page, group 1 showed faqs from both group 1 and group 10. Group 10 correctly showed only the faqs for group 10.

With the data below, on the faq page, group 1 displays all 14 FAQs listed below. Group 10 displays only FAQs 41-45.

mysql> select faq_id, left (title,20), `group` from prince_faq where `group` like '1%'  order by `group`;                                                       
+--------+----------------------+-------+
| faq_id | left (title,20)      | group |
+--------+----------------------+-------+
|      4 | When must course mat | 1     |
|      5 | What are the conditi | 1     |
|      7 | Can I return coursew | 1     |
|      8 | What are final sale  | 1     |
|     10 | How will I be refund | 1     |
|     34 | Returns/Exchanges    | 1     |
|     38 | Can I return an e-te | 1     |
|     46 | Fall 2020 Return/Exc | 1     |
|     49 | I cancelled /returne | 1     |
|     41 | How do I know what t | 10    |
|     42 | What do I do if ther | 10    |
|     43 | Where do I find digi | 10    |
|     44 | What do I do if ther | 10    |
|     45 | What do I do if a te | 10    |
+--------+----------------------+-------+
14 rows in set (0.00 sec)

Workaround

The work around was to create group 11 and move the faqs from group 1 to group 11, then delete/disable group 1. Now group 1 is not displayed, and groups 10 and 11 are selected using like '10%' and like '11%' respectively so they display correctly. (See below)

If we were to get to 20 groups, I would expect the faqs from group 20 to appear in group 2 and a similar work around would be required.

mysql> select faq_id, left (title,20), `group` from prince_faq where `group` like '10%'  order by `group`;   
+--------+----------------------+-------+
| faq_id | left (title,20)      | group |
+--------+----------------------+-------+
|     41 | How do I know what t | 10    |
|     42 | What do I do if ther | 10    |
|     43 | Where do I find digi | 10    |
|     44 | What do I do if ther | 10    |
|     45 | What do I do if a te | 10    |
+--------+----------------------+-------+
5 rows in set (0.00 sec)

mysql> select faq_id, left (title,20), `group` from prince_faq where `group` like '11%'  order by `group`;   
+--------+----------------------+-------+
| faq_id | left (title,20)      | group |
+--------+----------------------+-------+
|      4 | When must course mat | 11    |
|      5 | What are the conditi | 11    |
|      7 | Can I return coursew | 11    |
|      8 | What are final sale  | 11    |
|     10 | How will I be refund | 11    |
|     34 | Returns/Exchanges    | 11    |
|     38 | Can I return an e-te | 11    |
|     46 | Fall 2020 Return/Exc | 11    |
|     49 | I cancelled /returne | 11    |
+--------+----------------------+-------+
9 rows in set (0.00 sec)

Solution

Somewhere in the selection of the FAQs for each group, there appears to be a group like '1%' instead of group = '1'. This query should be identified and changed, or the setting of the relevant Magento collection object should be changed.

Thanks for making the module available. HTH Angus

boneyelbows avatar Nov 22 '21 21:11 boneyelbows