Magento:如何通过属性集过滤捆绑选项而不进行循环

时间:2012-06-11 07:05:44

标签: php magento

喜欢Inchoo的这段代码:http://inchoo.net/ecommerce/magento/magento-get-bundled-items-by-bundle-product/

$bundled_product = new Mage_Catalog_Model_Product();
$bundled_product->load(YOUR_BUNDLED_PRODUCT_ID);

$selectionCollection = $bundled_product->getTypeInstance(true)->getSelectionsCollection(
    $bundled_product->getTypeInstance(true)->getOptionsIds($bundled_product), $bundled_product
);

$bundled_items = array();
foreach($selectionCollection as $option)
{
    $bundled_items[] = $option->product_id;
}

如何仅按特定属性或属性集获取特定选项

0 个答案:

没有答案