De Angel Net Posted July 1, 2012 Share Posted July 1, 2012 I have got error "An error occured while linking object product to categories" after failed upgrade from 1.4.4 to 1.4.8.2 I have upload the backup of my 1.4.4 prestashop but i always get that error when add a new product (if i checklist any sub categories when add my product) So if i go into the sub categories first, then add new product and don't checklist anything it is ok. But if i checklist any sub categories the error "An error occured while linking object product to categories" always shown, even i add it from home or any sub categories. What steps i have tried. 1. Clear my browser coockies and cache 2. go to phpmyadmin and alter auto increment to 1 for ps_product and ps_category 3. change part of category.php public static function duplicateProductCategories($id_old, $id_new) { $result = Db::getInstance()->ExecuteS(' SELECT `id_category` FROM `'._DB_PREFIX_.'category_product` WHERE `id_product` = '.intval($id_old)); $row = array(); if ($result) foreach ($result AS $i){ $data = '(SELECT (tmp.max + 1) AS newpos FROM (SELECT MAX(cp.`position`) AS max FROM `'._DB_PREFIX_.'category_product` cp WHERE cp.`id_category`='.intval($i['id_category']).') AS tmp)'; $result = Db::getInstance()->getRow($data); $maxpos = $result['newpos']; $row[] = '('.implode(', ', array(intval($id_new), $i['id_category'], $maxpos)).')'; } $flag = Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'category_product` (`id_product`, `id_category`, `position`) VALUES '.implode(',', $row)); return $flag; } But nothing is working. Anyone can help? Thank's before ! Link to comment Share on other sites More sharing options...
De Angel Net Posted July 2, 2012 Author Share Posted July 2, 2012 Anyone can help ??? Bump Link to comment Share on other sites More sharing options...
De Angel Net Posted July 2, 2012 Author Share Posted July 2, 2012 BUMP Link to comment Share on other sites More sharing options...
Mike Kranzler Posted July 2, 2012 Share Posted July 2, 2012 Hi De Angel Net, A user has found a solution to this here. I hope this helps. -Mike Link to comment Share on other sites More sharing options...
Recommended Posts