Get In Touch
606 Tower A Plot, I-Thum Tower, Sector 62, Noida, Uttar Pradesh, IN
sales@visiwebsolutions.com
Ph: +91 8383.033.985
Work Inquiries
hr@visiwebsolutions.com
Ph: +91 8383.033.985

Bill Auto Era in Magento

[ad_1]

Generally the Magento order course of causes extra work than a shopper wishes. Think about you might have a shopper who makes use of their Magento eCommerce retailer so their prospects could make purchases on-line. Now additionally they need to course of orders on their very own with prospects from their bodily retailer.

In the event that they have been to put an order, they would want to additionally bill and course of delivery. This turns into cumbersome. Right here we bypass this in order that inserting a profitable order with cost will auto bill the order so it’s full and nothing extra is required.

Create NAMESPACE folder beneath app/code/neighborhood/MCorner

• Create module folder “MCornerOrdersObserver” as we are going to use this one because the identify of our module

• app/code/neighborhood/MCorner/MCornerOrdersObserver

• Create Folders

• app/code/neighborhood/MCorner/MCornerOrdersObserver/and many others

• app/code/neighborhood/MCorner/ MCornerOrdersObserver/Mannequin

• app/code/neighborhood/MCorner/ MCornerOrdersObserver/Helper

• Create the config.xml file

• app/code/neighborhood/MCorner/MCornerOrdersObserver/and many others/config.xml

• Contained in the config.xml file copy and paste the code under

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

0.1.0MCorner_MCornerOrdersObserver_Model_ObserverMCorner_MCornerOrdersObserver_Model_ObserverafterSalesOrderSaveCommitAfterMCorner_MCornerOrdersObserver_Helper

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

Create the primary observer file:

• app/code/neighborhood/MCorner/ MCornerOrdersObserver/Mannequin/Observer.php

• Copy and paste the code under into app/code/neighborhood/MCorner/ MCornerOrdersObserver/Mannequin/Observer.php

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

class MCorner_MCornerOrdersObserver_Model_Observer {

public $order;//the order…

perform afterSalesOrderSaveCommitAfter(&$occasion) {

return $this->__process($occasion);

}

protected perform __process($occasion) {

$this->order = $event->getEvent()->getOrder();

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

//order isn’t saved within the database

return $this;

}

else {

$this->createInvoice();

}

}

protected perform createInvoice() {

$orderState = $this->order->getState();

if ($orderState === Mage_Sales_Model_Order::STATE_NEW) { // Test for state new.

if ($this->order->canInvoice()) {

$this->order->getPayment()->setSkipTransactionCreation(false);

$bill = $this->order->prepareInvoice();

$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);

$invoice->register();

Mage::getModel(‘core/resource_transaction’)

->addObject($bill)

->addObject($this->order)

->save();

}

else {

//we can’t bill it so the method is regular.

}

}

}

}

?>

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

To activate the observer module create the module file:

• app/and many others/modules/MCorner_ MCornerOrdersObserver.xml

• Copy and paste the code under

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

truecommunity

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

Make sure that all recordsdata are saved of their places as within the tutorial and now go into Magento admin and CLEAR ALL CACHE.

Now, if an order is positioned by way of your Magento retailer it can mechanically be invoiced and the bill quantity might be charged. An bill might be created and an e-mail might be despatched. This performance is much like clicking the Bill Button in Magento order administration.

[ad_2]
Supply by Harry Balle Singh

Post a comment

Your email address will not be published. Required fields are marked *