[英]add custom value to cart from a form, prestashop
I'm creating a simple Prestashop module that places a form in CMS pages. 我正在创建一个简单的Prestashop模块,该模块将表单放置在CMS页面中。 That form will return a custom value (and a new product) that I need to be redirected to the cart after clicking a "submit" button.
该表格将返回自定义值(和新产品),单击“提交”按钮后,我需要将其重定向到购物车。
How can I send the data to the cart? 如何将数据发送到购物车?
Thank you! 谢谢!
Rui 瑞
Every customer has a unique cart ID. 每个客户都有唯一的购物车ID。 1 ) After submit put information to mysql table 2 ) hook module to cart step 3 ) Check if this customer and cart id equal and do what you need to do.
1)在将put信息提交到mysql表之后2)将模块挂接到购物车步骤3)检查此客户ID和购物车ID是否相等,然后执行您需要做的事情。
I think its easiest and simplest way to do it. 我认为这是最简单的方法。 Rather than override system files.
而不是覆盖系统文件。 Even more you talking about module.
您甚至在谈论模块。
There is a javascript class in prestashop to control the cart. prestashop中有一个javascript类来控制购物车。 Simply call ajaxCart.add(params)
只需调用ajaxCart.add(params)
This function will add the product to the cart with ajax. 此功能将使用ajax将产品添加到购物车。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.