Ryan King
Ryan King

Reputation: 85

Add Span Between Currency Symbol and Price in Magento

I am looking to split the price from the currency symbol so i can add

<span class="price" itemprop="price">

Between the two.

I have found the code in the price.

<p class="special-price">
    <span class="price-label"><?php echo $_specialPriceStoreLabel ?></span>
    <span class="price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
        <?php echo $_coreHelper->currency($_finalPrice, true, false) ?> 
    </span>
</p>

How do i go about changing this so i can place the span between the symbol and price.

Upvotes: 2

Views: 2039

Answers (1)

William Tran
William Tran

Reputation: 699

To get price without currency

$_coreHelper->currency($_finalPrice, false, false)

To get current currency symbol

Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol()

So your code would become something like this:

<p class="special-price">
   ...
   <span class="currency-code"> <?php echo Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol(); ?> </span>
   <span class="price" itemprop="price"> <?php echo $_coreHelper->currency($_finalPrice, false, false); ?> </span>
</p>

Upvotes: 7

Related Questions