Magento中是否有任何函数可以获取带有子ID数组作为输入的Parent ID(Grouped)



考虑以下情况(假设检索到的所有产品都属于分组产品)


$collection= Mage::getModel('catalog/product')->getCollection()
$productIds = $collection->getAllIds();

Magento中有任何函数可以获取上面数组"$productIds"中所有子id的父id吗?

ex : getAllGroupedParentIDs($productIds)

谢谢,

Balan

您可以为每个简单的产品ID检索一个分组产品ID数组,如下所示:

$parentIdArray = array();
foreach ($productIds as $productId) {
    $parentIdArray[$productId] = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($productId);
};

相关内容

最新更新