从Magento中的catalog_product_bundle_selection表中获取模型


Get model from table catalog_product_bundle_selection in Magento

如何从表catalog_product_bundle_selection中获取集合?我已经试过了

  • getModel(目录/product_bundle_selection)
  • getModel(包/选择)

我在命令行上尝试了一下,它确实为我工作了:

$collection = Mage::getModel('bundle/selection')->getCollection();
foreach($collection as $row){
    echo print_r($row->getData(), true);
}

不确定你是不是在找别的东西

正确的方法是调用

Mage::getModel('bundle/selection')->getCollection();

您可以在位于app/code/core/Mage/Bundle/etc/config.xml的文件中看到,表catalog_product_bundle_selection位于标记<selection><bundle_resource> xml标记中。您也可以在打开app/code/core/Mage/Bundle/Model/Selection.php时检查这一点:在_construct()方法中,称为$this->_init('bundle/selection');,它将实体表映射为这个分组符号