简体   繁体   中英

adding a field to opencart product form

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...

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM