1

I want to restrict the payment method by store.How to do this?

Eg.

For English version I need 3 payment modules

1.Paypal 
2. cod 
3.Bank transfer

For Other version I need 1 payment method

1.Paypal 

alone

How to achieve this?

2
  • 1
    Goto admin>System>Configuration>change Current scope according store then Payment Method and disable from here
    – Amit Bera
    Commented Sep 24, 2014 at 4:29
  • There is no option for disabling in magento Commented Sep 24, 2014 at 5:04

4 Answers 4

3

So from what I can see the code will allow for different store values for all the config attributes, so active etc...but Magento by default only allows you to do it for the labels.

public function getConfigData($field, $storeId = null)
{
    if (null === $storeId) {
        $storeId = $this->getStore();
    }
    $path = 'payment/'.$this->getCode().'/'.$field;
    return Mage::getStoreConfig($path, $storeId);
}

What you could do is create and extension that updates the node value for the payment methods from <show_in_store>0</show_in_store> to <show_in_store>1</show_in_store>

This should then allow the attribute to be set via the admin on the store level.

Note: I have not tested this but looking through the code this should work

Your system.xml file for allowing the ccsave method on store level would look like:

<config>
   <sections>
        <payment>
            <groups>
                <ccsave>
                    <fields>
                        <active>
                            <show_in_store>1</show_in_store>
                        </active>
                    </fields>
                </ccsave>
            </groups>
        </payment>
   </sections>
</config>
3

Do this using event observer. Create an observer for the event payment_method_is_active and depends on current store disable and enable payment method:

See there: Implementing payment method per currency

And you need change on observer.In below example i have disable payment zero subtotal check when current store code is default

<?php
class Bh_ZeroSubtotalpaymentmethod_Model_Observer {

    public function filterpaymentmethod(Varien_Event_Observer $observer) {
        /* call get payment method */
        $method = $observer->getEvent()->getMethodInstance();

        $quote = $observer->getEvent()->getQuote();

        /* this condtion prevent zero payment to display when current store is not default */
        if ($method->getCode()=='free' &&  Mage::app()->getStore()->getCode()!='deafult') {
            $quote = $observer->getEvent()->getQuote();
            if (Mage::app()->getStore()->roundPrice($quote->getGrandTotal())>0) {
                $result = $observer->getEvent()->getResult();   
                $result->isAvailable = false;
                return;
            }
        }
        return;
    }
}

Here you need put your logic

5
  • Nice answer @amit :)
    – Keyul Shah
    Commented Sep 24, 2014 at 5:21
  • why down vote? who give this downvote.please explain
    – Amit Bera
    Commented Sep 24, 2014 at 5:32
  • I have don't give down vote
    – Keyul Shah
    Commented Sep 24, 2014 at 5:33
  • it is so irritating me..
    – Amit Bera
    Commented Sep 24, 2014 at 5:35
  • Don't irritating bro :)
    – Keyul Shah
    Commented Sep 24, 2014 at 5:36
1

Make sure that the option to enable and disable this payment method, show_in_store is 1

Example:

<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>

Then you just change the store enable or disable each means of payment by store

-1

Magento By default Provide this kind of functionality.

Step 1: Go to system >> Configuration >> Payment Methods >> Select Bank Transfer Tab.

Step 2: Now you have to select Payment from Applicable Countries to Specific Country.

Step 3: Select Payment from Specific Countries to country and Save configuration.

enter image description here

Step 4: Now Refresh cache and check Checkout Step.

Let me know if any comments.

1
  • Thanks for your reply.. I need for specific store not for specific country.Can you help for this Commented Sep 24, 2014 at 5:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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