cheap gaming pcs Posted April 7, 2013 Share Posted April 7, 2013 Hi Everyone When i go to veiw the product page in the back office its shows this error below Bad SQL query Unknown column 'cp.position' in 'field list' Would anyone know how to fit it please Many Thanks Link to comment Share on other sites More sharing options...
tomerg3 Posted April 7, 2013 Share Posted April 7, 2013 Always start with your PS version. Do you have any modules installed that affect product page? Did you make any changes? When did it start? Link to comment Share on other sites More sharing options...
pedrofer Posted April 8, 2013 Share Posted April 8, 2013 (edited) I have the same problem In my case began when deleted some categories ... Then I erased all categories and products and came back to do it again, but when I add the products gives this error message in it: ( Many Thanks Edited April 8, 2013 by pedrofer (see edit history) Link to comment Share on other sites More sharing options...
tomerg3 Posted April 8, 2013 Share Posted April 8, 2013 Try to turn on dev mode in /config/defines.inc.php line #28 and see if you get the full query that causes the error, it may help narrow it down. Link to comment Share on other sites More sharing options...
cheap gaming pcs Posted April 8, 2013 Author Share Posted April 8, 2013 (edited) Hi Tommerg3 Thanks for your help and sorry for not stating what ps i am using Im using ps 1.5.4 I turn on dev mode as you said above and it shows the following error message below</p> I have a fresh install of prestashop, I added a few products and category's, then i deleted 2 catgegorys and the error message come up when i tried to view the products Thanks so much for your help [PrestaShopDatabaseException] Unknown column 'cp.position' in 'field list' SELECT SQL_CALC_FOUND_ROWS a.`id_product`,b.name as name,`reference`,a.price as price,a.active as active,cp.position as position , MAX(i.id_image) id_image,cl.name `name_category` , i.`id_image`, a.`price`, 0 AS price_final, sav.`quantity` as sav_quantity, a.`active` FROM `ps_product` a LEFT JOIN `ps_product_lang` b ON (b.`id_product` = a.`id_product` AND b.`id_lang` = 1 AND b.`id_shop` = 1) LEFT JOIN `ps_image` i ON (i.`id_product` = a.`id_product` AND i.cover=1)LEFT JOIN `ps_category_lang` cl ON (a.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = 1) LEFT JOIN `ps_stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0 AND sav.id_shop = 1 ) WHERE 1 GROUP BY a.id_product ORDER BY cp.`position` ASC LIMIT 0,50 at line 607 in file classes/db/Db.php 601. WebserviceRequest::getInstance()->setError(500, ' '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);602. }603. else if (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS'))604. {605. if ($sql)606. throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');607. throw new PrestaShopDatabaseException($this->getMsgError());608. }609. }610.611. /** DbCore->displayError - [line 307 - classes/db/Db.php] - [1 Arguments] DbCore->query - [line 482 - classes/db/Db.php] - [1 Arguments] DbCore->executeS - [line 2198 - classes/controller/AdminController.php] - [1 Arguments] AdminControllerCore->getList - [line 337 - controllers/admin/AdminProductsController.php] - [6 Arguments] AdminProductsControllerCore->getList - [line 1531 - classes/controller/AdminController.php] - [1 Arguments] AdminControllerCore->renderList - [line 2260 - controllers/admin/AdminProductsController.php] - [0 Argument] AdminProductsControllerCore->renderList - [line 1440 - classes/controller/AdminController.php] - [0 Argument] AdminControllerCore->initContent - [line 2252 - controllers/admin/AdminProductsController.php] - [0 Argument] AdminProductsControllerCore->initContent - [line 167 - classes/controller/Controller.php] - [0 Argument] ControllerCore->run - [line 349 - classes/Dispatcher.php] - [0 Argument] DispatcherCore->dispatch - [line 50 - admin123/index.php] - [0 Argument] Edited April 8, 2013 by cheap gaming pcs (see edit history) Link to comment Share on other sites More sharing options...
tomerg3 Posted April 9, 2013 Share Posted April 9, 2013 It seems that the query is invalid, it tried to select cp.position when a table with the name cp (which is category_product) is not a part of the "FROM" or a "LEFT JOIN" I tried to take a quick look, but I want not able to identify the exact cause. I suggest you start a thread in the bug tracker, provide all the info from the last post, and see what the PS team will find. Link to comment Share on other sites More sharing options...
jonigood55 Posted April 9, 2013 Share Posted April 9, 2013 (edited) hi i have same problem Prestashop 1.5.4.0 Edited April 9, 2013 by jonigood55 (see edit history) Link to comment Share on other sites More sharing options...
Carlos Leyan Posted April 12, 2013 Share Posted April 12, 2013 I have the same problem after delete a category PS 1.5.4 Link to comment Share on other sites More sharing options...
cheap gaming pcs Posted April 13, 2013 Author Share Posted April 13, 2013 Hi All Did anyone get a fix for this Many Thanks Link to comment Share on other sites More sharing options...
PascalVG Posted April 13, 2013 Share Posted April 13, 2013 Expect we need to add something like:'INNER JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product` AND cp.`id_category` = a.`id_category_default` )In what file however is this SQL statement built...? Link to comment Share on other sites More sharing options...
Motuman Posted April 24, 2013 Share Posted April 24, 2013 Hi All, I had the same problem when using Firefox. When I tried Safari the problem was solved. The problem was fixed when I deleted my cookies in FireFox, but eventually they came back..... Hope this helps! grts 1 Link to comment Share on other sites More sharing options...
benjamin utterback Posted April 24, 2013 Share Posted April 24, 2013 Hi motuman84, are you saying that this problem is not fixed overall? Link to comment Share on other sites More sharing options...
Motuman Posted April 24, 2013 Share Posted April 24, 2013 Hi motuman84, are you saying that this problem is not fixed overall? Hi Benjamin, I'm not an expert in this field but I haven't changed anything in PS to make it go away. I discovered that when I deleted my cookies in Firefox it was gone. Strange that Safari worked fine? But it came back, so if there's a solution, let me know:) btw: I'm working with the new PS 1.5.4 (works great, nice job all !) on a Mac Link to comment Share on other sites More sharing options...
benjamin utterback Posted April 24, 2013 Share Posted April 24, 2013 Hi motuman84, so the problem fixed when you cleared cookies, but now it is back. This was on 1.5.4? Link to comment Share on other sites More sharing options...
Motuman Posted April 24, 2013 Share Posted April 24, 2013 Hi motuman84, so the problem fixed when you cleared cookies, but now it is back. This was on 1.5.4? Correct! Link to comment Share on other sites More sharing options...
meimeisi Posted July 14, 2013 Share Posted July 14, 2013 i got the same issue too. has someone fixed the issue? Link to comment Share on other sites More sharing options...
JayLab Posted October 30, 2013 Share Posted October 30, 2013 Did you find a solution ? I have the same problem. Link to comment Share on other sites More sharing options...
PascalVG Posted October 30, 2013 Share Posted October 30, 2013 I believe these was a simple solution for this: http://forge.prestashop.com/browse/PSCFV-8748 Quote: "Try opening with another browser and you will see that the error will disappear, then clear you history in the browser that you was using and all should be fine... Regards Simon" Let us know if this really helps, pascal. Link to comment Share on other sites More sharing options...
JayLab Posted October 31, 2013 Share Posted October 31, 2013 Thanks Pascal, I've tried with an other navigator but didn't work for me. So I checked my information files with with 1Click upgrade and prestashop found 68 files modified (?)So i replace each one by ftp. Now the error has gone. Thank you Link to comment Share on other sites More sharing options...
karthiiiiiiiiiik Posted September 2, 2014 Share Posted September 2, 2014 Hi to all, How to use the where statement in the order table query ? for ex: i need to list the orders with payment type as cash on delivery how can i achieve it , i dont want to use filters, need to show the list defaulty. Link to comment Share on other sites More sharing options...
Recommended Posts