How can I apply the condition that an Indian customer is only allowed to use PayTm in Payment Gateway? How can I set this condition?
1 Answer
Rather than creating cart rule, you can add the following in your paytm extension's etc/system.xml file after let's say
<mode translate="label">
<label>Select Mode</label>
<frontend_type>select</frontend_type>
<source_model>paytm/config_source_instid2</source_model>
<sort_order>7</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</mode>
<allowspecific translate="label">
<label>Payment from applicable countries</label>
<frontend_type>allowspecific</frontend_type>
<sort_order>50</sort_order>
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</allowspecific>
<specificcountry translate="label">
<label>Payment from Specific countries</label>
<frontend_type>multiselect</frontend_type>
<sort_order>51</sort_order>
<source_model>adminhtml/system_config_source_country</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</specificcountry>
Clear your cache and in the backend you can see "Payment from applicable countries" and "Payment from Specific countries" options would appear in the paytm configuration settings. Select "specific countries" from the first box and "India" from the next box.
-
could you pls explain these lines,, <sort_order>7</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>0</show_in_store>– zusJan 20, 2018 at 13:04
-
1@Zus - these lines manage the visibility and position of the tab/option in backend. I.e.
<show_in_default>1</show_in_default> <show_in_website>0</show_in_website> <show_in_store>0</show_in_store>
would mean that this tab/option is visible in your default config in admin only and can not for example be changed on store level (hence for a single store view setup this is not relevant anyway). Jan 20, 2018 at 18:19 -
-
1Yes, in my case, in the magento backend two elements appeared, I selected specific countries from the first dropdown and selected India from the list of countries in the next list box. Now when I select my billing address for India the paytm option is available and it disappears for other countries. Jan 22, 2018 at 6:01
-