2014-12-03 88 views

回答

1

你可以只嘗試將條目添加到catalog_category_product表..:

INSERT IGNORE INTO catalog_category_product (category_id, product_id) 
SELECT ccp.category_id, cpr.child_id FROM catalog_product_entity cpe 
JOIN catalog_product_relation cpr ON cpr.parent_id = cpe.entity_id 
JOIN catalog_category_product ccp ON cpe.entity_id = ccp.product_id 
WHERE cpe.type_id = 'grouped' 
ORDER BY cpe.entity_id 
; 

下面的SQL將增加它們與任何分組產品所有類別的該分組的產品分配相關聯的所有簡單的產品。我剛纔寫道,並沒有測試它,所以一定要在啓動PRODUCTION db之前測試它;-)

相關問題