Hi everyone, let’s come back to Magento blog!

We have gone through 7 topics of Magento Certificate Preparation Material. We tried to provide you with useful knowledge and information as much as possible in the extent of Magento blog. Today, I am very delighted to start the next stage of this series. You will be introduced the eighth topic – Checkout.

Checkout plays an important role on every e-commerce site. It’s the core helping customer to buy online products easily. Magento uses quote to store checkout information and calculate subtotal, tax, shipping, grand total… values before creating an order. When customer adds product to cart (or remove product from cart), the data is stored into quote. The quote model includes some important methods:

  • assignCustomer: assign customer model object data to the quote
  • setBillingAddress/getBillingAddress: set and get billing address for the quote
  • setShippingAddress/getShippingAddress: set and get shipping address for the quote
  • addItem/removeItem: add and remove item from the quote
  • collectTotals: calculate grand total for the quote

The address in the quote has two types: billing address and shipping address. If the quote doesn’t have items to be shipped, it only needs billing address. Otherwise, the quote needs both billing address and shipping address. The quote address can be imported from customer address or order address by using methods importCustomerAddress, importOrderAddress.

The quote consists of items which is implements of a product in the shopping cart. Each item associates with a product. Before being added to cart, the product was prepared the necessary information such as quantity, custom option, product type (provided by method prepareForCartAdvanced of product type instance)… Or you can change item’s information by the event sales_quote_product_add_after.

I don’t show the code here because it is so long. However, you can view the code in details in these classes Mage_Sales_Model_Quote, Mage_Sales_Model_Quote_Item, Mage_Sales_Model_Quote_Address from Magento core.

Let me know if you have any questions. Other parts of topic Checkout will be available soon. Just keep following Magento blog regularly to discover!

Author

Why Magestore? We believe in building a meaningful & long-term relationship with you.

2 Comments

  1. Nice blog ..
    very use for magento developers.
    Thank’s for this post 🙂

Write A Comment