2

I have a situation where I want to show the different (actual) price on the front-end for same customer group, where as I want to use a discounted price (assigned to that group) in the back-end when creating order in back-end.

Is this possible?

I have no clue where to start, may be we can detach customer group information when customer logs in from front-end? or use some hook to override the pricing?

Any help will be great!

1
  • Definitely sounds like a good scenario for a custom module...
    – tjons
    Nov 21, 2016 at 14:14

1 Answer 1

2

sales_quote_add_item Event will be occurred when you add product to order from admin.

Add below code in config.xml

<adminhtml> 
   <events>
        <sales_quote_add_item>
            <observers>
                <unique_event_name>
                    <class>module/observer</class>
                    <method>productpricechange</method>
                </unique_event_name>
            </observers>
        </sales_quote_add_item>
    </events>
 </adminhtml> 

Make sure you are adding <event> tag in <adminhtml>

In Observer.php

public function productpricechange($observer) {

    $event = $observer->getEvent();
    $quote_item = $event->getQuoteItem();

    $new_price = <insert logic>

    $quote_item->setOriginalCustomPrice($new_price);
    $quote_item->save();
}

to get customer detail for your price change logic you can use

Mage::getSingleton('adminhtml/session_quote')->getCustomer();
2
  • it works pretty well, just one question, The observer is called only when I add new product, but ignored when I click "Update Items & Qty", I know we're only hooking it with sales_quote_add_item , can you tell me the hook when we add custom price and update??
    – Alyas
    Nov 22, 2016 at 14:00
  • You, my friend are a god send!!!!
    – ItsJhonny
    Jun 5, 2019 at 15:02

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.