Magento:编辑报价项目中捆绑选项的数量并更新价格
我正在使用 Magento 捆绑产品,其中包含隐藏的捆绑选项,需要以编程方式更新数量。从购物车编辑捆绑数量时会出现问题。我设置了一个按钮,用于将捆绑报价项目提交到我自己的 CartController 中的 updateLineItemAction() 方法,以处理隐藏捆绑选项的更新。
updateLineItemAction() 方法找到隐藏的捆绑选项,并将更新的数量分配给“selection_qty_X”和“product_qty_X”属性,其中 X 是捆绑选项的 ID。 “info_buyRequest”中的值也会更新。保存报价项目后,会重定向到购物车以显示更新的购物车值。
更新的数量在购物车中正确显示,并且隐藏的捆绑选项已分配正确的数量。问题是捆绑商品价格尚未更新以反映隐藏捆绑选项上的更新数量。我在 Magento 1.1.x 中做了类似的事情,效果很好。现在在 1.4.1.2 中执行此操作,保存报价项目时价格不会自动更新。我尝试在更新商品后再次保存报价和购物车,但这似乎没有任何效果。
当子项目数量发生变化时,重新计算报价项目价格的正确方法是什么?是否有更好的方法来更改报价项目捆绑选项的数量,以便正确更新捆绑项目的价格?
I am working with Magento bundle products that contain hidden bundle options that need to have the quantity updated programmatically. A problem arises when the bundle quantity is edited from the shopping cart. I have a button set up to submit the bundle quote item to an updateLineItemAction() method in my own CartController to handle the update of the hidden bundle option.
The updateLineItemAction() method locates the hidden bundle option and assigns the updated quantity to the "selection_qty_X" and "product_qty_X" properties, where X is the ID of the bundle option. Values in the "info_buyRequest" are also updated. After saving the quote item, there's a redirect to the cart to show the updated cart values.
The updated quantity is displayed correctly in the cart, and the hidden bundle option has the correct quantity assigned. The problem is that the bundle item price has not updated to reflect the updated quantity on the hidden bundle option. I did something similar to this in Magento 1.1.x and it worked fine. Doing this now in 1.4.1.2, the price is not automatically updated when the quote item is saved. I've tried saving the quote and the cart again after updating the item, but that doesn't seem to have any effect.
What is the proper way to recalculate the price for a quote item when subitems have had the quantity changed? Is there a better way to change the quantity of a quote item bundle option so that the price of the bundle item is updated correctly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的案例的解决方案是更新我原始帖子中所述的选择的数量值,并调整分配给与隐藏捆绑选项关联的捆绑项目的数量。在 Magento 1.4 之前的版本中,最后一步不是必需的。
The solution for my case was to update the quantity values of the selections as noted in my original post, and also to adjust the quantity assigned to the bundle item associated with the hidden bundle option. This last step was not necessary in versions prior to Magento 1.4.