Jump to content

Column 'quantity' in order clause is ambiguous


nencinishop
 Share

Recommended Posts

Salve ho grosso problema non visualizzo piu il listino prodotto nel BO viene fuori quanto segue, come posso risolvere ?

 

Claudio

 

[PrestaShopDatabaseException]

Column 'quantity' in order clause is ambiguous
 

		SELECT SQL_CALC_FOUND_ROWS		a.`id_product`,b.name as name,`reference`,a.price as price,sa.active as active		, shop.name as shopname, MAX(image_shop.id_image) id_image, cl.name `name_category`, sa.`price`, 0 AS price_final, sav.`quantity` as sav_quantity, sa.`active`		FROM `np_product` a		LEFT JOIN `np_product_lang` b ON (b.`id_product` = a.`id_product` AND b.`id_lang` = 2 AND b.`id_shop` = 1)				LEFT JOIN `np_image` i ON (i.`id_product` = a.`id_product`)		LEFT JOIN `np_stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0		 AND sav.id_shop = 1 )  JOIN `np_product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = a.id_shop_default)				LEFT JOIN `np_category_lang` cl ON (sa.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = a.id_shop_default)				LEFT JOIN `np_shop` shop ON (shop.id_shop = a.id_shop_default) 				LEFT JOIN `np_image_shop` image_shop ON (image_shop.`id_image` = i.`id_image` AND image_shop.`cover` = 1 AND image_shop.id_shop = a.id_shop_default) 				WHERE 1 		GROUP BY sa.id_product 				ORDER BY quantity desc LIMIT 0,50

at line 613 in file classes/db/Db.php

 

607. 			WebserviceRequest::getInstance()->setError(500, '[SQL Error] '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);608. 		}609. 		else if (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS'))610. 		{611. 			if ($sql)612. 				throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');613. 			throw new PrestaShopDatabaseException($this->getMsgError());614. 		}615. 	}616. 617. 	/**
  • DbCore->displayError - [line 313 - classes/db/Db.php] - [1 Arguments]
    307. 		if ($sql instanceof DbQuery)308. 			$sql = $sql->build();309. 310. 		$this->result = $this->_query($sql);311. 		if (_PS_DEBUG_SQL_)312. 			$this->displayError($sql);313. 		return $this->result;314. 	}315. 316. 	/**317. 	 * Execute an INSERT query
    Argument [0]		SELECT SQL_CALC_FOUND_ROWS		a.`id_product`,b.name as name,`reference`,a.price as price,sa.active as active		, shop.name as shopname, MAX(image_shop.id_image) id_image, cl.name `name_category`, sa.`price`, 0 AS price_final, sav.`quantity` as sav_quantity, sa.`active`		FROM `np_product` a		LEFT JOIN `np_product_lang` b ON (b.`id_product` = a.`id_product` AND b.`id_lang` = 2 AND b.`id_shop` = 1)				LEFT JOIN `np_image` i ON (i.`id_product` = a.`id_product`)		LEFT JOIN `np_stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0		 AND sav.id_shop = 1 )  JOIN `np_product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = a.id_shop_default)				LEFT JOIN `np_category_lang` cl ON (sa.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = a.id_shop_default)				LEFT JOIN `np_shop` shop ON (shop.id_shop = a.id_shop_default) 				LEFT JOIN `np_image_shop` image_shop ON (image_shop.`id_image` = i.`id_image` AND image_shop.`cover` = 1 AND image_shop.id_shop = a.id_shop_default) 				WHERE 1 		GROUP BY sa.id_product 				ORDER BY quantity desc LIMIT 0,50
  • DbCore->query - [line 488 - classes/db/Db.php] - [1 Arguments]
    482. 		{483. 			$this->last_cached = true;484. 			return $result;485. 		}486. 487. 		$this->result = $this->query($sql);488. 		if (!$this->result)489. 			return false;490. 491. 		$this->last_cached = false;492. 		if (!$array)
    Argument [0]		SELECT SQL_CALC_FOUND_ROWS		a.`id_product`,b.name as name,`reference`,a.price as price,sa.active as active		, shop.name as shopname, MAX(image_shop.id_image) id_image, cl.name `name_category`, sa.`price`, 0 AS price_final, sav.`quantity` as sav_quantity, sa.`active`		FROM `np_product` a		LEFT JOIN `np_product_lang` b ON (b.`id_product` = a.`id_product` AND b.`id_lang` = 2 AND b.`id_shop` = 1)				LEFT JOIN `np_image` i ON (i.`id_product` = a.`id_product`)		LEFT JOIN `np_stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0		 AND sav.id_shop = 1 )  JOIN `np_product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = a.id_shop_default)				LEFT JOIN `np_category_lang` cl ON (sa.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = a.id_shop_default)				LEFT JOIN `np_shop` shop ON (shop.id_shop = a.id_shop_default) 				LEFT JOIN `np_image_shop` image_shop ON (image_shop.`id_image` = i.`id_image` AND image_shop.`cover` = 1 AND image_shop.id_shop = a.id_shop_default) 				WHERE 1 		GROUP BY sa.id_product 				ORDER BY quantity desc LIMIT 0,50
  • DbCore->executeS - [line 2277 - classes/controller/AdminController.php] - [1 Arguments]
    2271. 		ORDER BY '.(($order_by == $this->identifier) ? 'a.' : '').pSQL($order_by).' '.pSQL($order_way).2272. 		($this->_tmpTableFilter ? ') tmpTable WHERE 1'.$this->_tmpTableFilter : '').2273. 		(($use_limit === true) ? ' LIMIT '.(int)$start.','.(int)$limit : '');2274. 2275. 		$this->_listTotal = 0;2276. 		if (!($this->_list = Db::getInstance()->executeS($this->_listsql)))2277. 			$this->_list_error = Db::getInstance()->getMsgError();2278. 		else2279. 			$this->_listTotal = Db::getInstance()->getValue('SELECT FOUND_ROWS() AS `'._DB_PREFIX_.$this->table.'`');2280. 	}2281. 	
    Argument [0]		SELECT SQL_CALC_FOUND_ROWS		a.`id_product`,b.name as name,`reference`,a.price as price,sa.active as active		, shop.name as shopname, MAX(image_shop.id_image) id_image, cl.name `name_category`, sa.`price`, 0 AS price_final, sav.`quantity` as sav_quantity, sa.`active`		FROM `np_product` a		LEFT JOIN `np_product_lang` b ON (b.`id_product` = a.`id_product` AND b.`id_lang` = 2 AND b.`id_shop` = 1)				LEFT JOIN `np_image` i ON (i.`id_product` = a.`id_product`)		LEFT JOIN `np_stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0		 AND sav.id_shop = 1 )  JOIN `np_product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = a.id_shop_default)				LEFT JOIN `np_category_lang` cl ON (sa.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = a.id_shop_default)				LEFT JOIN `np_shop` shop ON (shop.id_shop = a.id_shop_default) 				LEFT JOIN `np_image_shop` image_shop ON (image_shop.`id_image` = i.`id_image` AND image_shop.`cover` = 1 AND image_shop.id_shop = a.id_shop_default) 				WHERE 1 		GROUP BY sa.id_product 				ORDER BY quantity desc LIMIT 0,50
  • AdminControllerCore->getList - [line 328 - controllers/admin/AdminProductsController.php] - [6 Arguments]
    322. 		if ($orderByPriceFinal == 'price_final')323. 		{324. 			$orderBy = 'id_'.$this->table;325. 			$orderWay = 'ASC';326. 		}327. 		parent::getList($id_lang, $orderBy, $orderWay, $start, $limit, $this->context->shop->id);328. 329. 		/* update product quantity with attributes ...*/330. 		$nb = count($this->_list);331. 		if ($this->_list)332. 		{
    Argument [0]2Argument [1]Argument [2]Argument [3]0Argument [4]Argument [5]1
  • AdminProductsControllerCore->getList - [line 1598 - classes/controller/AdminController.php] - [1 Arguments]
    1592. 	 */1593. 	public function renderList()1594. 	{1595. 		if (!($this->fields_list && is_array($this->fields_list)))1596. 			return false;1597. 		$this->getList($this->context->language->id);1598. 1599. 		$helper = new HelperList();1600. 		1601. 		// Empty list is ok1602. 		if (!is_array($this->_list))
    Argument [0]2
  • AdminControllerCore->renderList - [line 2337 - controllers/admin/AdminProductsController.php] - [0 Argument]
    2331. 	public function renderList()2332. 	{2333. 		$this->addRowAction('edit');2334. 		$this->addRowAction('duplicate');2335. 		$this->addRowAction('delete');2336. 		return parent::renderList();2337. 	}2338. 2339. 	public function ajaxProcessProductManufacturers()2340. 	{2341. 		$manufacturers = Manufacturer::getManufacturers();
  • AdminProductsControllerCore->renderList - [line 1496 - classes/controller/AdminController.php] - [0 Argument]
    1490. 			$this->content .= $this->renderView();1491. 		}1492. 		elseif (!$this->ajax)1493. 		{1494. 			$this->content .= $this->renderModulesList();1495. 			$this->content .= $this->renderList();1496. 			$this->content .= $this->renderOptions();1497. 1498. 			// if we have to display the required fields form1499. 			if ($this->required_database)1500. 				$this->content .= $this->displayRequiredFields();
  • AdminControllerCore->initContent - [line 2329 - controllers/admin/AdminProductsController.php] - [0 Argument]
    2323. 			$this->tpl_list_vars['base_url'] = preg_replace('#&id_category=[0-9]*#', '', self::$currentIndex).'&token='.$this->token;2324. 		}2325. 		// @todo module free2326. 		$this->tpl_form_vars['vat_number'] = file_exists(_PS_MODULE_DIR_.'vatnumber/ajax.php');2327. 2328. 		parent::initContent();2329. 	}2330. 2331. 	public function renderList()2332. 	{2333. 		$this->addRowAction('edit');
  • AdminProductsControllerCore->initContent - [line 167 - classes/controller/Controller.php] - [0 Argument]
    161. 162. 			if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className)))163. 				$this->initHeader();164. 165. 			if ($this->viewAccess())166. 				$this->initContent();167. 			else168. 				$this->errors[] = Tools::displayError('Access denied.');169. 170. 			if (!$this->content_only && ($this->display_footer || (isset($this->className) && $this->className)))171. 				$this->initFooter();
  • ControllerCore->run - [line 348 - classes/Dispatcher.php] - [0 Argument]
    342. 			// Execute hook dispatcher343. 			if (isset($params_hook_action_dispatcher))344. 				Hook::exec('actionDispatcher', $params_hook_action_dispatcher);345. 346. 			// Running controller347. 			$controller->run();348. 		}349. 		catch (PrestaShopException $e)350. 		{351. 			$e->displayMessage();352. 		}
  • DispatcherCore->dispatch - [line 50 - admin123/index.php] - [0 Argument]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More