0

We would like to remove the currency symbol for products with custom options.

Our current code, displayed below, works perfect for normal products. But when a product got custom options it first show the price without the symbol and after 0.5-1.0 seconds the currency symbol is displayed.

Seems that somewhere the code for custom options activate this.

Where can we remove this?

Current price code:

            <span class="label"><?php echo $this->helper('tax')->__('Excl. Tax:') ?></span>
                <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
                    <?php if ($_finalPrice == $_price): ?>
                        <?php $myPrice = $_coreHelper->formatPrice($_price + $_weeeTaxAmount, false);
                        $zeros = substr($myPrice, -2);
                        if(strval($zeros) == "00") { $myPrice = substr($myPrice, 0, -2);
                        $myPrice = $myPrice . '-'; }
                        $myPrice = str_replace("€","",$myPrice);
                            //or if the € is htmlencoded
                        $myPrice = str_replace("&euro;","",$myPrice);
                        echo '<span class="price">'.$myPrice.'</span>'; ?>  
                    <?php else: ?>
                        <?php $myPrice = $_coreHelper->formatPrice($_price + $_weeeTaxAmount, false);
                        $zeros = substr($myPrice, -2);
                        if(strval($zeros) == "00") { $myPrice = substr($myPrice, 0, -2);
                        $myPrice = $myPrice . '-'; }
                        $myPrice = str_replace("€","",$myPrice);
                            //or if the € is htmlencoded
                        $myPrice = str_replace("&euro;","",$myPrice);
                        echo '<span class="price">'.$myPrice.'</span>'; ?>  
                    <?php endif; ?>
                </span>
            </span>
            <span class="price-including-tax">
                <span class="label"><?php echo $this->helper('tax')->__('Incl. Tax:') ?></span>
                <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
                        <?php $myPrice = $_coreHelper->formatPrice($_finalPriceInclTax + $_weeeTaxAmount, false);
                        $zeros = substr($myPrice, -2);
                        if(strval($zeros) == "00") { $myPrice = substr($myPrice, 0, -2);
                        $myPrice = $myPrice . '-'; }
                        $myPrice = str_replace("€","",$myPrice);
                            //or if the € is htmlencoded
                        $myPrice = str_replace("&euro;","",$myPrice);
                        echo '<span class="price">'.$myPrice.'</span>'; ?>  
                </span>
            </span>
1

For product with some price options (like configurable product for example), there is a js script that modify the display: js/varien/product_options.js.

You should override this class or just some of these methods (I guess the formatPrice one).

  • Thanks! But any idea how to change the product_options.js file to only remove the currency symbol? – Henk Z Jan 18 at 14:04
  • No idea. But looking at the formatPrice method, maybe you should try to return price instead of formatCurrency(price, this.priceFormat). – Julien Loizelet Jan 18 at 17:09
  • Thanks, but in that case it does also remove the max 2 decimals. So a price excl vat will be: 858.6776859504132. How can fix that? – Henk Z Jan 23 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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