Can't set shipping method on order created programmatically“Please specify a shipping method” when programmatically creating an orderCustom cron causing one page checkout deadlocksSet Shipping Method in CartShipping method only avialable for manual order creation 1.9Create invoice and shipment in magento via cron based on store view and order ageCreate an order on API callMagento Order Mangement Confusion? No invoice automatically created?PayPal Checkout and Account Registration ConflictM1 CE, paypal exception “PayPal NVP gateway errors”how to fetch order number, payment method and customer name according to invoice number in admin panel grid?
Stopping power of mountain vs road bike
90's TV series where a boy goes to another dimension through portal near power lines
Is it canonical bit space?
Can a rocket refuel on Mars from water?
Can a virus destroy the BIOS of a modern computer?
Emailing HOD to enhance faculty application
Took a trip to a parallel universe, need help deciphering
Doing something right before you need it - expression for this?
Combinations of multiple lists
Has there ever been an airliner design involving reducing generator load by installing solar panels?
Twin primes whose sum is a cube
Python: return float 1.0 as int 1 but float 1.5 as float 1.5
Today is the Center
Forgetting the musical notes while performing in concert
Is it inappropriate for a student to attend their mentor's dissertation defense?
Can I use a neutral wire from another outlet to repair a broken neutral?
How can I tell someone that I want to be his or her friend?
How to show the equivalence between the regularized regression and their constraint formulas using KKT
UK: Is there precedent for the governments e-petition site changing the direction of a government decision?
What do you call someone who asks many questions?
Will google still index a page if I use a $_SESSION variable?
Western buddy movie with a supernatural twist where a woman turns into an eagle at the end
Why does Kotter return in Welcome Back Kotter
prove that the matrix A is diagonalizable
Can't set shipping method on order created programmatically
“Please specify a shipping method” when programmatically creating an orderCustom cron causing one page checkout deadlocksSet Shipping Method in CartShipping method only avialable for manual order creation 1.9Create invoice and shipment in magento via cron based on store view and order ageCreate an order on API callMagento Order Mangement Confusion? No invoice automatically created?PayPal Checkout and Account Registration ConflictM1 CE, paypal exception “PayPal NVP gateway errors”how to fetch order number, payment method and customer name according to invoice number in admin panel grid?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have been searching for an answer on the web, but have tried all the solutions I have found and nothing seems to work.
The order adds fine, but in the admin panel is shows "No shipping information available".
When I go through the cart, then it shows "Free Shipping".
Any ideas on how to set the shipping method on the order?
//Product to add to the order
$product = Mage::getSingleton('catalog/product')->load($productId);
//Previous order to copy from
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
$converter = Mage::getModel('sales/convert_order');
$quote = $converter->toQuote($order);
$quote->setBillingAddress($converter->addressToQuoteAddress($order->getBillingAddress()));
$quote->setShippingAddress($converter->addressToQuoteAddress($order->getShippingAddress()));
$quote->getShippingAddress()->setShippingMethod("tablerate_bestway");
$shippingAddress = $quote->getShippingAddress();
$shippingAddress->setFreeShipping( true )
->setCollectShippingRates(true)->collectShippingRates()
->setShippingMethod(‘tablerate_bestway’)
->setPaymentMethod(‘checkmo’);
$quote->setStore($order->getStore());
$quote->setCustomer($customer);
$converter->paymentToQuotePayment($order->getPayment(), $quote->getPayment());
$convert = Mage::getModel('sales/convert_quote');
$newOrder = Mage::getModel('sales/order');
$payment = $convert->paymentToOrderPayment($quote->getPayment());
$newOrder->setPayment($payment);
$newOrder->setBillingAddress($convert->addressToOrderAddress($quote->getBillingAddress()));
$newOrder->setShippingAddress($convert->addressToOrderAddress($quote->getShippingAddress()))->setShipping_Method('tablerate_bestway');
$newOrder->getShippingAddress()->setFreeShipping(true);
$newOrder->setShippingMethod('tablerate_bestway');
$newOrder->setCustomerId($customer->getId());
$newOrder->setCustomerFirstname($customer->getFirstname());
$newOrder->setCustomerLastname($customer->getLastname());
$newOrder->setCustomerEmail($customer->getEmail());
$newOrder->setState(Mage_Sales_Model_Order::STATE_PROCESSING,true);
$order->setWeight($product->getWeight());
$newOrder->setSubtotal($product->getPrice())
->setBaseSubtotal($product->getPrice())
->setGrandTotal($product->getPrice())
->setBaseGrandTotal($product->getPrice());
$message = 'Generated Order';
$newOrder->addStatusToHistory($newOrder->getStatus(), $message);
$orderItem = Mage::getModel('sales/order_item')
->setStoreId($newOrder->getStore()->getStoreId())
->setQuoteItemId(NULL)
->setQuoteParentItemId(NULL)
->setProductId($product->getId())
->setProductType($product->getTypeId())
->setQtyBackordered(NULL)
->setTotalQtyOrdered(1)
->setQtyOrdered(1)
->setWeight($product->getWeight())
->setIsVirtual(0)
->setIsQtyDecimal(0)
->setQtyInvoiced(1)
->setName($product->getName()." Generated")
->setSku($product->getSku())
->setPrice($product->getPrice())
->setBasePrice($product->getPrice())
->setBaseOriginalPrice($product->getPrice())
->setOriginalPrice($product->getPrice())
->setRowTotal($product->getPrice())
->setBaseRowTotal($product->getPrice())
->setOrder($newOrder)
->setProductOptions($savedOptions);
$newOrder->addItem($orderItem);
$newOrder->save();
$invoice = Mage::getModel('sales/service_order', $newOrder)->prepareInvoice();
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::STATE_PAID);
$invoice->register();
$invoice->setAmount($grandtotal);
$invoice->pay()->save();
$transactionSave = Mage::getModel('core/resource_transaction')
->addObject($invoice)
->addObject($newOrder);
$newOrder->save();
$transactionSave->save();
$payment->pay($invoice);
magento-1.9 orders shipping-methods
bumped to the homepage by Community♦ 4 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have been searching for an answer on the web, but have tried all the solutions I have found and nothing seems to work.
The order adds fine, but in the admin panel is shows "No shipping information available".
When I go through the cart, then it shows "Free Shipping".
Any ideas on how to set the shipping method on the order?
//Product to add to the order
$product = Mage::getSingleton('catalog/product')->load($productId);
//Previous order to copy from
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
$converter = Mage::getModel('sales/convert_order');
$quote = $converter->toQuote($order);
$quote->setBillingAddress($converter->addressToQuoteAddress($order->getBillingAddress()));
$quote->setShippingAddress($converter->addressToQuoteAddress($order->getShippingAddress()));
$quote->getShippingAddress()->setShippingMethod("tablerate_bestway");
$shippingAddress = $quote->getShippingAddress();
$shippingAddress->setFreeShipping( true )
->setCollectShippingRates(true)->collectShippingRates()
->setShippingMethod(‘tablerate_bestway’)
->setPaymentMethod(‘checkmo’);
$quote->setStore($order->getStore());
$quote->setCustomer($customer);
$converter->paymentToQuotePayment($order->getPayment(), $quote->getPayment());
$convert = Mage::getModel('sales/convert_quote');
$newOrder = Mage::getModel('sales/order');
$payment = $convert->paymentToOrderPayment($quote->getPayment());
$newOrder->setPayment($payment);
$newOrder->setBillingAddress($convert->addressToOrderAddress($quote->getBillingAddress()));
$newOrder->setShippingAddress($convert->addressToOrderAddress($quote->getShippingAddress()))->setShipping_Method('tablerate_bestway');
$newOrder->getShippingAddress()->setFreeShipping(true);
$newOrder->setShippingMethod('tablerate_bestway');
$newOrder->setCustomerId($customer->getId());
$newOrder->setCustomerFirstname($customer->getFirstname());
$newOrder->setCustomerLastname($customer->getLastname());
$newOrder->setCustomerEmail($customer->getEmail());
$newOrder->setState(Mage_Sales_Model_Order::STATE_PROCESSING,true);
$order->setWeight($product->getWeight());
$newOrder->setSubtotal($product->getPrice())
->setBaseSubtotal($product->getPrice())
->setGrandTotal($product->getPrice())
->setBaseGrandTotal($product->getPrice());
$message = 'Generated Order';
$newOrder->addStatusToHistory($newOrder->getStatus(), $message);
$orderItem = Mage::getModel('sales/order_item')
->setStoreId($newOrder->getStore()->getStoreId())
->setQuoteItemId(NULL)
->setQuoteParentItemId(NULL)
->setProductId($product->getId())
->setProductType($product->getTypeId())
->setQtyBackordered(NULL)
->setTotalQtyOrdered(1)
->setQtyOrdered(1)
->setWeight($product->getWeight())
->setIsVirtual(0)
->setIsQtyDecimal(0)
->setQtyInvoiced(1)
->setName($product->getName()." Generated")
->setSku($product->getSku())
->setPrice($product->getPrice())
->setBasePrice($product->getPrice())
->setBaseOriginalPrice($product->getPrice())
->setOriginalPrice($product->getPrice())
->setRowTotal($product->getPrice())
->setBaseRowTotal($product->getPrice())
->setOrder($newOrder)
->setProductOptions($savedOptions);
$newOrder->addItem($orderItem);
$newOrder->save();
$invoice = Mage::getModel('sales/service_order', $newOrder)->prepareInvoice();
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::STATE_PAID);
$invoice->register();
$invoice->setAmount($grandtotal);
$invoice->pay()->save();
$transactionSave = Mage::getModel('core/resource_transaction')
->addObject($invoice)
->addObject($newOrder);
$newOrder->save();
$transactionSave->save();
$payment->pay($invoice);
magento-1.9 orders shipping-methods
bumped to the homepage by Community♦ 4 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have been searching for an answer on the web, but have tried all the solutions I have found and nothing seems to work.
The order adds fine, but in the admin panel is shows "No shipping information available".
When I go through the cart, then it shows "Free Shipping".
Any ideas on how to set the shipping method on the order?
//Product to add to the order
$product = Mage::getSingleton('catalog/product')->load($productId);
//Previous order to copy from
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
$converter = Mage::getModel('sales/convert_order');
$quote = $converter->toQuote($order);
$quote->setBillingAddress($converter->addressToQuoteAddress($order->getBillingAddress()));
$quote->setShippingAddress($converter->addressToQuoteAddress($order->getShippingAddress()));
$quote->getShippingAddress()->setShippingMethod("tablerate_bestway");
$shippingAddress = $quote->getShippingAddress();
$shippingAddress->setFreeShipping( true )
->setCollectShippingRates(true)->collectShippingRates()
->setShippingMethod(‘tablerate_bestway’)
->setPaymentMethod(‘checkmo’);
$quote->setStore($order->getStore());
$quote->setCustomer($customer);
$converter->paymentToQuotePayment($order->getPayment(), $quote->getPayment());
$convert = Mage::getModel('sales/convert_quote');
$newOrder = Mage::getModel('sales/order');
$payment = $convert->paymentToOrderPayment($quote->getPayment());
$newOrder->setPayment($payment);
$newOrder->setBillingAddress($convert->addressToOrderAddress($quote->getBillingAddress()));
$newOrder->setShippingAddress($convert->addressToOrderAddress($quote->getShippingAddress()))->setShipping_Method('tablerate_bestway');
$newOrder->getShippingAddress()->setFreeShipping(true);
$newOrder->setShippingMethod('tablerate_bestway');
$newOrder->setCustomerId($customer->getId());
$newOrder->setCustomerFirstname($customer->getFirstname());
$newOrder->setCustomerLastname($customer->getLastname());
$newOrder->setCustomerEmail($customer->getEmail());
$newOrder->setState(Mage_Sales_Model_Order::STATE_PROCESSING,true);
$order->setWeight($product->getWeight());
$newOrder->setSubtotal($product->getPrice())
->setBaseSubtotal($product->getPrice())
->setGrandTotal($product->getPrice())
->setBaseGrandTotal($product->getPrice());
$message = 'Generated Order';
$newOrder->addStatusToHistory($newOrder->getStatus(), $message);
$orderItem = Mage::getModel('sales/order_item')
->setStoreId($newOrder->getStore()->getStoreId())
->setQuoteItemId(NULL)
->setQuoteParentItemId(NULL)
->setProductId($product->getId())
->setProductType($product->getTypeId())
->setQtyBackordered(NULL)
->setTotalQtyOrdered(1)
->setQtyOrdered(1)
->setWeight($product->getWeight())
->setIsVirtual(0)
->setIsQtyDecimal(0)
->setQtyInvoiced(1)
->setName($product->getName()." Generated")
->setSku($product->getSku())
->setPrice($product->getPrice())
->setBasePrice($product->getPrice())
->setBaseOriginalPrice($product->getPrice())
->setOriginalPrice($product->getPrice())
->setRowTotal($product->getPrice())
->setBaseRowTotal($product->getPrice())
->setOrder($newOrder)
->setProductOptions($savedOptions);
$newOrder->addItem($orderItem);
$newOrder->save();
$invoice = Mage::getModel('sales/service_order', $newOrder)->prepareInvoice();
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::STATE_PAID);
$invoice->register();
$invoice->setAmount($grandtotal);
$invoice->pay()->save();
$transactionSave = Mage::getModel('core/resource_transaction')
->addObject($invoice)
->addObject($newOrder);
$newOrder->save();
$transactionSave->save();
$payment->pay($invoice);
magento-1.9 orders shipping-methods
I have been searching for an answer on the web, but have tried all the solutions I have found and nothing seems to work.
The order adds fine, but in the admin panel is shows "No shipping information available".
When I go through the cart, then it shows "Free Shipping".
Any ideas on how to set the shipping method on the order?
//Product to add to the order
$product = Mage::getSingleton('catalog/product')->load($productId);
//Previous order to copy from
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
$converter = Mage::getModel('sales/convert_order');
$quote = $converter->toQuote($order);
$quote->setBillingAddress($converter->addressToQuoteAddress($order->getBillingAddress()));
$quote->setShippingAddress($converter->addressToQuoteAddress($order->getShippingAddress()));
$quote->getShippingAddress()->setShippingMethod("tablerate_bestway");
$shippingAddress = $quote->getShippingAddress();
$shippingAddress->setFreeShipping( true )
->setCollectShippingRates(true)->collectShippingRates()
->setShippingMethod(‘tablerate_bestway’)
->setPaymentMethod(‘checkmo’);
$quote->setStore($order->getStore());
$quote->setCustomer($customer);
$converter->paymentToQuotePayment($order->getPayment(), $quote->getPayment());
$convert = Mage::getModel('sales/convert_quote');
$newOrder = Mage::getModel('sales/order');
$payment = $convert->paymentToOrderPayment($quote->getPayment());
$newOrder->setPayment($payment);
$newOrder->setBillingAddress($convert->addressToOrderAddress($quote->getBillingAddress()));
$newOrder->setShippingAddress($convert->addressToOrderAddress($quote->getShippingAddress()))->setShipping_Method('tablerate_bestway');
$newOrder->getShippingAddress()->setFreeShipping(true);
$newOrder->setShippingMethod('tablerate_bestway');
$newOrder->setCustomerId($customer->getId());
$newOrder->setCustomerFirstname($customer->getFirstname());
$newOrder->setCustomerLastname($customer->getLastname());
$newOrder->setCustomerEmail($customer->getEmail());
$newOrder->setState(Mage_Sales_Model_Order::STATE_PROCESSING,true);
$order->setWeight($product->getWeight());
$newOrder->setSubtotal($product->getPrice())
->setBaseSubtotal($product->getPrice())
->setGrandTotal($product->getPrice())
->setBaseGrandTotal($product->getPrice());
$message = 'Generated Order';
$newOrder->addStatusToHistory($newOrder->getStatus(), $message);
$orderItem = Mage::getModel('sales/order_item')
->setStoreId($newOrder->getStore()->getStoreId())
->setQuoteItemId(NULL)
->setQuoteParentItemId(NULL)
->setProductId($product->getId())
->setProductType($product->getTypeId())
->setQtyBackordered(NULL)
->setTotalQtyOrdered(1)
->setQtyOrdered(1)
->setWeight($product->getWeight())
->setIsVirtual(0)
->setIsQtyDecimal(0)
->setQtyInvoiced(1)
->setName($product->getName()." Generated")
->setSku($product->getSku())
->setPrice($product->getPrice())
->setBasePrice($product->getPrice())
->setBaseOriginalPrice($product->getPrice())
->setOriginalPrice($product->getPrice())
->setRowTotal($product->getPrice())
->setBaseRowTotal($product->getPrice())
->setOrder($newOrder)
->setProductOptions($savedOptions);
$newOrder->addItem($orderItem);
$newOrder->save();
$invoice = Mage::getModel('sales/service_order', $newOrder)->prepareInvoice();
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::STATE_PAID);
$invoice->register();
$invoice->setAmount($grandtotal);
$invoice->pay()->save();
$transactionSave = Mage::getModel('core/resource_transaction')
->addObject($invoice)
->addObject($newOrder);
$newOrder->save();
$transactionSave->save();
$payment->pay($invoice);
magento-1.9 orders shipping-methods
magento-1.9 orders shipping-methods
asked Dec 10 '16 at 3:24
user1579943user1579943
236
236
bumped to the homepage by Community♦ 4 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 4 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Please use this
$order->setShippingAddress($shippingAddress)
->setShipping_method(<Code>)
->setShippingDescription(<Title>);
For Ex. UPS we set as
$order->setShippingAddress($shippingAddress)
->setShipping_method('ups')
->setShippingDescription('UPS');
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f149726%2fcant-set-shipping-method-on-order-created-programmatically%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Please use this
$order->setShippingAddress($shippingAddress)
->setShipping_method(<Code>)
->setShippingDescription(<Title>);
For Ex. UPS we set as
$order->setShippingAddress($shippingAddress)
->setShipping_method('ups')
->setShippingDescription('UPS');
add a comment |
Please use this
$order->setShippingAddress($shippingAddress)
->setShipping_method(<Code>)
->setShippingDescription(<Title>);
For Ex. UPS we set as
$order->setShippingAddress($shippingAddress)
->setShipping_method('ups')
->setShippingDescription('UPS');
add a comment |
Please use this
$order->setShippingAddress($shippingAddress)
->setShipping_method(<Code>)
->setShippingDescription(<Title>);
For Ex. UPS we set as
$order->setShippingAddress($shippingAddress)
->setShipping_method('ups')
->setShippingDescription('UPS');
Please use this
$order->setShippingAddress($shippingAddress)
->setShipping_method(<Code>)
->setShippingDescription(<Title>);
For Ex. UPS we set as
$order->setShippingAddress($shippingAddress)
->setShipping_method('ups')
->setShippingDescription('UPS');
answered Jun 20 '18 at 14:07
DivyarajsinhDivyarajsinh
409212
409212
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f149726%2fcant-set-shipping-method-on-order-created-programmatically%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown