Magento: is the checkout a registration
When a order is placed through the one page checkout, it saves the order information in sales_flat_order and sales_flat_quote tables.From the sales_flat_quote, there is a column called checkout_method which will tell you if the checkout method is a register. Programmatically, we can:
- Get the last order id from the checkout session
- Create the last order object
- Create the last order quote object
- Get the checkout method
- Check if it is a registration
public function isNewRegistration() { // Get the last order $lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId(); $lastOrder = Mage::getModel('sales/order')->load($lastOrderId); // Get the last order quote and its checkout method $quote = Mage::getModel('sales/quote')->load($lastOrder->getQuoteId()); $checkoutMethod = $quote->getCheckoutMethod(true); if ($checkoutMethod === Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER) { return true; } else { return false; } }
Search within Codexpedia
Custom Search
Search the entire web
Custom Search
Related Posts