3

我很难获得所有子产品及其订购捆绑商品的选项。这可能吗?

4

1 回答 1

3

以下是您如何找出哪些产品应该附加到列表中的捆绑产品以及所有其他项目:

foreach ($order->getAllItems() as $item) {
     //if a product has parents (simple product of configurable/bundled/grouped product) load his Parent product type
     if ( $item->getParentItemId()) {
         $parent_product_type = Mage::getModel('sales/order_item')->load($item->getParentItemId())->getProductType();
          //if Parent product type is Bundle
          if ($parent_product_type == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
              // your code goes here (do whatever you need to do)
          }
      }
}
于 2013-06-28T15:28:57.887 回答