I would like to update the default position value that products are assigned when they are added to a category. When you update a category from the categories editor, new products are saved with a position of 0. When you add a product to a category via the tree when filling out the product, it saves with a position value of 1.

What I want to do is have items save with a position of 100 instead of 1.

1 Answer 1


You need to rewrite the method Mage_Catalog_Model_Resource_Product::_saveCategories
Somewhere in there this is this:

$data[] = array(
    'category_id' => (int)$categoryId,
    'product_id'  => (int)$object->getId(),
    'position'    => 1

Replace 1 with 100.
To rewrite the resource model add this to the config.xml of your custom module inside the global tag


Then create the class [Namespace]_[Module]_Model_Resource_Product that extends Mage_Catalog_Model_Resource_Product, copy the method _saveCategories to it and replace 1 with 100.

  • Anyone coming here looking (like I was) for the Magento 2 version of this answer, the location is module-catalog/Model/Category/Link/SaveHandler.php
    – S Adamson
    Dec 17, 2019 at 2:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.