Jump to content
  • 0
cheap gaming pcs

Please help with error MySLQ Error in back office

Question

19 answers to this question

Recommended Posts

  • 0

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?

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites
  • 0

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 by cheap gaming pcs

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

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

 

Correct!

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites

×