Magento 根据数量自动添加项目
我正在设计一个带有按钮的自定义产品页面,单击该按钮时我需要发出一个带有“是”或“否”选项的警报。
如果选择“是”,我需要发生以下情况。
根据产品数量(即 1 和 1 之间)将另一个产品添加到购物车中。 2 项目在 3 和 3 之间添加产品 A 4 件产品 B,介于 5 和 5 之间12产品C等。
您知道实现此目标的最佳方法吗?
它必须是警报样式的弹出窗口(首选 ajax 弹出窗口),不能是产品页面上的复选框。
谢谢!
I'm designing a custom product page with a button that when clicked I need to have an alert come up with a "Yes" or "No" option.
If "Yes" is selected I then need the following to happen.
Add another product into the cart based on the products quantity i.e. between 1 & 2 items add product A between 3 & 4 Items product B, between 5 & 12 product C and so on.
Any idea of the best way to accomplish this?
It has to be a alert style popup (ajax popup preferred) cannot be a checkbox on the product page.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
所以我找到了解决问题的方法...我正在使用简单模态(TheBlackBenzKid 暗示我),我要么从自定义按钮调用,要么使用“添加到购物车”按钮调用。这反过来将重定向到一个 php 页面,该页面将重定向到购物车。对于 php 页面,我将只包含将商品放入购物车的代码,任何人都可以弄清楚如何根据自己的需要对其进行自定义。
我还从这个人的博客中找到了一些信息,我将链接到文章
如何从外部站点将产品添加到 Magento
我很乐意回答任何有关此的问题...
So I've come across a solution to my problem... I'm using a Simple Modal (That TheBlackBenzKid hinted me to) that I'm either going to call from a custom button or with the add to cart button. This in turn will redirect to a php page that will redirect to the cart. For the php page I'll just include the code to put a item into the cart from there anyone could figure out how to customize it to there own needs.
I also found some of this information from this guys blog I'll link to the article
How to add a product from an external site into Magento
I'm happy to answer any questions on this...
这不是最好的答案,但可以帮助您入门的代码:
您可以使购物车功能使用:
和您的表单代码:
然后只需在页面 XML 标头中调用外部 JavaScript 并将其添加到购物车,以便始终检查 JS 文件并验证弹出窗口。
This is not the best answer, but code to get you started:
You could make the cart function use:
And your form code:
And then just call an external JavaScript in your page XML headers and add it to cart so that JS file will always be checked and validate the popup.