Closed
Description
Preconditions
- Magento 2.1.5
- PHP7
Steps to reproduce
- change file vendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml
1.1. addecho $block->getZone();
on line 25 (or some other line, as you like) - having Product A with Product B listed/marked as related or upsell.
2.1. Product B also has Product A listed/marked as related or upsell product - visiting Product A detail page
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 - visiting Product B detail page
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 - clearing cache and now the other way around: visiting Product B detail page
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
- item_zone from the current product should always be "item_view" so the schema.org meta information for the price is set correctly
Actual result
- Already described in "steps to reproduce" section
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