Please help with error MySLQ Error in back office - Ecommerce x PrestaShop - PrestaShop

Jump to content

Photo

Please help with error MySLQ Error in back office

myslq error back office

#1

Posted 07 April 2013 - 10:53 PM

cheap gaming pcs

    PrestaShop Apprentice

  • Members
  • PipPip
  • 156 Active Posts
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

#2

Posted 07 April 2013 - 11:31 PM

tomerg3

    PrestaShop Superstar

  • US Moderators
  • 8416 Active Posts
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...

#3

Posted 08 April 2013 - 12:22 PM

pedrofer

    PrestaShop Apprentice

  • Members
  • PipPip
  • 139 Active Posts
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.


#4

Posted 08 April 2013 - 01:06 PM

tomerg3

    PrestaShop Superstar

  • US Moderators
  • 8416 Active Posts
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...

#5

Posted 08 April 2013 - 05:39 PM

cheap gaming pcs

    PrestaShop Apprentice

  • Members
  • PipPip
  • 156 Active Posts
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.


#6

Posted 09 April 2013 - 04:35 AM

tomerg3

    PrestaShop Superstar

  • US Moderators
  • 8416 Active Posts
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...

#7

Posted 09 April 2013 - 09:26 PM

jonigood55

    PrestaShop Newbie

  • Members
  • Pip
  • 1 Active Posts
hi

i have same problem

Prestashop 1.5.4.0

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


#8

Posted 12 April 2013 - 02:15 AM

Carlos Leyan

    PrestaShop Newbie

  • Members
  • Pip
  • 1 Active Posts
I have the same problem after delete a category PS 1.5.4

#9

Posted 13 April 2013 - 08:44 PM

cheap gaming pcs

    PrestaShop Apprentice

  • Members
  • PipPip
  • 156 Active Posts
Hi All

Did anyone get a fix for this

Many Thanks

#10

Posted 13 April 2013 - 09:15 PM

PascalVG

    PrestaShop Fanatic

  • US Moderators
  • 3703 Active Posts

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 :-)

#11

Posted 24 April 2013 - 06:57 PM

Motuman

    PrestaShop Newbie

  • Members
  • Pip
  • 12 Active Posts
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

#12

Posted 24 April 2013 - 07:00 PM

Ben U.

    Community Jedi

  • Members
  • PipPipPipPipPip
  • 5931 Active Posts
Hi motuman84, are you saying that this problem is not fixed overall?

#13

Posted 24 April 2013 - 07:14 PM

Motuman

    PrestaShop Newbie

  • Members
  • Pip
  • 12 Active Posts

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

#14

Posted 24 April 2013 - 07:18 PM

Ben U.

    Community Jedi

  • Members
  • PipPipPipPipPip
  • 5931 Active Posts
Hi motuman84, so the problem fixed when you cleared cookies, but now it is back. This was on 1.5.4?

#15

Posted 24 April 2013 - 07:21 PM

Motuman

    PrestaShop Newbie

  • Members
  • Pip
  • 12 Active Posts

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


Correct!

#16

Posted 14 July 2013 - 04:33 PM

meimeisi

    PrestaShop Apprentice

  • Members
  • PipPip
  • 45 Active Posts
i got the same issue too. has someone fixed the issue?

#17

Posted 30 October 2013 - 12:17 PM

JayLab

    PrestaShop Apprentice

  • Members
  • PipPip
  • 192 Active Posts

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



#18

Posted 30 October 2013 - 05:00 PM

PascalVG

    PrestaShop Fanatic

  • US Moderators
  • 3703 Active Posts

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 :-)

#19

Posted 31 October 2013 - 10:22 AM

JayLab

    PrestaShop Apprentice

  • Members
  • PipPip
  • 192 Active Posts

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



#20

Posted 02 September 2014 - 11:19 AM

karthiiiiiiiiiik

    PrestaShop Apprentice

  • Members
  • PipPip
  • 221 Active Posts

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.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cookies help us deliver our services. By using our services, you agree to use our cookies.     Learn more