0

I am trying to edit our grouped.phtml table so that when a product has a special price it displays different columns.
I have edited my grouped.phtml page to include these columns but can not work out the correct PHP statements to make them show only when a product has a 'special price'.

I have tried: <?php if($_product->getSpecialPrice() ): ?> and also <?php if($_product->getSpecialPrice()){ ?> but this does not seem to work.

I have also found another post showing how to display an icon for products with special price: https://stackoverflow.com/questions/17590849/dsplay-sale-icon-on-special-price-products-in-magento-only-at-homepage-it-is-sh

But again this doesn't not work for me.

3
  • This belongs on the Magento stackexchange site. I've flagged it for migration Commented Feb 25, 2014 at 16:19
  • @DavidWilkins Thanks, sorry didn't realise I posted it on the wrong site. Is it something I can do to migrate?
    – Chev
    Commented Feb 25, 2014 at 17:14
  • This should work: $currentProduct->getSpecialPrice() are you on the catalog category view or on the product detail page? Commented May 20, 2014 at 15:10

1 Answer 1

2

Given the stock template:

<?php foreach ($_associatedProducts as $_item): ?>
    <?php $_finalPriceInclTax = $this->helper('tax')->getPrice($_item, $_item->getFinalPrice(), true) ?>
    <tr>
        <td><?php echo $this->escapeHtml($_item->getName()) ?></td>
        <?php if ($this->getCanShowProductPrice($_product)): ?>
        <td class="a-right">
            <?php if ($this->getCanShowProductPrice($_item)): ?>
            <?php echo $this->getPriceHtml($_item, true) ?>
            <?php echo $this->getTierPriceHtml($_item) ?>
            <?php endif; ?>
        </td>
        <?php endif; ?>
        <?php if ($_product->isSaleable()): ?>
        <td class="a-center">
        <?php if ($_item->isSaleable()) : ?>
            <input type="text" name="super_group[<?php echo $_item->getId() ?>]" maxlength="12" value="<?php echo $_item->getQty()*1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
        <?php else: ?>
            <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
        <?php endif; ?>
        </td>
        <?php endif; ?>
    </tr>
<?php endforeach; ?>

You will need to use $_item->getSpecialPrice() and ensure that special_price is set to show in product listing in attribute management.

Your Answer

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

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