Wednesday, 24 May 2017

How do I change the default value of the “position” category attribute? in magento

You can change directly in this 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.

Wednesday, 28 September 2016

Magento : Item (Mage_Catalog_Model_Product) with the same id already exist

We have fixed this issue in magento core file.
lib/Varien/Data/Collection.php

public function addItem(Varien_Object $item)
   {  $itemId = $this->_getItemId($item);
       if (!is_null($itemId)) {
           if (isset($this->_items[$itemId])) {
             //  throw new Exception('Item ('.get_class($item).') with the same id "'.$item->getId().'" already exist');
           } else {
               $this->_items[$itemId] = $item;
           }
       }
       else {
           $this->_items[] = $item;
       }
       return $this;

   }