Magento – Set Discount Price in Listing and Detail Page and Show in Cart

productshopping-cart

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.

Best Answer

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.

Related Topic