dszdiavv474681
2016-03-08 11:12
浏览 119
已采纳

在opencart产品表单中添加一个字段

i would like to add an input field to opencart product form. the field should passed to the server and save like other fields. i added the field to the product form tpl file and passed it to the checkout/cart controller class and the 'add' method with:

data: $('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea , #choosed_color'),

in the $('#button-cart').on('click' event.

i can access the field value in the 'add' method with:

$this->request->post['choosed_color']

how can i show it in the shopping cart and pre-factor? thanks...

图片转代码服务由CSDN问答提供 功能建议

我想在opencart产品表单中添加一个输入字段。 该字段应传递给服务器并像其他字段一样保存。 我将该字段添加到产品表单tpl文件中并将其传递给checkout / cart控制器类和'add'方法,其中包含:

  data:$('#products input  [type = \'text \'],#product输入[type = \'hidden \'],#product输入[type = \'radio \']:选中,#product输入[type = \'checkbox \']  :选中,#product select,#product textarea,#choosed_color'),
   
 
 

在$('#button-cart')。on('click' 事件。

我可以使用以下方法访问'add'方法中的字段值:

  $ this-> request->  post ['choosed_color'] 
   
 
 

如何在购物车和预先考虑因素中显示它? thanks ...

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dpygo62420 2016-03-11 04:24
    已采纳

    You can define your own custom field in opencart for products. That is the precise and correct way of doing it. Or if you are a programmer, you can alter the code as well.

    点赞 评论

相关推荐 更多相似问题