Customization for Payment Gateway in opencart

276 views Asked by At

So I am trying to set up a site on my localhost. I have selected 2 payment gateways from admin end

  1. Online Payment (Free Shipping)
  2. Cash On Delivery(Free Shipping/Flat COD Charge INR 50 )

Now I have customized all the rules for them. I only need one more rule.

I wish to have a functionality wherein I can enter some pincode/postcode values (through admin panel or maybe in some array in a javascript file or directly into the database, does not matter) of locations where second method is available)

Whenever someone presses continue before confirming order, the checkout form is validated so as to check from the form data if the value entered in post code matches the data (from any of the above methods) and if yes, only then they can continue or I wish to show an error message that

Following payment gateway is not available in your location

If you give me a hint on how to proceed with this, perhaps, I might be able to take it further. I am a bit or a starter in opencart so not much idea about how to proceed. I have sound knowledge of PHP, JQuery and Javascript although. So any and all help will be appreciated.

2

There are 2 answers

1
Eaten by a Grue On BEST ANSWER

There are a few different extensions that already exist to do what you want - allow you to restrict shipping methods by various criteria. This one is my personal favorite: http://www.opencart.com/index.php?route=extension/extension/info&extension_id=1614

0
Krishnakant Mishra On

I managed it with JQuery for the time being. Edited the submit function in the cart.tpl file in catalog->view->theme->ancart (theme name) ->cart folder.

Used a plugin called "Zipcode COD" to enter zipcodes. Edited the response JQuery to hide and show payment options.

Lots of hard coding but does the trick. I will post the code if someone needs.