Invoice Automobile Era in Magento

0
22
Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  


Often the Magento order approach will cause a lot more operate than a customer desires. Envision you have a client who utilizes their Magento eCommerce retail store so their customers can make purchases on the web. Now they also want to system orders on their individual with buyers from their physical store.

If they had been to put an buy, they would want to also invoice and approach shipping and delivery. This becomes cumbersome. Here we bypass this so inserting a prosperous buy with payment will vehicle bill the purchase so it is entire and nothing at all more is required.

Develop NAMESPACE folder underneath app / code / group / MCorner

• Build module folder “MCornerOrdersObserver” as we will use this a person as the identify of our module

• app / code / neighborhood / MCorner / MCornerOrdersObserver

• Make Folders

• app / code / local community / MCorner / MCornerOrdersObserver / and many others

• app / code / group / MCorner / MCornerOrdersObserver / Model

• app / code / community / MCorner / MCornerOrdersObserver / Helper

• Build the config.xml file

• application / code / neighborhood / MCorner / MCornerOrdersObserver / and so forth / config.xml

• Inside of the config.xml file copy and paste the code underneath

********************************************** **************************

.1.0MCorner_MCornerOrdersObserver_Product_ObserverMCorner_MCornerOrdersObserver_Design_ObserverafterSalesOrderSaveCommitAfterMCorner_MCornerOrdersObserver_Helper

********************************************** **************************

Develop the key observer file:

• app / code / group / MCorner / MCornerOrdersObserver / Product / Observer.php

• Duplicate and paste the code below into application / code / group / MCorner / MCornerOrdersObserver / Design / Observer.php

********************************************** **************************

course MCorner_MCornerOrdersObserver_Product_Observer {

public $ order // the get …

purpose afterSalesOrderSaveCommitAfter (& $ function)

return $ this -> __ system ($ event)

guarded purpose __course of action ($ celebration)

$ this-> order = $ celebration-> getEvent () -> getOrder ()

if (! $ this-> order-> getId ())

// get is not saved in the database

return $ this

else

$ this-> createInvoice ()

shielded purpose createInvoice ()

$ orderState = $ this-> buy-> getState ()

if ($ orderState === Mage_Gross sales_Model_Get :: Condition_NEW) // Verify for state new.

if ($ this-> buy-> canInvoice ())

$ this-> get-> getPayment () -> setSkipTransactionCreation (wrong)

$ bill = $ this-> buy-> prepareInvoice ()

$ invoice-> setRequestedCaptureCase (Mage_Revenue_Model_Buy_Invoice :: Seize_On-line)

$ bill-> register ()

Mage :: getModel (&#39main / useful resource_transaction&#39)

-> addObject ($ invoice)

-> addObject ($ this-> buy)

-> help you save ()

else

// we can not invoice it so the process is normal.

}

?>

********************************************** **************************

To activate the observer module create the module file:

• application / and so forth / modules / MCorner_ MCornerOrdersObserver.xml

• Duplicate and paste the code under

********************************************** **************************

truecommunity

********************************************** **************************

Make sure all documents are saved in their areas as in the tutorial and now go into Magento admin and Very clear ALL CACHE.

Now, if an purchase is placed through your Magento retailer it will immediately be invoiced and the bill total will be billed. An invoice will be produced and an e-mail will be despatched. This functionality is comparable to clicking the Bill Button in Magento get administration.

Source by Harry Balle Singh

Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

LEAVE A REPLY

Please enter your comment!
Please enter your name here