Magento Themes and Magento Extensions

Order statuses “improvement” in 1.5

Posted on July 9th, 2011 | Posted by admin

I took some time to install and do the quick check on Magento There was one thing that is impossible to miss: Improved order statuses.
I remember the days when people requested that feature all over ther forum. Oh yes… what feature? Custom order statuses
So, we have it out of the box finally! Or do we? Let’s see…

No more configuration files! That’s cool. Everything is stored in database now.
Users are able to create their own statuses and assign those statuses to some predefined order state.
They can choose if they want it to be default status which is also cool.
Let’s see how it looks…

Programmatically create order in Magento

Posted on June 24th, 2011 | Posted by admin

Surprisingly one of the trickiest parts of “under the hood” Magento is how to create order programmatically. At least for me, this was/is the most complex area of Magento development. Reason why it is so difficult is that the order creation process is all but not straightforward. You cannot simply instantiate order model, set some data and call upon the save() method. If you ask me, this is how it should be done.

So why cannot we apply approach like generic one show below?

//$order = new Mage_Sales_Model_Order();
$order = Mage::getModel('sales/order');

How to make order shipment from code

Posted on June 21st, 2011 | Posted by admin

As most of you know, there is an Order interface in Magento administration from where you can trigger order shipping. However, while developing certain module, you might wish to trigger this event from the code. I hope that this code snippet will help you in this process. In my case I have used this code to make shipment from cron after I got confirmation from fulfillment center
We will use Magento API to achieve it.

How to create Magento invoice from order

Posted on June 21st, 2011 | Posted by admin

How to create Magento invoice from order

Maybe you want to create an invoice from some custom script or through cron script. Here is one very useful example of code.
First of all, we have to load some order over model “sales/order”, this is very easy.

$order = Mage::getModel("sales/order")->load($order_id)
// $order_id is entity_id of order from database
//also we can use method "loadByIncrementId" for loading data instead of load method but then we need to pass "increment_id" argument (example: 100000001).

Next step, when we have loaded model “sales/ored” with data, the next procedure is:

How to disable email sending when programatically creating an order in Magento

Posted on June 17th, 2011 | Posted by admin

Here is a little snippet of code that can come in handy if you are like me handling a task of programatically creating an order in Magento. My issue was that I had to disable emails beeing sent out to the customers, while at the same time leave the normal frontend process. Thus I could not just go under Magento admin System > Congifuration and disable email sending from there.

Here is the sample line code you just need to place above final $order->save() or possibly $checkout->saveOrder():

Mage::app()->getStore()->setConfig(Mage_Sales_Model_Order::XML_PATH_EMAIL_ENABLED, "0");
Page 2 of 3«123»