简体   繁体   English

Magento:如何从捆绑的产品中检索选项信息?

[英]Magento : How to retrieve option information from a bundled product?

I have a bundled Product that contains 3 virtual products as options. 我有一个捆绑的产品,其中包含3个虚拟产品作为选项。

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. 对$ product-> getSku()的调用返回捆绑产品的sku。 I'd love to be able to grab the sku of the option that I selected, but cannot figure out how to do that. 我很希望能够掌握所选择选项的sku,但无法弄清楚该怎么做。

Thanks! 谢谢!

我通过侦听事件来处理此问题: checkout_cart_product_add_after并从已解决的QuoteItem中获取信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM