karl20009 Posted October 8, 2009 Share Posted October 8, 2009 des que je veut changer la position d'un produits phrare sa me mais sa:1 erreur Failed to update the position.merci de votre aideTopic déplacé -yoya971 Link to comment Share on other sites More sharing options...
Kircuys Posted October 23, 2009 Share Posted October 23, 2009 Salut,J'ai le même problème que toi. As tu trouvé une solution ?Bien cordialement Link to comment Share on other sites More sharing options...
cycleelcyc Posted November 8, 2009 Share Posted November 8, 2009 avez-vous des solutions? merci de poster ici. Link to comment Share on other sites More sharing options...
BrianR Posted November 9, 2009 Share Posted November 9, 2009 I hit this problem.Using phpmyadmin look in ps_catgeory_product. For each category, there should be a set of id_product and position pairs, e.g. for id_category = 1, I had 6 entries with values of (id_product, position) of (10,0), (13,3), (14,4), (12,2), (11,1) and (15,4).If the positions are not in strict monotonic sequence, e.g. 0,1,2,3,4,5... I think the updatePosition code cannot reorder the products and you get the error message.I corrected it to read (10,0), (13,1), (14,5), (12,4), (11,3) and (15,2), and then I could reorder the products OK.I assume the update code was interrupted at some time before it could complete an update operation. It should really detect the invalid position values and correct them as best it can [in this example by updating to (10,0), (13,3), (14,4), (12,2), (11,1) and (15,5)]. At least then the user could correct the order.Hope this helps,Brian Link to comment Share on other sites More sharing options...
Juanparati Posted December 30, 2009 Share Posted December 30, 2009 I have a fast patch for this bug:Open the file classes/Product.php, find for this piece of code (about line 286): if (!$res = Db::getInstance()->ExecuteS(' SELECT cp.`id_product`, cp.`position`, cp.`id_category` FROM `'._DB_PREFIX_.'category_product` cp WHERE cp.`id_category` = '.intval(Tools::getValue('id_category')).' ORDER BY cp.`position` '.(intval($way) ? 'ASC' : 'DESC'))) And reemplace for: $valor = Tools::getValue('id_category'); if ($valor==0) $valor = 1; if (!$res = Db::getInstance()->ExecuteS(' SELECT cp.`id_product`, cp.`position`, cp.`id_category` FROM `'._DB_PREFIX_.'category_product` cp WHERE cp.`id_category` = '.intval($valor).' ORDER BY cp.`position` '.(intval($way) ? 'ASC' : 'DESC'))) The problems is that id_category is always 0 when is home and the select don't return rows because the home category is 1.Backup your database before of testing this patch, for me work like a charm. Link to comment Share on other sites More sharing options...
Shaun Posted December 31, 2009 Share Posted December 31, 2009 I have a fast patch for this bug:Open the file classes/Product.php, find for this piece of code (about line 286): if (!$res = Db::getInstance()->ExecuteS(' SELECT cp.`id_product`, cp.`position`, cp.`id_category` FROM `'._DB_PREFIX_.'category_product` cp WHERE cp.`id_category` = '.intval(Tools::getValue('id_category')).' ORDER BY cp.`position` '.(intval($way) ? 'ASC' : 'DESC'))) And reemplace for: $valor = Tools::getValue('id_category'); if ($valor==0) $valor = 1; if (!$res = Db::getInstance()->ExecuteS(' SELECT cp.`id_product`, cp.`position`, cp.`id_category` FROM `'._DB_PREFIX_.'category_product` cp WHERE cp.`id_category` = '.intval($valor).' ORDER BY cp.`position` '.(intval($way) ? 'ASC' : 'DESC'))) The problems is that id_category is always 0 when is home and the select don't return rows because the home category is 1.Backup your database before of testing this patch, for me work like a charm. [solved]I'm going to be a little cheeky and mark this as solved because I tried the patch and it worked perfectly! Many thanks to Juanparati for the simple fix. Link to comment Share on other sites More sharing options...
cycleelcyc Posted January 17, 2010 Share Posted January 17, 2010 I have a fast patch for this bug:Open the file classes/Product.php, find for this piece of code (about line 286): if (!$res = Db::getInstance()->ExecuteS(' SELECT cp.`id_product`, cp.`position`, cp.`id_category` FROM `'._DB_PREFIX_.'category_product` cp WHERE cp.`id_category` = '.intval(Tools::getValue('id_category')).' ORDER BY cp.`position` '.(intval($way) ? 'ASC' : 'DESC'))) And reemplace for: $valor = Tools::getValue('id_category'); if ($valor==0) $valor = 1; if (!$res = Db::getInstance()->ExecuteS(' SELECT cp.`id_product`, cp.`position`, cp.`id_category` FROM `'._DB_PREFIX_.'category_product` cp WHERE cp.`id_category` = '.intval($valor).' ORDER BY cp.`position` '.(intval($way) ? 'ASC' : 'DESC'))) The problems is that id_category is always 0 when is home and the select don't return rows because the home category is 1.Backup your database before of testing this patch, for me work like a charm. it works so good, tks!!!! Link to comment Share on other sites More sharing options...
fhcom Posted January 18, 2010 Share Posted January 18, 2010 helloen français cela serait superbe merci pour nous Link to comment Share on other sites More sharing options...
GS VISION Posted January 26, 2010 Share Posted January 26, 2010 Works on 1.2.4,too Thanks m8! Link to comment Share on other sites More sharing options...
harvey Posted February 23, 2010 Share Posted February 23, 2010 Works on 1.2.5 too.Champagne for Juanparati ! thx fellow. Link to comment Share on other sites More sharing options...
ugur onur Posted March 2, 2010 Share Posted March 2, 2010 thanks.. this is good..... Link to comment Share on other sites More sharing options...
noesac Posted March 4, 2010 Share Posted March 4, 2010 I found this very useful, thanks a lot! Link to comment Share on other sites More sharing options...
Jarode Posted April 2, 2010 Share Posted April 2, 2010 Thank you Pour ceux qui ne comprennent pas du tout l'anglais il faut faire une modification du fichier product.php qui se trouve dans le dossier classeschanger à partir de la ligne 286 ou si c'est comme moi c'est à partir de la ligne 293 if (!$res = Db::getInstance()->ExecuteS(' SELECT cp.`id_product`, cp.`position`, cp.`id_category` FROM `'._DB_PREFIX_.'category_product` cp WHERE cp.`id_category` = '.intval(Tools::getValue('id_category')).' ORDER BY cp.`position` '.(intval($way) ? 'ASC' : 'DESC'))) par $valor = Tools::getValue('id_category'); if ($valor==0) $valor = 1; if (!$res = Db::getInstance()->ExecuteS(' SELECT cp.`id_product`, cp.`position`, cp.`id_category` FROM `'._DB_PREFIX_.'category_product` cp WHERE cp.`id_category` = '.intval($valor).' ORDER BY cp.`position` '.(intval($way) ? 'ASC' : 'DESC'))) et cela fonctionne très bien. Link to comment Share on other sites More sharing options...
noesac Posted August 26, 2010 Share Posted August 26, 2010 Was this fixed in 1.3.1? I recently upgraded and I'm wondering whether I should reapply this fix. Link to comment Share on other sites More sharing options...
Patric Posted August 26, 2010 Share Posted August 26, 2010 This is of course a good thing to post a fix on the forum.But a better thing would be to report the problem into our bug tracker.Please could someone who meet this problem do it? Thanks. Link to comment Share on other sites More sharing options...
noesac Posted August 26, 2010 Share Posted August 26, 2010 This is of course a good thing to post a fix on the forum.But a better thing would be to report the problem into our bug tracker.Please could someone who meet this problem do it? Thanks. So this hasn't been fixed? Should I log it? Link to comment Share on other sites More sharing options...
Patric Posted August 27, 2010 Share Posted August 27, 2010 I do not know. You can try to reproduce this bug on our SVN version (that you can install in local) and if it still happens, then post a bug report.Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now