1

I am working on a multi website magento store. It has two websites: One is for International Customers and one for Nepalese customers. I know how to configure paypal and have done it for the international store. However, since in Nepal, we do not have online payment system, I want to use a system in which customer and Administrator will receive a invoice of the purchase in email. The company will then contact the customer and proceed as needed.Is there any way I can have PayPal enabled for International store and the invoice emailing option for the customers in Nepal?

1

You can simply enable/disable payment methods per store view in the admin config.

For your invoicing site, you just want to enable Purchase Order payment method, and disable other methods.

In the below images, switch your store view to the appropriate store view and enable the Purchase Order method. Also, disable the method you don't want active at that store view.

Store View Switcher

Enable Purchase Orders

| improve this answer | |
0

Freerunner.According to your question ,You may want to disable Paypal method for Nepalese customers and also want to create invoice for international customer.

You can do this Magento Event Observer.

  1. magentocommerce
  2. tutsplus

First,using payment_method_is_active disable on depends country address of shipping or billing address.

Code for this:

Module config.xml code:

<global>
    <events>
    <payment_method_is_active>
        <observers>
            <paymentfilter_payment_method_is_active>
            <type>singleton</type>
            <class>yourmodel/observer</class>
            <method>filterpaymentmethod</method>
            </paymentfilter_payment_method_is_active>
        </observers>
    </payment_method_is_active>
    </events>
</global>

The Observer.php code is:

<?php
class YOURNANESPACE_YOURMODULE_Model_Observer {

    public function filterpaymentmethod(Varien_Event_Observer $observer) {

        /* call get payment method */

    $method = $observer->getEvent()->getMethodInstance();

     /*   country  from Quote  */
     $quote = $observer->getEvent()->getQuote();
     $countryId=$quote->getBillingAddress()->getCountryId();

    /* Disbale paypal payment method for  nepeles Country */

    if($method->getCode()=='paypal_standard' && $countryId=='YOUR_NEPEL_COUNTRY_ID' )
    {   
        $result = $observer->getEvent()->getResult();   
        $result->isAvailable = false;

        return;
    }
    /* Disbale your Payment method for no nepeles Country */
        if($method->getCode()=='your_Payment_Methode_Code' && $countryId!='YOUR_NEPEL_COUNTRY_ID' ){

            $result = $observer->getEvent()->getResult();   
            $result->isAvailable = false;
        return;         
        }

    }
}
?>

Second using checkout_submit_all_after event on depends country address of shipping or billing address,Create invoice.

Module config.xml code:

<global>
    <events>
    <checkout_submit_all_after>
        <observers>
            <create_Invoice_for>
            <type>singleton</type>
            <class>yourmodel/observer</class>
            <method>createInvoiceforNepel</method>
            </create_Invoice_for>
        </observers>
    </checkout_submit_all_after>
    </events>
</global>

The Create Invoice at Observer.php on immediate after order place .code is:

<?php
class YOURNANESPACE_YOURMODULE_Model_Observer {

    public function createInvoiceforNepel(Varien_Event_Observer $observer) {

    $order=Mage::getModel('sales/order')->load($observer->getEvent()->getOrder()->getId());
    if($order->getPayment()->getMethodInstance()->getCode()=="your_Payment_Methode_Code"):
    if($order->canInvoice() and $order->getIncrementId())
    {
        $items = array();
         foreach ($order->getAllItems() as $item) {
           $items[$item->getId()] = $item->getQtyOrdered();
          }
    $invoiceId=Mage::getModel('sales/order_invoice_api')->create($order->getIncrementId(),$items,null,false,true);
    Mage::getModel('sales/order_invoice_api')->capture($invoiceId);
    endif;
    }
}
?>
| improve this answer | |
  • 2
    FYI, any payment method can be enabled/disabled at store scope level. And since using different store for that country, one can easily disable it from payment settings. – MagePsycho Feb 8 '15 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.