【问题标题】:Magento - get list all bundled productsMagento - 获取所有捆绑产品的列表
【发布时间】:2013-05-23 13:22:31
【问题描述】:

我使用的是 magento 1.7 版。

我想在 view.phtml 文件中显示所有捆绑的产品。

我使用以下链接获取捆绑产品中的产品列表。

Magento - get a list of bundled product ids from a product id

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

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

如何显示所有捆绑产品

【问题讨论】:

    标签: magento magento-1.7 bundle product


    【解决方案1】:

    您可以按类型过滤产品集合:

    $products = Mage::getModel('catalog/product')->getCollection()
        ->addAttributeToSelect('*')
        ->addAttributeToSelect('type')
        //->addAttributeToFilter('type_id', 'bundle') // simpler..
        ->addFieldToFilter('type_id', array('eq' => 'bundle')) // simple/configurable etc
    ;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-02
      • 2013-06-16
      • 1970-01-01
      • 2012-02-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多