donglei1699 2012-10-09 09:50
浏览 45
已采纳

Opencart结账不通过自定义字段

I'm trying to add 2 custom fields to the checkout (one for a gift note, one to let users choose the dispatch date). I managed to get the gift note field up and running fine but I'm having trouble with the date field.

I'm using a standard text field (input type="text") with the intention of using jQuery UI for the date picker, but the value of the text field isn't being passed through. If I change from an input to a textarea the data does get passed through. I'm trying to add them both in the 'Payment Method' stage of the checkout on Opencart 1.5.4.

I'm new to Opencart (started looking at it yesterday when I was asked to add these fields) but understand the MVC+L pattern and, as I say, managed to get one field working and passed into the database. I'm not using vQmod.

The data from the input field just isn't getting passed into $this->request->post in controller/payment_method.php

This seems like a bug to me, is it just a quirk of Opencart? I could technically use a textarea if there isn't a solution but that feels a bit of a dirty way around the problem

  • 写回答

1条回答 默认 最新

  • dplm47571 2012-10-10 15:38
    关注

    I found the solution in my case, here's what I did in case it helps anyone in the future.

    I found that all the AJAX for posting data through is in

    view/theme/THEME-NAME/template/checkout/checkout.tpl

    I searched for instances of 'post', checked and checked which section they were relevant to. In my case (adding fields inside the payment_method section), the URL the data was being passed to was

    index.php?route=checkout/payment_method/validate

    and just added the id's of the extra fields into the data attribute of the AJAX call.

    Hope this is of use to someone else

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记