##Describe order creation in the admin

To create an order on the admin you need to open up Sales > Orders > Create New Order. You will now be presented with a form where you need to add:

  • Customer
  • Addresses
  • Order Items
  • Payment Method

When you hit place order the Mage_Adminhtml_Sales_Order_CreateController will use the Mage_Adminhtml_Model_Sales_Order_Create Model to save your order.

##Describe the differences in order creation between the frontend and the admin:

In the admin you can add any product to an order, also no quote is saved in the database.

###Which classes are involved in order creation in the admin? What are their roles (especially the role of adminhtml classes)?

  • Mage_Adminhtml_Sales_Order_CreateController
  • Mage_Adminhtml_Model_Sales_Order_Create

###How does Magento calculate price when an order is created from the admin?

The Mage_Adminhtml_Sales_Order_CreateController::_processActionData() method handles the posting of the data to the Mage_Adminhtml_Model_Sales_Order_Create::addProducts($items) method. This then in turn sets a flag in Mage_Sales_Model_Quote which tells Magento the totals need to be collected.

###Which steps are necessary in order to create an order from the admin?

See Above.

###What happens when existing orders are edited in the admin?

To keep it simple, Magento cancels the existing order and creates a new one.

###What is the difference between order status and order state?

Magento uses state internally for order processing, each state is a constant. However statuses are used by admins and are children of states. These can be defined with in the admin. Multiple statuses can belong to to one state.

These code references can be used as an entry point to find answers to the questions above:

  • Mage_Sales_Model_Order
  • Mage_Sales_Model_Order_Address
  • Mage_Adminhtml_controllers_Order_CreateController
  • Mage_Adminhtml_Model_Sales_Order_Create

##Card operations (capturing and authorization):

###Which classes and methods are responsible for credit card operations (for example authorization or capturing)?

  • Mage_Sales_Model_Order_Invoice
  • Mage_Sales_Model_Order_Invoice_*
    • Item
    • Comment
    • Api
    • Total_*
      • Abstract
      • Cost
      • Discount
      • Grand
      • Shipping
      • Subtotal
      • Tax
  • Mage_Sales_Model_Order_Payment
  • Mage_Payment_Model_Info
  • Mage_Paypent_Model_Method_Abstract

###What is the difference between “pay” and “capture” operations?

Capture actually captures the payment for the invoice from the required payment method whereas pay calculates the totals to display on the invoice.

###What are the roles of the order, order_payment, invoice, and payment methods in the process of charging a card?

  • order handles the creation and storage of the order
  • order_payment handles the majority of the capturing payment
  • invoice handles the creation and storage of the invocie
  • payment_methods handles the different payment methods

###What are the roles of the total models in the context of the invoice object?

To add up the total amount of the invoice.

###How does Magento store information about invoices?

Magento stores all the invoice information in the sales_flat_invoice prefixed tables.

These code references can be used as an entry point to find answers to the questions above:

  • Mage_Sales_Model_Order_Invoice
  • Mage/Sales/Model/Order/Invoice/*
  • Mage_Sales_Model_Order_Payment
  • Mage_Payment_Model_Method_Info
  • Mage_Payment_Model_Method_Abstract

##Describe the order shipment structure and process:

The controller which handles shipments in the admin is Mage_Adminhtml_Sales_Order_ShipmentController.

The model which handles the creation/storage of shipments is Mage_Sales_Model_Order_Shipment.

The model which handles the tracking of shipments is Mage_Sales_Model_Order_Shipment_Track.

###How shipment templates be customized?


###How can different items from a single order be shipped to multiple addresses?

Multiple shipping addresses can be used on multi-shipping orders. This is handled by the Mage_Checkout_Model_Type_Multishipping model.

###How does Magento store shipping and tracking information?

In the tables with the sales_flat_shipment prefix (sales_flat_shipment_track for tracking).

These code references can be used as an entry point to find answers to the questions above:

  • Mage_Sales_Model_Order_Shipment
  • Mage/Sales/Model/Order/Shipment/*

##Describe the architecture and processing of refunds:

Refunds in Magento are called Credit Memos.

###Which classes are involved, and which tables are used to store refund information?

The controller which handles credit memos in the admin is Mage_Adminhtml_Sales_Order_CreditmemoController.

The model which handles the saving/creation of the Credit Memo is Mage_Sales_Order_Creditmemo.

The tables which store the data are prefixed with sales_flat_creditmemo.

Hopefully you should be able to spot a naming convention between these different sales actions which makes them easy to remember.

###How does Magento process taxes when refunding an order?

Credit memo totals handle the amount which is being refunded from each section of the order.

###How does Magento process shipping fees when refunding an order?

Shipping fees are another total, so the same as mention before.

###What is the difference between online and offline refunding?

Offline refunds refund the order on Magento without actually taking care of the refund transaction. Whereas online does both.

###What is the role of the credit memo total models in Magento?

Credit memo totals keep a track on how much is refunded per total.

These code references can be used as an entry point to find answers to the questions above:

  • Mage_Sales_Model_Order_Creditmemo
  • Mage/Sales/Model/Order/Creditmemo/*

##Describe the implementation of the three partial order operations (partial invoice, partial shipping, and partial refund):

Partial operations mean you can refund/invoice or ship part of the order. So for instance if you wanted to ship 1 out of 4 items of the order you could create a partial shipment. All of these operations set the order to be in processing with thesetIsInProcess() method.

###How do partial order operations affect order state?

As mentioned, if the order is partially refunded it will set the state to be processing.

###How is data for partial operations stored?

Each partial refund has its own model and table using the order_id to associate them.

These code references can be used as an entry point to find answers to the questions above:

  • Mage_Sales_Model_Order_Invoice
  • Mage_Sales_Model_Order_Payment
  • Mage_Sales_Model_Order_Shipment
  • Mage_Sales_Model_Order_Creditmemo
  • Mage_Payment_Model_Method_Abstract

##Describe cancel operations:

###What cancel operations are available for the various order entities in Magento (order, order item, shipment, invoice, credit memo)? Do all of them support cancellation?

The only entity that doesn’t support cancelation is shipment.

###How are taxes processed during cancel operations?

Taxes will return to there previous state before the transaction which occurred before the cancelation.

These code references can be used as an entry point to find answers to the questions above:

  • Mage_Adminhtml_Sales_OrderController
  • Mage_Sales_Model_Order_Invoice
  • Mage_Sales_Model_Order_Payment
  • Mage_Sales_Model_Order_Shipment
  • Mage_Sales_Model_Order_Creditmemo
comments powered by Disqus