Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento-获取已订购捆绑项目的子项/选项_Magento - Fatal编程技术网

Magento-获取已订购捆绑项目的子项/选项

Magento-获取已订购捆绑项目的子项/选项,magento,Magento,我很难获得所有的子产品以及订购的捆绑产品的选项。这是可能的吗?以下是您如何找到哪些产品应该与列表中的捆绑产品以及所有其他项目连接在一起: foreach ($order->getAllItems() as $item) { //if a product has parents (simple product of configurable/bundled/grouped product) load his Parent product type if ( $item-&

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

以下是您如何找到哪些产品应该与列表中的捆绑产品以及所有其他项目连接在一起:

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)
          }
      }
}

可能是捆绑选项的重复。我需要访问与捆绑产品捆绑在一起的实际项目。您是否尝试过$order->getAllItems(),它应该会返回所有产品?这很好。但是,这些项目似乎没有以任何方式链接到捆绑产品。它只是一个有序的每个项目的列表,没有任何绑定的层次结构。你知道我如何知道哪些产品应该与列表中的捆绑产品以及所有其他项目一起附加在一起吗?非常有用!!我要试试这个。