查看我发现的 Mage/Sales/model/Quote/Payment.php 核心代码
@method Mage_Sales_Model_Quote_Payment setPoNumber(string $value)
我认为会有所帮助。
我在下面我认为的其他功能代码中添加了 setPoNumber('PO123456')。今晚晚些时候我会测试。
公共函数 PrepareConfirmOrder($customerID, $PartCart, $isHist) {
$customerObj=Mage::getModel('customer/customer')->load($customerID);
$storeId = $customerObj->getStoreId();
$quoteObj=Mage::getModel('sales/quote')->assignCustomer($customerObj);
$quoteObj->reserveOrderId();
$productModel=Mage::getModel('catalog/product');
foreach($PartCart as $part) {
foreach($part as $k=>$v) { $$k=$v; }
$productObj=$productModel->load($PartId);
$quoteItem=Mage::getModel('sales/quote_item')->setProduct($productObj);
$quoteItem->setQuote($quoteObj);
$quoteItem->setQty($qty);
$quoteItem->setOriginalCustomPrice($UnitCost) ;
$quoteObj->addItem($quoteItem);
}
$quoteObj->collectTotals();
// Add shipping method to the quote
$quoteObj->getShippingAddress()->setShippingMethod('flatrate_flatrate');
$quoteObj->getShippingAddress()->setCollectShippingRates(true)->save();
$quoteObj->save();
$quotePaymentObj=$quoteObj->getPayment();
//methods: authorizenet, paypal_express, googlecheckout, purchaseorder
$quotePaymentObj->setMethod('purchaseorder');
$quotePaymentObj->setPoNumber('PO1234567');
$quoteObj->setPayment($quotePaymentObj);