Jump to content

Besoin d'un coup de main pour résoudre Erreurs durant la restauration d'une installation en local (MAMP)


Recommended Posts

Bonjour

Pour faire quelques tests sans toucher à la version en ligne du site, j'ai voulu installer une version locale pour bricoler dessus.

Après avoir importé la base de données, j'ai corrigé les infos du fichier settings.inc.php et la tablea shop_url

Quand j'essaye d'accéder au site j'ai ces erreurs :

[PrestaShopDatabaseException]

Expression #1 of ORDER BY clause is not in SELECT list, references column 'prestashop_restore.c.level_depth' which is not in SELECT list; this is incompatible with DISTINCT

SELECT DISTINCT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
                FROM `ps_category` c
                 INNER JOIN ps_category_shop category_shop
        ON (category_shop.id_category = c.id_category AND category_shop.id_shop = 1)
                LEFT JOIN `ps_category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = 1 AND cl.id_shop = 1 )
                LEFT JOIN `ps_category_group` cg ON (cg.`id_category` = c.`id_category`)
                WHERE (c.`active` = 1 OR c.`id_category` = 1)
                 AND `level_depth` <= 4
                AND cg.`id_group` IN (1)
                ORDER BY `level_depth` ASC, category_shop.`position` ASC

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

634. 			WebserviceRequest::getInstance()->setError(500, '[SQL Error] '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);
635. 		}
636. 		elseif (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS'))
637. 		{
638. 			if ($sql)
639. 				throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');
640. 			throw new PrestaShopDatabaseException($this->getMsgError());
641. 		}
642. 	}
643. 
644. 	/**

 

Quelques pistes sur la raison de ces erreurs ?

Merci !

 

Link to comment
Share on other sites

corrigez line 304 - modules/blockcategories/blockcategories.php

En gros ca demande de filtrer par level_depth mais cette colonne n'est pas dans la sélection (difficile de trier suivant une colonne inexistante^^)

SELECT DISTINCT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite

Votre version sql en local doit être plus récente et ne laisse pas passer ce genre d'erreurs.

Edited by Eolia (see edit history)
Link to comment
Share on other sites

Donc au départ j'avais cette erreur :

Expression #1 of ORDER BY clause is not in SELECT list, references column 'prestashop_restore.c.level_depth' which is not in SELECT list; 
this is incompatible with DISTINCT

SELECT DISTINCT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
FROM `ps_category` c
INNER JOIN `ps_category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = 1 AND cl.id_shop = 1 )
INNER JOIN `ps_category_shop` cs ON (cs.`id_category` = c.`id_category` AND cs.`id_shop` = 1)
WHERE (c.`active` = 1 OR c.`id_category` = 2)
AND c.`id_category` != 1
AND `level_depth` <= 4
AND c.id_category IN (SELECT id_category FROM `ps_category_group` WHERE `id_group` IN (1))
ORDER BY `level_depth` ASC, cs.`position` ASC

Quand j'ajoute c.level_depth, j'obtiens cette erreur :

Expression #2 of ORDER BY clause is not in SELECT list, references column 'prestashop_restore.category_shop.position'  which is not in SELECT list;
this is incompatible with DISTINCT

SELECT DISTINCT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite, c.level_depth
FROM `ps_category` c
INNER JOIN ps_category_shop category_shop
ON (category_shop.id_category = c.id_category AND category_shop.id_shop = 1)
LEFT JOIN `ps_category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = 1 AND cl.id_shop = 1 )
LEFT JOIN `ps_category_group` cg ON (cg.`id_category` = c.`id_category`)
WHERE (c.`active` = 1 OR c.`id_category` = 1)
AND `level_depth` <= 4
AND cg.`id_group` IN (1)
ORDER BY `level_depth` ASC, category_shop.`position` ASC

Merci encore de prendre le temps de répondre

Link to comment
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
×
×
  • Create New...