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

查看:26
本文介绍了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天全站免登陆