Abude
Abude

Reputation: 2162

how to get product id and sku in magento with SQL

i'm trying to get the product id and the SKU of each product in magento with SQL, i fount that the table catalog_product_entity has all the SKUs but no product id.

Upvotes: 10

Views: 27947

Answers (2)

Chris
Chris

Reputation: 4080

The column 'entity_id' is the ID for the products. So the catalog_product_entity table does contain both items.

Upvotes: 1

Domen Vrankar
Domen Vrankar

Reputation: 1743

entity_id is product's unique id so if you call $product->getId(); you actually get entity_id

The reason for that column name is that product is an EAV (Entity Attribute Value) model so product is an entity - standardized EAV entity identification column name but it can bring confusion...

And the query:

SELECT entity_id as product_id, sku FROM catalog_product_entity

Upvotes: 22

Related Questions