douyun3799
douyun3799
2015-06-15 14:44
浏览 62
已采纳

在opencart中自定义支付网关

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条回答 默认 最新

  • doucha5080
    doucha5080 2015-06-23 15:07
    已采纳

    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

    点赞 评论
  • donglvchu9143
    donglvchu9143 2015-06-23 03:16

    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.

    点赞 评论

相关推荐