如何仅使用mysql在magento中拉出所有产品ID,skus,产品名称,描述,图像,类别?

问题描述:

如何仅使用MySQL将Magneto中的所有product id, skus, product names, description, images, category全部取出?如何仅使用mysql在magento中拉出所有产品ID,skus,产品名称,描述,图像,类别?

+0

请提供有关该问题的更多信息,以及迄今为止尝试过的方法? – Hawk 2014-09-02 08:44:31

+0

选择magento中的所有产品和类别并插入wordpress项目。 – 2014-09-02 08:46:48

SELECT p.`entity_id`, p.`sku`, pv.`value` as name, pt.`value` as description, GROUP_CONCAT(DISTINCT(cp.`category_id`) SEPARATOR ', ') as categories, GROUP_CONCAT(DISTINCT(pm.`value`) SEPARATOR ', ') as imagesPath 
FROM `catalog_product_entity` as p 
INNER JOIN `catalog_product_entity_varchar` as pv on pv.`entity_id` = p.`entity_id` and  pv.`attribute_id` = 71 
INNER JOIN `catalog_product_entity_text` as pt on pt.`entity_id` = p.`entity_id` and pt.`attribute_id` = 72 
INNER JOIN `catalog_category_product` as cp on cp.`product_id` = p.`entity_id` 
LEFT JOIN `catalog_product_entity_media_gallery` as pm on pm.`entity_id` = p.`entity_id` and pm.`attribute_id` = 88 
GROUP BY cp.`product_id`, pm.`entity_id` 

查询是专为EE v1.13.1.0应该适应其他版本,但重新检查attributeIds在eav_attribute

+0

感谢user3999607 – 2014-09-20 10:04:18

该查询返回产品名称,SKU,价格,图片,说明基于管理员STOREID &其他两个也..

SET @etype =(SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code ='catalog_product'); - 产品名称属性ID SET @name =(SELECT attribute_id FROM eav_attribute WHERE attribute_code = '名称' AND entity_type_id = @etype); - 产品图像属性ID SET @image =(SELECT attribute_id FROM eav_attribute WHERE attribute_code = '图像' AND entity_type_id = @etype);

- 产品价格属性ID

SET @price =(SELECT attribute_id FROM eav_attribute WHERE attribute_code = '价格' AND entity_type_id = @etype);

- 产品说明属性ID

SET @description =(SELECT attribute_id FROM eav_attribute WHERE attribute_code = '描述' AND entity_type_id = @etype);

- 查询 选择 e.entity_id AS 'ID', e.sku, v1.value '姓名', v2.value AS '形象', si.qty AS '库存数量' , d1.value AS '价格', s1.value AS '描述' FROM catalog_product_entityË LEFT JOIN cataloginventory_stock_item SI ON e.entity_id = si.product_id LEFT JOIN catalog_product_entity_varchar V1 ON e.entity_id = V1。 entity_id AND v1.store_id IN(0,1,2) 与v1.attribute_id = @name LEFT JOIN catalog_product_entity_varchar V2 ON e.entity_id = v2.entity_id AND v2.store_id IN(0,1,2) AND v2.attribute_id = @image LEFT JOIN
LEFT JOIN catalog_product_entity_decimal d1 ON e.entity_id = d1.entity_id AND d1。STORE_ID IN(0,1,2) AND d1.attribute_id = @price LEFT JOIN catalog_product_entity_text S1接通e.entity_id = s1.entity_id AND s1.store_id IN(0,1,2) AND s1.attribute_id = @description;