나는 어떻게 든 주문이 발송되지 않습니다 sales_order/index
Magento 프로그래밍 방식으로 주문을 발송하려면 어떻게해야합니까?
에서 젠토 및 선박 완전한 여러 개의 주문에 MassAction
를 추가하는 몇 가지 코드를 찾고 있어요.
마치 정상적인 순서 인 것처럼 보이며 canship()
테스트를 통과하지 못했습니다. 패스해야합니까 $order
$orderid
?
여기에 내 코드
당신은, 당신이 실제로 주문 incrementId을받을 경우 IncrementOrderId에 의해 주문 ID, 또는 부하를 얻는 경우에, ID에 의해로드 할 필요//Get orderids
$orderIds = $this->getRequest()->getPost('order_ids');
//verify if the array is not empty
if (!empty($orderIds)) {
//loop through orders
foreach ($orderIds as $orderId) {
// Dont know what this does
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
// Is the order shipable?
if($order->canShip())
{
$itemQty = $order->getItemsCollection()->count();
// This first definition and 2nd look overlapping, our one is obsolete?
$shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($itemQty);
$shipment = new Mage_Sales_Model_Order_Shipment_Api();
// But still, no shipment, why?
$shipmentId = $shipment->create($orderId, array(), 'Shipment created through ShipMailInvoice', true, true);
많은 감사합니다 @ShaunOReilly. 그것은합니다 ... canship()를 통과 을 수행하지만 다음 오류가 발생합니다 order_not_exists 'code' 추적 : 주문/선적/Api.php (142) : Mage_Api_Model_Resource_Abstract -> _ 오류 ('order_not_exist ...') Sales/OrderController.php (45) : Mage_Sales_Model_Order_Shipment_Api-> create ('121', Array, 'Shipment create ...', true, true) 'code' –
이제 $ shipment-> create에서 충돌합니다. 나는 $ order와 orderId를 모두 시도했다. 둘 다 작동하지 않습니다. $ order 결과가 액세스 위반이됩니다 $ shipmentId = $ shipment-> create ($ order, array(), –
내 대답의 마지막 편집을보세요. – ShaunOReilly