我很难获得所有儿童产品及其订购捆绑产品的选项。这可能吗?
答案 0 :(得分: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)
}
}
}