-
-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix store id filter in catalogProductList
SOAP method
#2243
Fix store id filter in catalogProductList
SOAP method
#2243
Conversation
`addStoreFilter` in product collection does not apply store id filter if current store is admin, so changing it with `setStoreId` which works fine and it also used in REST Api.
I was checkin a little bit and run a snippet:
generates this query:
while this code:
generates this query: So I'm not sure shat's going on here... |
Woah, I have no idea either... I'll have to look into that when I get the time. |
@fballiano I did some digging to find what's going on. So the query that loads attributes is completely separate from the one you're getting from Here's what I get with original code ( SELECT `catalog_product_entity_varchar`.`entity_id`, `catalog_product_entity_varchar`.`attribute_id`, `catalog_product_entity_varchar`.`value`
FROM `catalog_product_entity_varchar`
WHERE (entity_type_id =4) AND (entity_id IN (231...905)) AND (attribute_id IN (71)) AND (store_id = 0) Here's with my change ( SELECT `t_d`.`entity_id`, `t_d`.`attribute_id`, `t_d`.`value` AS `default_value`, `t_s`.`value` AS `store_value`, IF(t_s.value_id IS NULL, t_d.value, t_s.value) AS `value`
FROM `catalog_product_entity_varchar` AS `t_d`
LEFT JOIN `catalog_product_entity_varchar` AS `t_s` ON t_s.attribute_id = t_d.attribute_id AND t_s.entity_id = t_d.entity_id AND t_s.store_id = 2
WHERE (t_d.entity_type_id = 4) AND (t_d.entity_id IN (231...905)) AND (t_d.attribute_id IN (71)) AND (t_d.store_id = 0) Notice the |
@elidrissidev are you saying your change is adding a JOIN? this would have a performance impact. arent there a way to fix it without additional join? |
@tmotyl That's how it works when filtering with |
@elidrissidev understood |
Description (*)
_applyProductLimitations
(called byaddStoreFilter
) in product collection does not applystore_id
filter ifcategory_id
andvisibility
filters are not set, so changing it withsetStoreId
which works fine and is also used in REST Api.magento-lts/app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php
Lines 1848 to 1852 in 2740724
Fixed Issues (if relevant)
Manual testing scenarios (*)
You can use the following snippet assuming product name is different from the one in default store:
Contribution checklist (*)