Magento - assign multiple product ids to a category

Andrei Dinu

I have a category "new" that I want to assign to, via a daily cron, the most recent 120 products. I am trying to override the product ids assigned to a category. Is there an easy way , like :

$category->setProductIds(array())

Andrei Dinu

it works like this

$category = Mage::getModel('catalog/category')->load($categoryID);
$product_array = $category->getProductsPosition()
... make changes ... format : $item[$product_id] => $position_in_category
$category->setPostedProducts($product_array);
$category->save();

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Adding multiple category ids in magento

From Dev

Getting product category ids in Magento block

From Dev

Assign multiple category IDs to a post

From Dev

Magento - How to assign product to Category by Sku?

From Dev

Magento: assign all product to Default Category

From Dev

Magento - How to assign product to Category by Sku?

From Dev

Magento: assign all product to Default Category

From Dev

how to assign random product positions in Magento category?

From Dev

Get product category IDs from Magento v2.0 SOAP API

From Dev

catalogProductUpdate multiple category IDs

From Dev

catalogProductUpdate multiple category IDs

From Dev

Assign <a> tag with multiple IDs

From Dev

Magento Google Analytics Product Category not set

From Dev

Product in category not showing when search that term (Magento)

From Dev

Retrieve Product's Top Category from Magento

From Dev

Show Sale product on category view page Magento

From Dev

Magento Google Analytics Product Category not set

From Dev

Magento remove product from category programmatically

From Dev

Product in category not showing when search that term (Magento)

From Dev

Magento 2 Add product to category (code)

From Dev

To get product collections by some range of ids in magento

From Dev

how to get category name of current product (on product detail page) in magento

From Dev

Search Product by name in magento and get array of product ids

From Dev

assign a product attribute value to another product attribute in magento

From Dev

Product ID that has Two different category IDs in a catalog database

From Dev

Product ID that has Two different category IDs in a catalog database

From Dev

Create category programmatically in multiple languages in Magento

From Dev

Magento - get specific category name from product id

From Dev

Magento get category collection for product - multi site specific

Related Related

  1. 1

    Adding multiple category ids in magento

  2. 2

    Getting product category ids in Magento block

  3. 3

    Assign multiple category IDs to a post

  4. 4

    Magento - How to assign product to Category by Sku?

  5. 5

    Magento: assign all product to Default Category

  6. 6

    Magento - How to assign product to Category by Sku?

  7. 7

    Magento: assign all product to Default Category

  8. 8

    how to assign random product positions in Magento category?

  9. 9

    Get product category IDs from Magento v2.0 SOAP API

  10. 10

    catalogProductUpdate multiple category IDs

  11. 11

    catalogProductUpdate multiple category IDs

  12. 12

    Assign <a> tag with multiple IDs

  13. 13

    Magento Google Analytics Product Category not set

  14. 14

    Product in category not showing when search that term (Magento)

  15. 15

    Retrieve Product's Top Category from Magento

  16. 16

    Show Sale product on category view page Magento

  17. 17

    Magento Google Analytics Product Category not set

  18. 18

    Magento remove product from category programmatically

  19. 19

    Product in category not showing when search that term (Magento)

  20. 20

    Magento 2 Add product to category (code)

  21. 21

    To get product collections by some range of ids in magento

  22. 22

    how to get category name of current product (on product detail page) in magento

  23. 23

    Search Product by name in magento and get array of product ids

  24. 24

    assign a product attribute value to another product attribute in magento

  25. 25

    Product ID that has Two different category IDs in a catalog database

  26. 26

    Product ID that has Two different category IDs in a catalog database

  27. 27

    Create category programmatically in multiple languages in Magento

  28. 28

    Magento - get specific category name from product id

  29. 29

    Magento get category collection for product - multi site specific

HotTag

Archive