0

enter image description here

I'm having a little problem here. So, the minimal price is shown big and on the left on the first product, but on the second product there is no minimal price. What i'm trying to do, is have the normal price on the left (like on the first product) IF there is no minimal price.

I've already looked around in the list.phtml, but i can't seem to find the .price-box class in there.

Any help on the matter would be much appreciated!

0

your price file location

frontend/yourtheme/default/template/catalog/product/price.phtml


<div class="price-box">
            <p<?php if ($showMinPrice): ?> class="minimal-price"<?php endif ?>>
                <?php if ($showMinPrice): ?>
                    <span class="price-label"><?php echo $this->__('Starting at:') ?></span>
                <?php endif ?>
                <?php if ($_taxHelper->displayBothPrices()): ?>
                    <span class="price-excluding-tax">
                        <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 echo $_coreHelper->formatPrice($_exclTax, false) ?>
                        </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 echo $_coreHelper->formatPrice($_inclTax, false) ?>
                        </span>
                    </span>
                <?php else: ?>
                    <?php
                    $_showPrice = $_inclTax;
                    if (!$_taxHelper->displayPriceIncludingTax()) {
                        $_showPrice = $_exclTax;
                    }
                    ?>
                    <span class="price" id="product-minimal-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
                    <?php echo $_coreHelper->formatPrice($_showPrice, false) ?>
                </span>
                <?php endif; ?>
            </p>
        </div>
  • I've found the file, but i can't figure which variable does what :S – Menno Jun 17 '15 at 13:54
  • I've found the file, but i can't figure which variable does what :S EDIT: I've found the right variable ... but it's not showing the 0 at the end with the variable $_minimalPrice. The price shows up as €7.5, also i need to replace the period with a comma ... i tried this already in PHP <?php str_replace('.', ',', $_minimalPrice); ?> But it's not working. – Menno Jun 17 '15 at 14:15
  • Almost got the price down now. I just need a way to replace the period with a comma now ... – Menno Jun 17 '15 at 14:49
  • try this preg_replace('/\.(\d{3})/', ',$1', $_minimalPrice); – Qaisar Satti Jun 17 '15 at 15:43
0

I've finally got it working as follows in app\design\frontend\default\\template\catalog\product\price.phtml:

<?php /// CUSTOM CODE START /// ?>
        <?php
        setlocale(LC_MONETARY, 'nl_NL.UTF-8');
        $newPrice = money_format('%(#1n', $_price);
        $newPrice =  number_format($newPrice, 2, ',', '');
        ?>
        <a href="<?php echo $_product->getProductUrl(); ?>" class="price"><?php echo 'Vanaf: &euro;&nbsp;' .$newPrice. ' p.p.'; ?></a>
    <?php  /// CUSTOM CODE END /// ?>

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.