我使用订单号获取以下信息。 如何找到产品父类型产品是捆绑产品。
<?php
require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app("default");
$orderNumber = 260038;
$order = Mage::getModel('sales/order')->loadByIncrementId($orderNumber);
// get order item collection
$orderItems = $order->getItemsCollection();
$skuQtyArray = array();
foreach ($orderItems as $item)
{
$product_id = $item->product_id;
//**How to find here if above product's parent was a bundle product**
}
?>
答案 0 :(得分:2)
你可以这样检查
<?php
require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app("default");
$orderNumber = 260038;
$order = Mage::getModel('sales/order')->loadByIncrementId($orderNumber);
// get order item collection
$orderItems = $order->getItemsCollection();
$skuQtyArray = array();
foreach ($orderItems as $item)
{
$product_id = $item->product_id;
$_product=Mage::getModel('catalog/product')->load($product_id);
if ($_product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
echo 'Bundled';//Do your stuf here
}
//**How to find here if above product's parent was a bundle product**
}
?>