在电子商务应用程序中添加其他项目以保存在会话中
我想使用这个网站作为参考来解释我想弄清楚的内容。 http://www.shop-script.com/demo/ store/index.php?lang=eng
如果您选择产品,请输入大于 1 的值作为您想要的产品数量,然后按“添加到购物车”。我知道这些信息会进入会话,但它是如何添加的?
我所知道的是,创建或存在名为 cart 的会话,并且将产品 ID 插入到该会话中,看起来像这样:
$_SESSION['cart'] = "100" //product id
如何插入在产品详细信息页面上输入的数量?这是让我困惑的一件事。谢谢
i want to use this site as a reference to explain what im trying to figure out.
http://www.shop-script.com/demo/store/index.php?lang=eng
if you select a product then enter a value higher than 1 for the quantity of a product that you want then press add to cart. i know that this information goes into a session but how is it added?
what i do know is say a session named cart is created or exists and the products id is inserted into the session to look like something like this:
$_SESSION['cart'] = "100" //product id
how can i insert the amount of quantities that were entered on the products detail page? that is one thing that is confusing me. thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需使用产品 ID 作为保存数量的会话变量中的键即可:
Just use the product ID as a key in a session variable holding the quantity: