simplecart可以和jotform集成吗?

Can simplecart be integrated with jotform?

我正在为我的网站使用 Github 个页面,它不允许 PHP。

但是因为我在做一个电子商务网站,所以我需要一个购物车——带有按钮“将商品添加到购物车”和“结帐[=” 20=]”。

想法是,在结帐时,用户必须填写姓名、地址、电子邮件和联系电话。购物车中的 his/her 笔订单将作为默认消息正文。

我可以将 simplecart.js 集成到 Jotform 中吗? (订单将作为Jotform消息正文的参数发送)

simplecart-js 是我最喜欢的购物车脚本,我制作的每个需要结帐功能的网站都在使用它。

它有很好的documentation 根据您的需要,要获得 simplecart 项目,您可以使用 simplecart.each 函数。

可能是这样的:

var cart = '', total = 0;
simpleCart.each(function(item, i){
   var subtotal = item.get('price') * item.get('quantity');
   cart += i + '. ' + item.get('fullname') + ' >> $' + item.get('price') + ' x ' + item.get('quantity') + ' = $' + subtotal + '\n';
   total += subtotal;
});
cart += '\n\nTotal = $' + total;
$('#messagebody').val(cart);

内容正文的输出将是这样的:

1. product 1 >> 0 x 2 = 0
2. product 2 >>  x 3 = 5

Total = 5