php - Magento Invalid - method Mage_Sales_Model_Order::assignCustomer -
basically, im trying make finance section on magento, have looked how place order part of finance submission, everywhere uses code below (not exact):
$order = mage::getmodel('sales/order'); $store = mage::app()->getstore(); $website_id = mage::app()->getwebsite()->getstoreid(); $quote = mage::getmodel('sales/order')->setstoreid($store->getid()); $customer = mage::getsingleton('customer/session')->getcustomer(); $quote->assigncustomer($customer); $quote->setsendcconfirmation(1); $product_ids = array(); $cart = mage::getmodel('checkout/cart')->getquote(); foreach($cart->getallvisibleitems() $item) { $quote->addproduct($item->getproduct() , $item->getqty()); } $shipping = $quote->getshippingaddress(); $shipping->setcollectshippingrates(true)->collectshippingrates()->setshippingmethod('flatrate_flatrate')->setpaymentmethod(array( 'method' => 'checkmo' )); try { $service = mage::getmodel('sales/service_quote', $quote); $service->submitall(); $increment_id = $service->getorder()->getrealorderid(); } catch(exception $e) { die($e->getmessage()); } catch(mage_core_exception $d) { die($d->getmessage()); }
and reason keep getting error:
i loading customer session, , not supplying correct model argument , looking answer;
$customer = mage::getmodel('customer/customer')->loadbyemail(mage::getsingleton('customer/session')->getcustomer()->getemail());
Comments
Post a Comment