Jun 11, 2014

Magento - Adding existing product to new category via SQL

Most the time you edit the the product to assign the category or edit category and assign the products. Since magento admin is some too small on thousand product of catalog. Adding via SQL Query will faster to assigned.

Adding the Product into a category
INSERT INTO
catalog_category_product(category_id, product_id,position ) 
VALUES(48,85545,2);

Adding the Product to webstore
INSERT INTO catalog_category_product_index(
    category_id,
    product_id,
    position,
    is_parent,
    store_id,
    visibility
)
VALUES(
    48, -- CategoryID 
    85545, -- Product ID
    1, -- Posistion Normaly 1(1)
    1, -- Parent category ID
    3, -- Store ID
    4, -- Visibility
);

No comments: