This issue has been migrated from the Forge. Read the original ticket here.
I have 2 shops. Lets call them SHOP A and SHOP B.
Both shops share everything including products and their combinations.
Every time i click the button to rebuild attribute index, or when the cron-job runs, the attributes on all shops but the current shop context stops working (they are truncated and never re-added)
(/modules/ps_facetedsearch/ps_facetedsearch-attribute-indexer.php?token=)
In other words, you are not able to filter products by size/color etc. for聽more than one shop - even when having multishop enabled (it dissapears for the rest of the shops. You can even run the cron job on each context to verify, that the checkboxes follows around, and stops working on the other shops).
You may check the database table ps_layered_product_attribute. Even though there are multiple shops, only attributes with same shop_id is indexed (should contain multiple shop_id's).
The fix is easy. You have a simple error in the ps_facetedsearch.php file (the indexAttribute method).
The method starts by trunctating the whole ting. Therefore i guess you want to index all shops on each run. If so, it is wrong to have the following present in the SELECT statement:
Shop::addSqlAssociation('product_attribute', 'pa').'
(this will limit the query to only return attributes from the current shop context (typically number one), and not all the others.
Im not sure if the best fix is simply swapping that line out with the below one (but it sure works). I leave it up to you to make it elegant:)
INNER JOIN '._DB_PREFIX_.'product_attribute_shop AS product_attribute_shop ON product_attribute_shop.id_product_attribute = pa.id_product_attribute
(you may want to also check if multishop is even enabled at first?)
This comment has been migrated from the Forge. Read the original comment here.
Hi Morten,
Would you be willing to make a pull request on GitHub with your code suggestion?
https://github.com/PrestaShop/PrestaShop/tree/develop
Thank you!
Best regards, Khouloud
This comment has been migrated from the Forge. Read the original comment here.
Hi Morten,
I manage to reproduce the issue with the last version 1.7.3.0 and the ps_facetedsearch module v2.1.1 - by PrestaShop
We will see how to fix it.
Best regards, Khouloud
This comment has been migrated from the Forge. Read the original comment here.
I have two stores (on PS 1.7.4.1). When you add a product in any store, the Attributes are only displayed if they are linked to the store id = 1 (default)
This comment has been migrated from the Forge. Read the original comment here.
Hi Oleg,
Your issue is a duplicate of http://forge.prestashop.com/browse/BOOM-5731
Please, follow BOOM-5731.
Thanks!
Best regards, Khouloud
@khouloudbelguith Could you try to reproduce the issue with the last version of facetedsearch ?
Hi @marionf,
I did not manage to reproduce the issue with PS1.7.6.3 & ps_facetedsearch v3.4.1.
https://drive.google.com/file/d/1yipH0qX8V33FSpRbiRqFWqmEp23-wU5G/view
I will close the issue.
Thanks!
Thank you @khouloudbelguith