我必须获取每个商品的类别名称,品牌名称,产品名称和平均售价。我不熟悉magento和magento数据库,我只是将数据库用于另一个网站模块,该模块从未使用过magento CMS,而仅获得了一件商品的平均售价以及上述其他详细信息。
我已经使用过此查询:
SELECT `e`.`sku`, IF(at_name.value_id > 0, at_name.value, at_name_default.value) AS `name`,
IF(at_description.value_id > 0, at_description.value, at_description_default.value) AS `description`
FROM
`catalog_product_entity` AS `e`
INNER JOIN
`catalog_product_entity_varchar` AS `at_name_default`
ON (`at_name_default`.`entity_id` = `e`.`entity_id`) AND
(`at_name_default`.`attribute_id` = (SELECT attribute_id FROM `eav_attribute` ea LEFT JOIN `eav_entity_type` et ON ea.entity_type_id = et.entity_type_id WHERE `ea`.`attribute_code` = 'name' AND et.entity_type_code = 'catalog_product')) AND
`at_name_default`.`store_id` = 0
LEFT JOIN
`catalog_product_entity_varchar` AS `at_name`
ON (`at_name`.`entity_id` = `e`.`entity_id`) AND
(`at_name`.`attribute_id` = (SELECT attribute_id FROM `eav_attribute` ea LEFT JOIN `eav_entity_type` et ON ea.entity_type_id = et.entity_type_id WHERE `ea`.`attribute_code` = 'name' AND et.entity_type_code = 'catalog_product')) AND
(`at_name`.`store_id` = 1)
INNER JOIN
`catalog_product_entity_text` AS `at_description_default`
ON (`at_description_default`.`entity_id` = `e`.`entity_id`) AND
(`at_description_default`.`attribute_id` = (SELECT attribute_id FROM `eav_attribute` ea LEFT JOIN `eav_entity_type` et ON ea.entity_type_id = et.entity_type_id WHERE `ea`.`attribute_code` = 'description' AND et.entity_type_code = 'catalog_product')) AND
`at_description_default`.`store_id` = 0
LEFT JOIN
`catalog_product_entity_text` AS `at_description`
ON (`at_description`.`entity_id` = `e`.`entity_id`) AND
(`at_description`.`attribute_id` = (SELECT attribute_id FROM `eav_attribute` ea LEFT JOIN `eav_entity_type` et ON ea.entity_type_id = et.entity_type_id WHERE `ea`.`attribute_code` = 'description' AND et.entity_type_code = 'catalog_product')) AND
(`at_description`.`store_id` = 1)
LIMIT 2;");
但是它仅显示sku,产品名称和说明。我只是从这里得到的: How to pull all the product id, skus, product names, description in magento using only mysql?
我需要同时选择类别名称,品牌名称,产品名称和平均售价,我希望品牌名称与产品名称分开。谢谢!