Magento show FROM price on configurable products

Posted by Damodar Bashyal on January 21, 2013

 

Magento displays base price set on configurable product as price on product listing pages and on product view page before attribute is selected. Client wanted to display either price range from simple products associated to it or show 'From' in front of the price, so it doesn't look like misleading because the price changes when attribute is selected e.g. different price for different size, that would turn off the customers.

So, this is what I did to add 'from' on the prices.

NOTE: This was tested on magento enterprise version 1.12.0.2

app\design\frontend\enterprise\your_magento_theme\template\catalog\product\price.phtml
Around line 50, I added this:

<?php
$priceFromText = '';
if($_product->getData('type_id') == 'configurable'){
    $priceFromText = Mage::helper('tax')->__('From: ');
}
?>
<span class="price-label"><?php echo Mage::helper('tax')->__('Price') ?>:</span>

Line 76,82,89,95 and so on ... I added <?php echo $priceFromText ?> e.g.:

<?php echo $priceFromText ?><?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, false) ?>

But these lines:

<?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, true) ?>

I updated to:

<?php //echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, true) ?>
<span class="price"><?php echo $priceFromText ?><?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, false) ?></span>

And, on line 200, I updated:

<?php if ($_finalPrice == $_price): ?>
	<?php echo $_coreHelper->currency($_price, true, true) ?>
<?php else: ?>
	<?php echo $_coreHelper->currency($_finalPrice, true, true) ?>
<?php endif; ?>

to:

<span class="price"><?php echo $priceFromText ?>
	<?php if ($_finalPrice == $_price): ?>
		<?php //echo $_coreHelper->currency($_price, true, true) ?>
		<?php echo $_coreHelper->currency($_price, true, false) ?>
	<?php else: ?>
		<?php //echo $_coreHelper->currency($_finalPrice, true, true) ?>
		<?php echo $_coreHelper->currency($_finalPrice, true, false) ?>
	<?php endif; ?>
</span>

And the result was like this:

Listing page:

Listing page

Product view page: before attribute selected

Product view originally

Product view page: after attribute selected

Product view page

 

Full code is available on github at: https://github.com/dbashyal/Magento-custom-configurable-price-display

Caroline posted on - Friday 3rd of January 2014 09:16:05 AM

Dear Marcus, if you find the solution, please let me know!

Damodar posted on - Wednesday 11th of December 2013 07:45:04 AM

@Marcus it should be possible. Sorry but too busy to try myself and help you at the moment.

Marcus posted on - Wednesday 11th of December 2013 07:40:57 AM

Dear Damodar, your code looks good. Is is also possible to remove the "From:" if you have a configurable product where the prices of all variants are the same? Best regards, Marcus

Rajesh posted on - Thursday 23rd of July 2015 01:21:10 AM

Can we update it for Community Edition 1.9
 
not published on website


QR Code: Magento show FROM price on configurable products