MySQL 如何使用 SQL 在 magento 中获取产品 ID 和 sku
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14769446/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to get product id and sku in magento with SQL
提问by Abude
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.
我正在尝试使用 SQL 获取 magento 中每个产品的产品 ID 和 SKU,我发现该表catalog_product_entity
包含所有 SKU 但没有产品 ID。
回答by Domen Vrankar
entity_id is product's unique id so if you call $product->getId();
you actually get entity_id
entity_id 是产品的唯一 id,所以如果你打电话,$product->getId();
你实际上会得到 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...
该列名称的原因是产品是 EAV(实体属性值)模型,因此产品是实体 - 标准化的 EAV 实体标识列名称,但它会带来混淆......
And the query:
和查询:
SELECT entity_id as product_id, sku FROM catalog_product_entity
回答by Chris
The column 'entity_id' isthe ID for the products. So the catalog_product_entity
table does contain both items.
'entity_id' 列是产品的 ID。所以该catalog_product_entity
表确实包含这两个项目。