'How to get product details from Magento Database with mysql query?

I just want to know about how to get product details from magento database tables. I know how to run MySQL Query and get results from database. But the problem is magento database, I don't know which tables should I target.

I need to retrieve:

  1. SKU
  2. Name
  3. Short Description
  4. Thumbnail
  5. Category ID

But the problem is that magento have a huge database and I cannot find from which tables I can get these details.

I just need tables name from which I can get these details. Because I will be getting these details in a PHP file out of magento. So will be using mysql_query("SELECT * FROM which_table");

Please help :)

Omer



Solution 1:[1]

<?php
$product = Mage::getModel('catalog/product')->load(1);
echo $product->getSku() . '<br />';
echo $product->getName() . '<br />';
echo $product->getShortDescription() . '<br />';
foreach($product->getCategoryIds() as $categoryID){
    $category = Mage::getModel('catalog/category')->load($categoryID);
    echo $category->getId() . ' - ' . $category->getName() . '<br />';
}
if($product->getImage() == 'no_selection')
{
     // PRODUCT HAVE NO IMAGE
}
else
{
     // PRODUCT HAVE IMAGE
     if (count($product->getGalleryImages()) > 0) {
        foreach ($this->getGalleryImages() as $image) {
            echo $image->getLabel() . ' <br />';
        }
     }
}
?>

Solution 2:[2]

The primary table in which Magento 1 stores products is catalog_product_entity.

However, due to the EAV model almost no useful data other than the ID is actually stored there. You will likely need to JOIN on the eav_attribute table to find what properties are available, and then JOIN on the catalog_product_entity_* tables to actually get the useful data.

For this reason, I highly suggest working within Magento itself. If the goal is to get data via a script, then look at N98 or consider writing your own Magento 1 script which you can then invoke from other scripts.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dexxtz
Solution 2 dotancohen