2

Does anyone know how to remove the space after the symbol in the price? It's defined in the price.phtml file but i can't find a way to remove the space...

I tried formatting the price and got this now:

<div class="price-box bc-deal-price">
    <?php
        $sym = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol(); 
        $price = $_product->getPrice();
        $specialprice = $_product->getFinalPrice();
        if($price != $specialprice){
           if($price != ''){
                echo '<p class="old-price"><span class="price-label">';
                echo $this->__('Regular Price'). ': </span>';
                echo '<span id="old-price" class="price">'.$sym.''.number_format($price,2).'</span></p>';
            }
            if($specialprice != '')
            {
                echo '<p class="special-price">
                    <span class="price-label">Special Price</span>
                    <span id="" class="price">'.$sym.''.number_format($specialprice,2).'</span>
                </p> ';
            } 
            }else {
                echo '<div class="price-box">
                        <span id="product-price-'.$_product->getId().'" class="regular-price">
                            <span class="price">'.$sym.''.number_format($price,2).'</span>                                    
                        </span>
                    </div>';    
        }
    ?>
</div>

But now it's display €99.95 instead of €99,95 with a comma, how can i change it to show a comma?

2 Answers 2

3

You can rewrite the method Mage_Directory_Model_Currency::formatTxt in one of your classes and make it look like this:

public function formatTxt($price, $options = array())
{
    $formatted = parent::formatTxt($price, $options);
    $noSpace = str_replace(' ', '', $formatted);
    return $noSpace;
}

In case you need it, here is an explanation on how to rewrite a model provided by Inchoo.

1

try this

$price=Mage::getModel('directory/currency')->format(
    $price, 
    array('display'=>Zend_Currency::NO_SYMBOL), 
    false
);

<span id="old-price" class="price">'.$sym.''.$price.'</span></p>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.