Magento Forum

   
How to make order for another user
 
BLIZZARD
Jr. Member
 
Total Posts:  21
Joined:  2008-12-15
Kharkov, Ukraine
 

I want to add possibility for making orders with current customer for another registered customer. For example I’m a doctor and want to make order for one of my patients (another registered customer). I’m looking for right logic for this process.

At this moment I’ve added additional step to onepage checkout (Patient selection) but I’m interested in right direction for next step.. now I’am trying to change saveOrder method in Mage_Checkout_Model_Type_Onepage

something like:

...
public function 
saveOrder()
{
        
...
        
$this->validateOrder();
        
$billing $this->getQuote()->getBillingAddress();
        if (!
$this->getQuote()->isVirtual()) {
            $shipping 
$this->getQuote()->getShippingAddress();
        
}
        
switch ($this->getQuote()->getCheckoutMethod()) {
        
...
        default:
                    
               
$session Mage::getSingleton('core/session', array('name'=>'chiropractors'));
               
$patient_id $session->getData('patient_id');
               
               if ( 
$patient_id {
                   $customer 
Mage::getSingleton('customer/customer')->load($patient_id);
               
else {
                $customer 
Mage::getSingleton('customer/session')->getCustomer();
               
}


            
if (!$billing->getCustomerId() || $billing->getSaveInAddressBook()) {
                $customerBilling 
$billing->exportCustomerAddress();
                
$customer->addAddress($customerBilling);
            
}
          
...
}
...

Should I customize code for each next steps or maybe is exists better solution more simple like I’ve posted

Thanks for answers!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top