Jump to content

Query che funziona su phpmyadmin e non su Prestashop


infotech

Recommended Posts

$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
 SELECT  c.*, cl.id_lang, cl.name, cl.description, cl.link_rewrite, cl.meta_title, cl.meta_keywords, cl.meta_description, p.reference
 FROM `'._DB_PREFIX_.'category` c
 LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.(int)($id_lang).')
 LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`)
		    LEFT JOIN `'._DB_PREFIX_.'ps_product` p ON ( c.`id_category` = p.`id_category_default` )
 WHERE `id_parent` = '.(int)($this->id).'
 '.($active ? 'AND `active` = 1' : '').'
 AND cg.`id_group` '.$sqlGroups.'
 GROUP BY c.`id_category`
 ORDER BY `level_depth` ASC, c.`position` ASC');

 

Volevo tirar fuori il reference di un prodotto della relativa categoria, perchè non funziona? se la modifico per il phpmyadmin e la eseguo lì funziona :(

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