I am developing a module where I need to set discounted price for a product if applicable. Admin will set a discount percent from backedn for a product and based on that the product price will be calculated.

For ex:

Product Price = 299
Discount Percent = 20%
Discounted Price = 239.20

So the price for that product will be 239.20. I have displayed the discounted price successfully on listing page and the file changes is


But now I also need to change the price on product detail page. The file being used to display the price is


I do not want to change the .phtml file as it has number of conditions for price display.

enter image description here

What is the best method to set the discounted price on product detail page ?

I hope my question is clear.

Please Help.


  • for Special Price you can use Magento Special price Functionality
    – Keyul Shah
    Commented Jul 22, 2014 at 4:28
  • Edited my question
    – Jordan
    Commented Jul 22, 2014 at 4:48
  • @Jordan Why are you not using catalog price rule ?
    – Mufaddal
    Commented Jul 22, 2014 at 6:33
  • For that if admin changes the discount percent, I again have to make changes in price rules. Also I have to specify SKU's everytime. Currently admin is selecting the products from my custom module
    – Jordan
    Commented Jul 22, 2014 at 6:37
  • How are you getting the price on the product listing page?
    – pspahn
    Commented Jul 22, 2014 at 7:35

1 Answer 1


Magento has the ability to display the special price when it is set on a product:

enter image description here

This is styled in the Magento frontend with the markup

<p class="special-price">
    <span class="price-label">Special Price</span>
    <span class="price" id="product-price-423">$224.00</span>

So using the following CSS should allow you to style it how you see fit:

.special-price .price { 
   /* your rules here */

enter image description here

  • Yes I know the special price settings, but I have a custom module that applies discount on a product and that discounted price will be shown in the special price HTML format as you have shown above.
    – Jordan
    Commented Jul 22, 2014 at 5:21
  • Please clarify exactly what you are expecting from us so we can give you proper guidance.
    – philwinkle
    Commented Jul 22, 2014 at 5:22
  • If a product falls under a deal, it will have a discounted price which will be shown on listing as well as detail page. I am not sure how to display it on details page as it has number of setPrice() conditions. Discount price is not special price.
    – Jordan
    Commented Jul 22, 2014 at 5:24
  • Have you created a new attribute with a type of price? If so you can display this just about anywhere in the product templates with $this->getProduct()->getMySpecialPrice() or something akin to that
    – philwinkle
    Commented Jul 22, 2014 at 5:26
  • No, admin will give discount percent on a deal and based on that I am calculating the price on frontend. This does not includes any attribute creation but simply specifying discount percent from backend.
    – Jordan
    Commented Jul 22, 2014 at 5:28

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.