Question

I'm trying to learn magento but I have to finish the project that I'm working on as fast as I can. So I'm stuck in somewhere. Then I decided to use pure sql. (I know it's really messy)

So is anynone know how can I get all products with sql? I researched database but can't find.

I need product name, thumbnail, price, rating, reviews count and attributes.

Was it helpful?

Solution

Do it clean!

<?php

require_once 'app/Mage.php';
umask(0);
Mage::app();

$collection = Mage::getResourceModel('reports/product_collection')
    ->addAttributeToSelect('*')
    ->addStoreFilter()
    ->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());

foreach ($collection as $product) {
    // build your JSON here
}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top