Pages

Connect to the database in Magento

$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; }

All model you can use below code

$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()); }

No comments:

Post a Comment