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.
thx a lot for you’re code. Comparing it to what I’ve already got, it seemed I wasn’t that wrong and i found out now, what my problem was. The observers weren’t loaded. Using the “initialize magento"-code from http://www.ecomdev.org/2010/06/01/application-bootstrap-in-magento.html the mail contains the links now.
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
Jesse_dev,
I’ve noticed that when you make a sale like this, the stock of products is not reduced, any idea why this happens?
Thanks.
jesse_dev - 09 May 2009 06:53 PM
I’m not receiving email from this thread for some reason, sorry for the delay.
i just checked the email notification so i should get notified of every post on here now.
@faisal - the params array is basically an array of product ids and quantities, like a shopping cart
it looks like this
$shopping_cart=array();
$part=array("PartId"=>x, "Quantity"=>y); $shopping_cart[]=$part; //repeat as necessary
@freshwebservices - the code you sent me in msg is quite a bit different than what you’re describing here. the code works as is. any small change can break it.
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?