Hi, I cannot reproduce this issue. Please add more details to your description of the steps you followed when identifying this issue.
@olysenko It just classical usage of catalog price rules.
Actually rule is working on all type of products.
For simples, discounted prices shown on all areas (listing, search, view etc..)
But configurables, just shown on product view page.
It may be about with price renderer in $block->getProductPrice(). Because in listing, for configurables, magento gets lowest child's price.
I'm investigating this.
In addition it may be related with #6080
Our configurables prices are 0. Catalog price calculating by totals of selected attributes (child prices).
Additional Info:
After some investigation, i think find a clue
Clean install 2.1.2 with sample-data via composer.
It is working well with same price children 馃憤
But if change price of any child
It shows lowest price as expected but regular price gone same as our situation
But in product view discount shown. So catalog rule applied all children, not only parent (as expected).
I hope it will help to solve this.
Hi, after your las comment update I was able to reproduce issue on clear Magento installation with sample data. Your price index is invalid after price was changed. In case your have setting for indexers UPDATE BY SCHEDULE in menu System->Tools->Index Management. You have to setup cron with indexers reindex job. Or use UPDATE ON SAVE mode for indexers. In this case it will reindex price on product save. Please tell me if my comment was helpful for you.
Hi @olysenko,
All indexes are update by schedule and crond working fine. Also check database while running reindex. I have verified the calculation is correct and products got discounted price.
This issue just about showing oldPrice in frontend. Not about rule applying or other.
Product special price did not set for minimal price (lowest price of child products) so final_price.html don't know how about showing price ($block->hasSpecialPrice() in final_price.phtml returns false).
I did some trick to override it (Magento_Catalog/templates/product/price/final_price.phtml) :
line around 20
if($block->getSaleableItem()->getTypeId()==MagentoConfigurableProductModelProductTypeConfigurable::TYPE_CODE)
{
/* ex: MagentoCatalogPricingPriceConfiguredPrice */
/* @var MagentoFrameworkPricingPricePriceInterface $priceModel */
$priceModel = $block->getPriceType('configured_price');
}
if($finalPriceModel->getAmount()->getValue()<$priceModel->getAmount()->getValue())
$block->getSaleableItem()->setSpecialPrice($finalPriceModel->getAmount()->getValue());
if ($block->hasSpecialPrice()): ?>
Hi @rbostan, so we need to synchronize our steps. My steps with no bug you can find below:
According to contributor guide, tickets without response for two weeks should be closed.
If this issue still reproducible please feel free to create the new one: format new issue according to the Issue reporting guidelines: with steps to reproduce, actual result and expected result and specify Magento version.
I have the exact same issue on a project that has migrated data from a magento 1 store.
The products are assigned later to the configurable product not on the go while creating the configurable product.
When I apply a special price on a simple product or apply a catalog price rule the old price just never shows just the new discounted price and so it is not clear for a customer that this is a special/ discounted price.
This happens in the grids and on a product detail page.
Only when I click a color option in the detail page the display of the price box gets updated with the text "regular: xx,xx" under the new "special price".
This is on a magento 2.1.6 install on a development environment and a production environment with PHP 7.
@veloraven this is weird.
I noticed it in more clear reproducible bug-cases. Some moderators seem eager to close them when the 2-week-deadline is reached.
It is understandable that tickets cannot be open all the time but when there is a clear bug it seems to me that solving this to make magento better has more importance than this guideline.
I'm now having the exact same issue and have to create a whole new case while this case could already be solved or at least updated by me and maybe others.
@rbostan can you provide the final price file content? I don't know what to replace or override. thanks in advance!
Hi, Line 22 in the the file: vendormagentomodule-configurable-productviewbasetemplatesproductpricefinal_price.phtml
I replaced This: <?php if (!$block->isProductList() && $block->hasSpecialPrice()): ?>
With this: <?php if ($block->hasSpecialPrice()): ?>
From onepack, if you want the old price to show in product page (when the swatches are not selected)
Remove the css styling of the "old-price" line 32 (remove everything and leave the old-price class and now it will show on the product page.
hope it helps. someone
@joebordo overwrite provided by @rbostan doesn't work on 2.1.7.
I overwrote like this:
<?php
/** @var \Magento\Catalog\Pricing\Render\FinalPriceBox $block */
$productId = $block->getSaleableItem()->getId();
if ($block->getSaleableItem()->getTypeId()==\Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE) {
/** ex: \Magento\Catalog\Pricing\Price\ConfiguredPrice /
/* @var \Magento\Framework\Pricing\Price\PriceInterface $priceModel */
$priceModel = $block->getPriceType('configured_price');
} else {
/** ex: \Magento\Catalog\Pricing\Price\RegularPrice */
/** @var \Magento\Framework\Pricing\Price\PriceInterface $priceModel */
$priceModel = $block->getPriceType('regular_price');
}
/** ex: \Magento\Catalog\Pricing\Price\FinalPrice */
/** @var \Magento\Framework\Pricing\Price\PriceInterface $finalPriceModel */
$finalPriceModel = $block->getPriceType('final_price');
$idSuffix = $block->getIdSuffix() ? $block->getIdSuffix() : '';
$schema = ($block->getZone() == 'item_view') ? true : false;
?>
<?php
if ($finalPriceModel->getAmount()->getValue() < $priceModel->getAmount()->getValue())
$block->getSaleableItem()->setSpecialPrice($finalPriceModel->getAmount()->getValue());
if ($block->hasSpecialPrice()): ?>
..............
..............
.............
@gediminaskv It worked form me on 2.1.7
@joebordo I want to copy this file and put it in my custom theme. What path should I use?
@joebordo Thanks it works for me!
Someone know how can I change "was" for "old price" ?
Sorry to reopen and drag this but im having the same issue on a magento 2.2 with migration data. ive tried the method mentioned by @joebordo but doesnt seem to work as no old price is showing.
Any advice would be much appreciated.
I have also tried the method mentioned by @joebordo with Magento 2.2.4 but doesnt seem to work as no old price is showing.
Any advice would be much appreciated.
Hi, Line 22 in the the file: vendormagentomodule-configurable-productviewbasetemplatesproductpricefinal_price.phtml
I replaced This:
<?php if (!$block->isProductList() && $block->hasSpecialPrice()): ?>
With this:<?php if ($block->hasSpecialPrice()): ?>
From onepack, if you want the old price to show in product page (when the swatches are not selected)
Remove the css styling of the "old-price" line 32 (remove everything and leave the old-price class and now it will show on the product page.hope it helps. someone
I found that this solution works for me on 2.2.6, now old prices are showing for configurable products in the catalog, hower this causes a new bug, on product pages the old price is initially shown for a second or 2 and then disappears in a flash :(. When selecting an option it goes back to displaying but that was always like that. Seems like there is some Ajax rewriting the price after the fact on the product page.
======edit:
found a fix for the bug created by the joebordo fix: https://github.com/magento/magento2/issues/8670
Hi, Line 22 in the the file: vendormagentomodule-configurable-productviewbasetemplatesproductpricefinal_price.phtml
I replaced This:<?php if (!$block->isProductList() && $block->hasSpecialPrice()): ?>
With this:<?php if ($block->hasSpecialPrice()): ?>
From onepack, if you want the old price to show in product page (when the swatches are not selected)
Remove the css styling of the "old-price" line 32 (remove everything and leave the old-price class and now it will show on the product page.
hope it helps. someoneI found that this solution works for me on 2.2.6, now old prices are showing for configurable products in the catalog, hower this causes a new bug, on product pages the old price is initially shown for a second or 2 and then disappears in a flash :(. When selecting an option it goes back to displaying but that was always like that. Seems like there is some Ajax rewriting the price after the fact on the product page.
======edit:
found a fix for the bug created by the joebordo fix: #8670
@brampta What fix did you find for the bug created by the joebordo fix? I'm on 2.2.3 and I get the old price to flash for a second and then it is replaced with the sale price. So the sale price is displayed and the Original Price, also displays the sale price.
I am on 2.3.4 and both prices show up after the fix described above. However, I only have special price on some variants of the configurable product, and the old prices show up for all variations. As a result, I have Old price 99EUR new price 99EUR which looks like I am trying to fool my customer. Is there a fix for that?
Most helpful comment
Hi, Line 22 in the the file: vendormagentomodule-configurable-productviewbasetemplatesproductpricefinal_price.phtml
I replaced This:
<?php if (!$block->isProductList() && $block->hasSpecialPrice()): ?>
With this:
<?php if ($block->hasSpecialPrice()): ?>
From onepack, if you want the old price to show in product page (when the swatches are not selected)
Remove the css styling of the "old-price" line 32 (remove everything and leave the old-price class and now it will show on the product page.
hope it helps. someone