mrweb Posted March 31, 2015 Share Posted March 31, 2015 Hi i need to list the accessoiries in 1 product page by name i tried to update the function (classes/prioduct.php) public static function getAccessoriesLight($id_lang, $id_product, Context $context = null) { return Db::getInstance()->executeS(' SELECT p.`id_product`, p.`reference`, pl.`name` FROM `'._DB_PREFIX_.'accessory` LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product`= `id_product_2`) '.Shop::addSqlAssociation('product', 'p').' LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON ( p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').' ) WHERE `id_product_1` = '.(int)$id_product ); } but when i update it with ORDER BY pl.`name`, i get a blank page Please, someone can help me ? Thanks! Link to comment Share on other sites More sharing options...
PascalVG Posted March 31, 2015 Share Posted March 31, 2015 Blank page indicates some (syntax) error. Did you correctly concat the order by part to the existing sql query string? return Db::getInstance()->executeS(' SELECT p.`id_product`, p.`reference`, pl.`name` FROM `'._DB_PREFIX_.'accessory` LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product`= `id_product_2`) '.Shop::addSqlAssociation('product', 'p').' LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON ( p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').' ) WHERE `id_product_1` = '.(int)$id_product .' ORDER BY pl.`name`' ); (don't forget the dot, the single, straight quotes and a space before ORDER) If this doesn't help, turn on the debug mode, and see what error you get. This may help you find the solution. If you can't figure it out, copy the error message here, and we can have a look. pascal Link to comment Share on other sites More sharing options...
mrweb Posted March 31, 2015 Author Share Posted March 31, 2015 Thanks Pascal yes i did and i got blank page i will try debug mode Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now