Created
June 24, 2015 20:05
-
-
Save ryaan-anthony/c2d64e1b1435c9c01ec3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Set product positions within a selected category | |
| $cat_id = CATEGORY_ID; | |
| $category = Mage::getModel('catalog/category')->load($cat_id); | |
| $cat_api = new Mage_Catalog_Model_Category_Api; | |
| $products = $category->getProductCollection(); | |
| foreach ($products as $product){ | |
| $new_order = NEW_POSITION; | |
| $cat_api->assignProduct($category->getId(), $product->getId(), $new_order); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment