Magento-从产品ID获取捆绑的产品ID的列表 [英] Magento - get a list of bundled product ids from a product id

查看:72
本文介绍了Magento-从产品ID获取捆绑的产品ID的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以说我加载了我的产品对象:

Lets say I load my product object:

$product = Mage::getModel('catalog/product')->load($productId);

是否存在提取与该产品相关的捆绑ID的功能或某种方式?

Is there a function or some way to extract the bundled ids related to this product?

例如

$product->getBundledProductIDs()

推荐答案

以下方法应该起作用:

$product->getTypeInstance(true)->getChildrenIds($product->getId(), false)

结果是一个多维数组,其中顶层是选项,而选项的子元素是乘积.

The result is a multi-dimensional array with the top level being options and the children of options being products.

此外,您可以将 false 更改为 true ,它将仅返回捆绑软件的必需选项.

Also, you can change the false to a true and it will only return required options of the bundle.

这篇关于Magento-从产品ID获取捆绑的产品ID的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆