Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

creating order by code
 
xzerco
Jr. Member
 
Total Posts:  8
Joined:  2008-12-16
 

Hi guys
I have a small problem. Actually even it might not be a problem for rest of the forum users. I just started to learn php couple days ago and now Im trying to create orders by code. but Im quite confused.. ok Im totally lost:) Im trying to get used to with magento and its classes but its taking so much time without any guidance.. someone can lead me to correct way in order to create order by code? can anybody show me any info or sample about creating order by code? Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Charles
Member
 
Avatar
Total Posts:  73
Joined:  2008-03-27
Belgium
 

context ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
xzerco
Jr. Member
 
Total Posts:  8
Joined:  2008-12-16
 

Hi charles

is this how I supposed to do?

$myOrder = new Mage_Sales_Model_Order(); // creating order object
// filling properties of order object
$myOrder->setBillingAddress($billingAddress); //setting billing address
$myOrder->setShippingAddress($shippingAddress); //setting shipping address
$myOrder->setPayment($payment); //setting payment option
$myOrder->addItem($myItem); // Im adding item to order but I dont know if this is order item or not
$myOrder->setId($id) // I hope this is customer id
$myOrder->place(); // and finally placing order but of course its not working smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Charles
Member
 
Avatar
Total Posts:  73
Joined:  2008-03-27
Belgium
 

xzerco,

why would you want to create an order through code ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
xzerco
Jr. Member
 
Total Posts:  8
Joined:  2008-12-16
 

there are couple of reasons.

1-I want to know and learn how magento works. specially order processing. It is the most important part of every e commerce software.
2-I have a numbered customers who regularly buys same product every two weeks or month so I dont want to go to backend and create order manually.
3-I would like to create my own order api so I can connect magento to other 3rd party software.
4-I would like to create my own backend for faster order processing.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Charles
Member
 
Avatar
Total Posts:  73
Joined:  2008-03-27
Belgium
 

You’re right concerning 1, but then again, you might be better off using the magento API (no need to write one), which clears 1, 3 & 4.
Concerning 2, looks like you have a subscription product. Not sure if anything is in the works regarding that aspect.

 
Magento Community Magento Community
Magento Community
Magento Community
 
xzerco
Jr. Member
 
Total Posts:  8
Joined:  2008-12-16
 

Since there is no support on the magento api for creating order 1,2,3,4 remains unanswered. is there anybody out there how to know create an order by code?

 
Magento Community Magento Community
Magento Community
Magento Community
 
xzerco
Jr. Member
 
Total Posts:  8
Joined:  2008-12-16
 

I found some code blocks in the source code when I was checking it in order to learn how to create order. Those codes are converting quote to an order. I wonder is that what I was supposed to do? first create a quote than convert it to an order? does anybody have any clue about it?

 
Magento Community Magento Community
Magento Community
Magento Community
 
xzerco
Jr. Member
 
Total Posts:  8
Joined:  2008-12-16
 

I just can not believe it. There are 55881 users in this community and no body knows anything about order process. dont you think there is something wrong with that? I have never seen an open source community like this before.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Charles
Member
 
Avatar
Total Posts:  73
Joined:  2008-03-27
Belgium
 

Sorry to disappoint you

 
Magento Community Magento Community
Magento Community
Magento Community
 
MarkNewby
Member
 
Avatar
Total Posts:  32
Joined:  2008-10-06
MD of Camiloo Limited
 

I’m having this issue too xzerco don’t worry. I’ve been coding in PHP since 1999 and I’ve never come across a project which has become so widely used without any user friendly documentation widely available. From analysing MeanBee’s amazon plugin and why that doesn’t work quite right, I think the step you have to take is to create a quote first, then convert the quote into an order. I think the order creation functions which this plugin makes use of are mere utility functions used by the quote to order conversion process - at the moment i’m analysing the code for the paypal and google checkout plugins to try and figure out how to make this work!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top