Vote to Improve PrestaShop

PrestaShop Forum: Build a free online shop. Count on the Community!

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum: Build a free online shop. Count on the Community!

Jump to content

 
Photo

Please help with error MySLQ Error in back office

myslq error back office

  • Please log in to reply
19 replies to this topic
cheap gaming pcs

    PrestaShop Apprentice

  • Members
  • PipPip
  • 156 posts

Posted 07 April 2013 - 10:53 PM

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

tomerg3

    PrestaShop Superstar

  • US Moderators
  • 8298 posts

Posted 07 April 2013 - 11:31 PM

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?
Posted Image
For the latest updates discount coupons and new module information follow us on Twitter , Facebook ,and tips on our Blog
Please do not send general questions via PM, that is what the forum is for...

pedrofer

    PrestaShop Apprentice

  • Members
  • PipPip
  • 132 posts

Posted 08 April 2013 - 12:22 PM

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 by pedrofer, 08 April 2013 - 12:23 PM.


tomerg3

    PrestaShop Superstar

  • US Moderators
  • 8298 posts

Posted 08 April 2013 - 01:06 PM

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.
Posted Image
For the latest updates discount coupons and new module information follow us on Twitter , Facebook ,and tips on our Blog
Please do not send general questions via PM, that is what the forum is for...

cheap gaming pcs

    PrestaShop Apprentice

  • Members
  • PipPip
  • 156 posts

Posted 08 April 2013 - 05:39 PM

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, '[SQL Error] '.$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 by cheap gaming pcs, 08 April 2013 - 05:48 PM.


tomerg3

    PrestaShop Superstar

  • US Moderators
  • 8298 posts

Posted 09 April 2013 - 04:35 AM

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.
Posted Image
For the latest updates discount coupons and new module information follow us on Twitter , Facebook ,and tips on our Blog
Please do not send general questions via PM, that is what the forum is for...

jonigood55

    PrestaShop Newbie

  • Members
  • Pip
  • 1 posts

Posted 09 April 2013 - 09:26 PM

hi

i have same problem

Prestashop 1.5.4.0

Edited by jonigood55, 09 April 2013 - 09:28 PM.


Carlos Leyan

    PrestaShop Newbie

  • Members
  • Pip
  • 1 posts

Posted 12 April 2013 - 02:15 AM

I have the same problem after delete a category PS 1.5.4

cheap gaming pcs

    PrestaShop Apprentice

  • Members
  • PipPip
  • 156 posts

Posted 13 April 2013 - 08:44 PM

Hi All

Did anyone get a fix for this

Many Thanks

PascalVG

    PrestaShop Fanatic

  • US Moderators
  • 3123 posts

Posted 13 April 2013 - 09:15 PM

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...?


How to add [SOLVED]: press "Edit" at original Q, press "Use Full Editor" and edit the header line. Voilá!
Please, always add your PS version and Link to your site.
Please, always tell/add the final solution working for your problem, so others can re-use it :-)

Motuman

    PrestaShop Newbie

  • Members
  • Pip
  • 11 posts

Posted 24 April 2013 - 06:57 PM

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

Ben U.

    Community Jedi

  • Members
  • PipPipPipPipPip
  • 5931 posts

Posted 24 April 2013 - 07:00 PM

Hi motuman84, are you saying that this problem is not fixed overall?

Motuman

    PrestaShop Newbie

  • Members
  • Pip
  • 11 posts

Posted 24 April 2013 - 07:14 PM

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

Ben U.

    Community Jedi

  • Members
  • PipPipPipPipPip
  • 5931 posts

Posted 24 April 2013 - 07:18 PM

Hi motuman84, so the problem fixed when you cleared cookies, but now it is back. This was on 1.5.4?

Motuman

    PrestaShop Newbie

  • Members
  • Pip
  • 11 posts

Posted 24 April 2013 - 07:21 PM

Hi motuman84, so the problem fixed when you cleared cookies, but now it is back. This was on 1.5.4?


Correct!

meimeisi

    PrestaShop Apprentice

  • Members
  • PipPip
  • 40 posts

Posted 14 July 2013 - 04:33 PM

i got the same issue too. has someone fixed the issue?

JayLab

    PrestaShop Apprentice

  • Members
  • PipPip
  • 192 posts

Posted 30 October 2013 - 12:17 PM

Did you find a solution ? I have the same problem.



PascalVG

    PrestaShop Fanatic

  • US Moderators
  • 3123 posts

Posted 30 October 2013 - 05:00 PM

I believe these was a simple solution for this:

http://forge.prestas...owse/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.


How to add [SOLVED]: press "Edit" at original Q, press "Use Full Editor" and edit the header line. Voilá!
Please, always add your PS version and Link to your site.
Please, always tell/add the final solution working for your problem, so others can re-use it :-)

JayLab

    PrestaShop Apprentice

  • Members
  • PipPip
  • 192 posts

Posted 31 October 2013 - 10:22 AM

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



karthiiiiiiiiiik

    PrestaShop Apprentice

  • Members
  • PipPip
  • 221 posts

Posted 02 September 2014 - 11:19 AM

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.







Also tagged with one or more of these keywords: myslq, error, back office

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users