Magento 1.9尝试向查询添加图像名称,价格

我有一个查询,从Magento中提取product_id,product_name,category_id,category_name。

我不确定如何更新查询以获取产品使用的图像名称和价格。

我目前有以下查询:

SELECT product_id,product_name,product_path,GROUP_concat(DISTINCT(category_id)) AS category_ids,GROUP_concat(DISTINCT(category_name)) AS category_name,GROUP_concat(DISTINCT(path)) AS category_path FROM (
SELECT DISTINCT B.*,cpev.`value` AS product_path FROM   (SELECT A.*,cv.value AS `category_name`,cc1.value AS path  FROM (
        SELECT
            ct_catalog_product_entity_varchar.entity_id AS product_id,ct_catalog_product_entity_varchar.`value` AS product_name,ct_catalog_product_entity.sku,`at_category_id`.`category_id`
        FROM ct_catalog_product_entity_varchar
        INNER JOIN ct_catalog_product_entity ON ct_catalog_product_entity_varchar.entity_id = ct_catalog_product_entity.entity_id
        LEFT JOIN `ct_catalog_category_product` AS `at_category_id` ON (at_category_id.`product_id`= ct_catalog_product_entity.entity_id)
        WHERE ct_catalog_product_entity_varchar.entity_type_id = (
            SELECT entity_type_id FROM ct_eav_entity_type WHERE entity_type_code = 'catalog_product' )
        AND ct_catalog_product_entity_varchar.attribute_id = (
            SELECT attribute_id FROM ct_eav_attribute WHERE attribute_code = 'name' AND entity_type_id = (
            SELECT entity_type_id FROM ct_eav_entity_type WHERE entity_type_code = 'catalog_product' ))
    ) AS A
    INNER JOIN `ct_catalog_category_entity` AS cat ON cat.`entity_id` = A.category_id
    JOIN `ct_catalog_category_entity_varchar` AS cv ON cat.entity_id = cv.`entity_id`
    JOIN ct_catalog_category_entity_varchar cc1 ON cv.entity_id=cc1.entity_id 
    JOIN `ct_eav_attribute` AS att ON att.`attribute_id` = cv.`attribute_id`
    JOIN `ct_eav_entity_type` AS aty ON att.`entity_type_id` = aty.`entity_type_id`
    WHERE aty.`entity_model` = 'catalog/category' AND att.`attribute_code` = 'name' AND cc1.attribute_id IN (SELECT attribute_id AS attr FROM ct_eav_attribute WHERE attribute_code='url_path')
) AS B
JOIN ct_catalog_product_entity_varchar AS cpev ON cpev.`entity_id` = B.product_id
WHERE product_name IS NOT NULL AND cpev.`attribute_id` IN (SELECT attribute_id FROM ct_eav_attribute WHERE attribute_code = 'url_key')) sub_query GROUP BY product_id
koto21cn 回答:Magento 1.9尝试向查询添加图像名称,价格

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3108934.html

大家都在问