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

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

报告相同问题?

悬赏问题

  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码