#StackBounty: #magento-1.9 #php Magento add position 999 when assign product to category

Bounty: 50

I’m using Magento 1.9.x and trying to change default position number of products.

Ex, when we assign product to category via product page i need to set it to 999 position

enter image description here

I changed default position field value of catalog_category_product table

enter image description here

But nothing changed.

i changed magentoappcodecoreMageCatalogModelResourceCategory.php

/**
         * Add products to category
         */
        if (!empty($insert)) {
            $data = array();
            foreach ($insert as $productId => $position) {
                $data[] = array(
                    'category_id' => (int)$id,
                    'product_id'  => (int)$productId,
                    'position'    =>  (int)$position ? (int)$position : 999
                );
            }
            //(int)$position
            $adapter->insertMultiple($this->_categoryProductTable, $data);
        }

but it only effect when adding products to category via category page.

anyone know a solution for this please, Thank You


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.