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!

  • Definitely sounds like a good scenario for a custom module... – tjons Nov 21 '16 at 14:14
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();
  • 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 '16 at 14:00
  • You, my friend are a god send!!!! – rupi Jun 5 '19 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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