Magento: get product store_ids and category ids

This MySQL query gets the store_ids of each product in Magento database.

 SELECT DISTINCT cpe.sku, group_concat(DISTINCT cs.code ORDER BY cs.code) AS websites FROM catalog_product_entity cpe 
 JOIN catalog_product_website cpw ON cpe.entity_id=cpw.product_id
 JOIN core_store cs ON cs.website_id = cpw.website_id
 GROUP BY cpe.sku
 ORDER BY cpw.website_id;

This MySQL query gets the category ids of each product in Magento database.

SELECT DISTINCT cpe.sku, group_concat(ccp.category_id ORDER BY ccp.category_id) AS category_id 
FROM catalog_product_entity cpe
JOIN catalog_category_product ccp ON cpe.entity_id=ccp.product_id
GROUP BY cpe.sku;

Search within Codexpedia

Custom Search

Search the entire web

Custom Search