Prestashop:付款方式取决于邮政编码

问题描述 投票:3回答:1

我是prestashop的新手,我需要知道是否有办法(通过代码)我可以根据客户邮政编码限制可用的支付网关数量。例如,假设从纽约购买的任何人只能通过PayPal付款,但美国其他城市可以使用任何支付网关。

我尝试过这个,但它为所有人禁用模块而不是特定客户端:

if (strcmp($postcode, "12345")) // postcode I want to restrict
{
   // disabling other payment modules
   $modules = PaymentModuleCore::getInstalledPaymentModules();
   foreach ($modules as $module)
   {
      // fetch all installed module names
      $name = $module['name'];
      if (strcmp($name, "Paypal") != 0)
         Module::getInstanceByName($name)->disable();
   }
}
payment-gateway prestashop postal-code
1个回答
1
投票

没有人回答,我已经用Jquery修复了这个问题,删除了模块.tpl中的其他选项

- 编辑 -

在模板的最后,我添加了这行JS:

<script type="text/javascript"> 
    $(".payment_module").not(".mypaymentmodule").remove();
</script>
© www.soinside.com 2019 - 2024. All rights reserved.