Magento show FROM price on configurable products

2013-01-20 23:18:33Damodar Bashyal

 

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

  •  
      Tips: touching links in iPhone for few seconds gives the options to open a link in new window.
     

 


Bookmark and Share

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

03/01/14 01:16:05| Caroline

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

10/12/13 11:45:04| Damodar

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

10/12/13 11:40:57| Marcus

 

 





Javascript must be enabled to post comment!

 

QR Code: Magento show FROM price on configurable products