My products assigned as sub categories and child categories, how to assign all products in a category to it's parent categories.
eg:
Books/Children/Boys, Now the products assigned with Boys child category, how to assign parent category Books.
@rahul Gupta My magento version 1.9. can i get help regard magento 1.9.
@rahulGupta Yes i did, following is my sql query you can run,
SELECT stat.sku, stat.NAME, SUM(qty_ordered) AS qty, SUM(row_total) AS total,let.category_name ,price ,gal.VALUE AS get_image,product_id FROM ( SELECT order_id, product_type, sku, NAME, qty_ordered, price, row_total,product_id FROM `sales_flat_order` AS so INNER JOIN `sales_flat_order_item` AS si ON si.order_id=so.entity_id AND so.state = 'complete' AND so.customer_email != 'one@giri.in' AND so.customer_email != 'two@giri.in' AND so.customer_email != 'three@gmail.com' ) stat INNER JOIN (SELECT VALUE,entity_id FROM catalog_product_entity_media_gallery ) AS gal ON gal.entity_id = stat.product_id INNER JOIN (SELECT e.sku, ( SELECT GROUP_CONCAT(DISTINCT(cv.value)) FROM catalog_category_entity_varchar AS cv, catalog_category_product AS at_category_id WHERE at_category_id.category_id = cv.entity_id AND (at_category_id.product_id = e.entity_id) AND cv.attribute_id = 41 AND cv.store_id = 0 AND cv.value='Dance & Fashion Jewellery') AS category_name FROM catalog_product_entity AS `e` ) AS let ON let.sku = stat.sku WHERE category_name != 'NULL' GROUP BY stat.product_type, stat.sku, stat.name ORDER BY qty DESC LIMIT 20;
According to above query if i add products to parent-id category then only my products come to the list.
@Aveeva you just have to go to each subcategory and make Is Anchor to yes from admin.
All the products gets automatically assigned to its parent category.
Thanks
@Aveeva if your problem is solved then you can Accept it as Solution so that it may be helpful for others.
Thanks