7

I have a module in which admin can assign discount to any product from backend. The discount would be in percentage. There is a custom listing page where all the products will be listed having discount applied. My Magento version is 1.8

For example:

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

I need to do the following:

  1. Show Discounted Price instead of Regular price on listing page for all the products
  2. Show Discounted Price instead of Regular price on product detail page
  3. When user add that product, discounted price should be shown in cart, checkout and elsewhere
  4. Pass discount percent i.e. 20 in hidden value from listing page to my observer

I have followed few tutorials below but no luck.

http://magentotutorial.org/programmatically-add-product-cart-price-change-magento/ https://stackoverflow.com/questions/22657041/get-a-value-of-a-custom-input-in-magento

Also, $item->getOriginalPrice() does not return anything here on Magento CE 1.8

Moreover, which event to be used in order to get the Quote ID, as I am getting null

checkout_cart_add_product_complete OR

checkout_cart_product_add_after

Please Help.

Thanks.

1
  • to get the item price after applying discount, you should use $item->getPrice()
    – MTM
    Jul 18, 2014 at 13:56

1 Answer 1

2

May be you need to re-write getFinalPrice() method and do not use attribute special_price at all? So it will show the right price in the listing, edit page, checkout easily.

2
  • Why to rewrite the getFinalPrice() and how if there is no other solution ?
    – Jordan
    Jul 22, 2014 at 9:19
  • May be there are some other solutions with observers, but this one seems to be the fastest. Make sure you inherit the default final price logic however. What is your opinion?
    – Amasty
    Jul 22, 2014 at 11:29

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.