Magento에서 프로그래밍 방식으로 주문을 추가하는 스크립트를 만들고 있습니다. 댓글 기록 (견적, 인보이스, 배송비 등)의 항목 날짜를 변경하려면 도움이 필요합니다. 주문 자체 (setCreatedAt)의 날짜를 조작 할 수 있으며 주문 작성과 관련된 일부 의견이 올 바르며 (예 : "9 월 29 일 2008 8:59:25 AM | 고객 통지 보류 중"),Magento 주문 내역 댓글 : 수정 날짜
여기 내 코드의 조각이다 ... 나는 addStatusHistoryComment를 사용하는 주석의 날짜를 변경할 수 없습니다 : 주석 역사
try {
if(!$order->canInvoice()) {
Mage::throwException(Mage::helper('core')->__('Cannot create an invoice.'));
}
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
if (!$invoice->getTotalQty()) {
Mage::throwException(Mage::helper('core')->__('Cannot create an invoice without products.'));
}
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
$invoice->setCreatedAt('2008-09-23 13:05:20');
$invoice->register();
$invoice->getOrder()->setCustomerNoteNotify(true);
$invoice->getOrder()->setIsInProcess(true);
$transactionSave = Mage::getModel('core/resource_transaction')
->addObject($invoice)
- >addObject($invoice->getOrder());
$transactionSave->save();
//END Handle Invoice
//START Handle Shipment
$shipment = $order->prepareShipment();
$shipment->setCreatedAt('2008-09-23 14:20:10');
$shipment->register();
$order->setIsInProcess(true);
$order->addStatusHistoryComment('Shipping message goes here...', true);
$shipment->setEmailSent(true);
$transactionSave = Mage::getModel('core/resource_transaction')
->addObject($shipment)
->addObject($shipment->getOrder())
->save();
$track = Mage::getModel('sales/order_shipment_track')
->setShipment($shipment)
->setData('title', 'Some tracking no.')
->setData('number', '111222333444')
->setData('carrier_code', 'fedex') //custom, fedex, ups, usps, dhl
->setData('order_id', $shipment->getData('order_id'))
->save();
//END Handle Shipment
}
catch (Mage_Core_Exception $ex) {
echo "Problem creating order invoice and/or shipment: ".$ex."\n";
}
스크린 샷 : 를! http://www.etechparts.us/media/downloadable/files/links/CommentsHistory_Magento.png
미리 감사드립니다.
감사합니다. 나는 이미 기존의 메소드를 수정하려고 시도했다. (소스를 확장하는 데 어려움을 겪기 전에 작동 하는지를 보았다.)하지만 아무런 효과가 없었다. – kkyros