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?
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?
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>
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
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
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.
Step 4: Now Refresh cache and check Checkout Step.
Let me know if any comments.