简体   繁体   中英

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

<?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 />';
        }
     }
}
?>

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM