-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
ItemZone on product detail is not set correctly when chaning products via related/upsell products list #9562
Comments
Confirmed, we experience the same problem and this causes the wrong price to be displayed in Google ads because wrong data is being stored in the cache and this causes the price of one of the related products to be displayed in the google ads instead of the actual product price. I'll debug a little bit further and see if there is a better solution then turning of the caching of the final price box. |
This seems to fix it, not exactly sure if this is the correct approach though: diff --git a/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php b/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php
index bab93e08f27..659c0129430 100644
--- a/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php
+++ b/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php
@@ -198,6 +198,7 @@ class FinalPriceBox extends BasePriceBox
$cacheKeys = parent::getCacheKeyInfo();
$cacheKeys['display_minimal_price'] = $this->getDisplayMinimalPrice();
$cacheKeys['is_product_list'] = $this->isProductList();
+ $cacheKeys['zone_type'] = $this->getZone();
return $cacheKeys;
} Tested on Magento 2.1.6 |
Ok, I dug in a bit further and discovered this bug is already fixed on the develop branch. I then tried to figure out in what commit it was fixed, which took me a couple of hours, and found out it was fixed by a commit which fixes another issue, around currencies on product prices. So it can indeed be fixed by setting the cache lifetime to If I apply the above commit on Magento 2.1.7, it looks like it fixes the issue. I'll look into backporting MAGETWO-59089 to the 2.1-develop branch, to try to include this fix in one of the next minor 2.1.x releases. |
@juhanix Created internal issue MAGETWO-69655 to investigate and track this issue. |
Internal ticket to track issue progress: MAGETWO-69665 |
Similar seems to be happening for me with grouped products. If I visit a grouped product the child products seem to be cached with the "item_list" zone causing issues with rendering of price on the child products when they are later visited on their specific product page. These then show "item_list" instead of "item_view". @hostep solution works for fixing the issue. Have not started properly debugging on vanilla instance however. |
Thanks @hostep I was going crazy with this issue, 2 months looking for a solucion and I find this ticket! Thank you very much, this happend to me on magneto 2.4.2-p2 |
Preconditions
Steps to reproduce
1.1. add
echo $block->getZone();
on line 25 (or some other line, as you like)2.1. Product B also has Product A listed/marked as related or upsell product
3.1. main product: product A item_zone = "item_view"
3.2. upsell/related product: product B item_zone = "item_list"
3.3. everything is fine, this is how it should be
4.1. main product: product B item_zone = "item_list"
4.2. upsell/related product: product A item_zone = "item_view"
4.3. this is not how it should be
5.1. main product: product B item_zone = "item_view"
5.2. upsell/related product: product A item_zone = "item_list"
5.3. everything is fine, this is how it should be
5.4. visiting Product A detail page and everything is wrong again
Expected result
Actual result
UPDATE
so I checked if currently registered ProductID is the same productID as file vendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml outouts in line 14
$this->_coreRegistry->registry('current_product');
gives me always the productID from the first product page I visit.so I added following to vendor/magento/module-catalog/Pricing/Render/FinalPriceBox.php
public function getCacheLifetime() { return null; }
seems to work fine after this
The text was updated successfully, but these errors were encountered: