如何将用户选择的价格添加到购物车? (谷歌结帐)
此示例展示了如何添加字段让客户选择自己的价格。但该示例中的按钮用于快速结账。我正在尝试将客户选择的价格添加到购物车?我该怎么做?
我拥有的代码(谷歌应用程序引擎 - python)将商品添加到购物车,但没有添加价格;价格始终为零。这是我正在使用的代码:
self.response.out.write("""
$ <input type="text" name="item_price_1"/>
<div class="product">
<input type="hidden" class="product-title" value="%s">
<input type="hidden" class="product-attr-id" value="id#%s">
<div class="googlecart-add-button" tabindex="0" role="button" title="Add to cart">
</div></div>
这是沙箱脚本:
#sandbox script
self.response.out.write("""<script id='googlecart-script' type='text/javascript' src='https://checkout.google.com/seller/gsc/v2_2/cart.js?mid=1234567890' integration='jscart-wizard' post-cart-to-sandbox='true' currency='USD' productWeightUnits='LB'></script> """)
This example shows how to add a field to let customers to choose their own price. But the button in that example is for fast checkout. I am trying to add the customer-chosen price to cart? How do I do this?
The code that I have (google app engine - python) adds the item to the cart but not the price; the price is always zero. This is the code I am using:
self.response.out.write("""
$ <input type="text" name="item_price_1"/>
<div class="product">
<input type="hidden" class="product-title" value="%s">
<input type="hidden" class="product-attr-id" value="id#%s">
<div class="googlecart-add-button" tabindex="0" role="button" title="Add to cart">
</div></div>
And this is the sandbox script:
#sandbox script
self.response.out.write("""<script id='googlecart-script' type='text/javascript' src='https://checkout.google.com/seller/gsc/v2_2/cart.js?mid=1234567890' integration='jscart-wizard' post-cart-to-sandbox='true' currency='USD' productWeightUnits='LB'></script> """)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我解决了这个问题:
根据文档,javascript添加仅处理购物车中的商品
因此在
中添加了
$
作为class ="产品价格"
:I solved the problem:
According to documentation, javascript to add the items to cart only processes
So added
$ <input type="text" name="item_price_1"/>
inside the<div class="product">
asclass="product-price"
: