Magento:如何从捆绑产品中检索选项信息?
我有一个捆绑产品,其中包含 3 个虚拟产品作为选项。
当将商品添加到购物车时,我有一个观察者正在侦听事件,并且我很难弄清楚如何获取我在查看产品时选择的选项信息: 观察者的开始看起来像这样:
public function checkSubscriptionHierarchy(Varien_Event_Observer $observer) {
$event = $observer->getEvent();
$product = $event->getProduct();
...
调用 $product->getSku() 返回捆绑产品的 sku。我希望能够获取我选择的选项的 sku,但不知道如何做到这一点。
谢谢!
I have a bundled Product that contains 3 virtual products as options.
I have an observer that is listening to an event when an item is added to the cart and I'm having a hard time figuring out how to get the option information that I selected when looking at the product:
the start of the observer looks like this:
public function checkSubscriptionHierarchy(Varien_Event_Observer $observer) {
$event = $observer->getEvent();
$product = $event->getProduct();
...
the call to $product->getSku() returns the sku of the bundle product. I'd love to be able to grab the sku of the option that I selected, but cannot figure out how to do that.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过监听事件来处理这个问题:
checkout_cart_product_add_after
并从解决的 QuoteItem 中获取信息。I dealt with this by listening to event:
checkout_cart_product_add_after
and getting the info off the QuoteItem which worked out.