Your Location is: Home > Php

magento how to get attributes associated with a single product using database query

From: Austria View: 4461 Megha Kalra 

Question

We are trying to get all attributes associated with each product using a database.

We have been used following query but I think the table we are using is not the right one.

$sql = "SELECT attribute_id FROM catalog_product_index_eav WHERE entity_id=".$entityprodid;

This table is not the exact table which will get all attributes attached to a single product id.

Any suggestions how do we get attributes of a single product in Magento using database ??

Best answer

Magento uses flat tables to centralize the attributes of products, so to query all the attributes by the ID, you can use the table catalog_product_flat, remembering that for this table to be updated, it is necessary to reindex the data.