リソース モデルまたはエンティティを使用しようとしていますか? 生の SQL を使用してテーブルをクエリする方法を次に示しますが、テーブル名を知る必要があります。
$w = Mage::getSingleton('core/resource')->getConnection('core_write');
$result = $w->query('select entity_id from catalog_product_entity');
if (!$result) {
return false;
}
$row = $result->fetch(PDO::FETCH_ASSOC);
if (!$row) {
return false;
}
使用できるすべてのモデルを試す場合
$products = Mage::getModel('catalog/product')->getCollection();
$products->addAttributeToFilter('entity_id', array('in' => array(1,2)));
$products->addAttributeToSelect('*');
$products->load();
foreach ($products as $_prod) {
var_dump($_prod->getData());
}
カスタムモジュールに2番目の方法を使用していますが、うまくいきました。この回答が役立つことを願っています:)