Magento-从产品id获取捆绑产品id的列表
假设我加载我的产品对象:Magento-从产品id获取捆绑产品id的列表,magento,bundle,product,Magento,Bundle,Product,假设我加载我的产品对象: $product = Mage::getModel('catalog/product')->load($productId); 是否有提取与此产品相关的捆绑ID的功能或方法 e、 g 试试这个- $collection = $product->getTypeInstance(true) ->getSelectionsCollection( $product->getTypeInstance(true)
$product = Mage::getModel('catalog/product')->load($productId);
是否有提取与此产品相关的捆绑ID的功能或方法
e、 g
试试这个-
$collection = $product->getTypeInstance(true)
->getSelectionsCollection(
$product->getTypeInstance(true)
->getOptionsIds($product), $product);
foreach ($collection as $item) {
# $item->product_id has the product id.
}
以下方面应起作用:
$product->getTypeInstance(true)->getChildrenIds($product->getId(), false)
结果是一个多维数组,顶级为选项,子级为产品
此外,您可以将false改为true,它只返回捆绑包的必需选项。Lee您今天是我的英雄!!
$product->getTypeInstance(true)->getChildrenIds($product->getId(), false)