I read this thread because I have the same problem with.
Now I’ve got a question: How do I instantiate the classes from the examplefiles (guestOrders.php, MarkyCreateOrder.php, MarkyMichaelCreateOrder.php or CreateOrder.php) in my Magento-installation. I would be happy if someone could give me a small howto for usage.
Just a thought, it looks like its erroring on your shipping method. The code I posted is set to use the flat rate shipping method, is that enabled on your install? if not try activating it and then run the script again.
I often wonder why what seems like quite simple but very usefull features like this arnt nativly in Magento but then I see they have a paid version which probably does have all these features and then it makes sense. Luckily there always seems a way to hack it to get what you want
Thanks for your efforts in the thread, because of which I was able to create custom orders. But My requirement is a bit different.
I need to import order history and lot of products are inactive now.
1) so in that case I will not be able to provide product Id or SKU to create product object to be sent in prepare order function.
2) My Shipping rates have changed, If I use the table rates it starts showing new shipping rates in Previous Orders and change the total order amount as well. There might be case where for a particular customer I might have given a special discount so I want to set the total amount of order as well through the code instead of simply calling collectTotals function and let the magento set everything itself.
how can I set the discount, shipping rate , total amount , order creation date?
For products that no longer exist and for ones sold at different rates I’ve overwritten the info in the array after its been called. In my code above these lines overwrite the info pulled from the Magento product:
// add product(s) - number in brackets is product no $product = Mage::getModel('catalog/product')->load(3); $product[price] = 123.00; $product[special_price] = 123.00; $product[name] = 'EDITED NAME';
Maybe need to seup a blank default product that gets called instead of a live one
Thank you jesse_dev, solution worked in version 1.6
(did need modifying as its part of ebay integration and need to set customers as guest)
jesse_dev - 13 April 2009 11:54 AM
here’s some code for creating an order ‘outside of magento’
for example, i have a custom soap implementation in /soap/
setting a payment method in the quote before you save() seems to cause errors
i’ve been working on this for about a week..
The last post by rosh3000 works fine when creating one order at a time. I tried using it with csv input file to import orders, but the items are carried over from one order to another. For example, first and second order has 1 item/order. The second order will contain both items from 1st order and second order. Any ideas on how to fix that problem ?
I basically have the order creation function wrapped in a loop that iterates over a csv file and gathers the data. I’m thinking that I will have to dispatch an action with each iteration...hmmm?