2017-02-21 51 views
0

我为我的网站使用Github页面,并且它不允许PHP。Simplecart可以与jotform集成吗?

但因为我在做一个电子商务网站,我需要一个购物车 - 与按钮“项目添加到购物车”和“结账”。

这个想法是,在结帐时,用户将不得不填写姓名,地址,电子邮件和联系电话。而他/她在购物车中的订单将成为默认邮件正文。

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

回答

0

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 >> $100 x 2 = $200 
2. product 2 >> $75 x 3 = $225 

Total = $425 
+0

谢谢你,为我工作! – sophie

相关问题