PrestashopEnthu Posted November 1, 2017 Share Posted November 1, 2017 I am currently using the code below in Prestashop to retrieve a cart id. public function hookDisplayPDFInvoice($params) { $order_invoice = $params['object']; $id_order = (int)$order_invoice->id_order; $sql = 'SELECT id_cart FROM '._DB_PREFIX_.'orders WHERE id_order="'.$id_order.'"'; //example id_cart $id_cart = Db::getInstance()->execute($sql); return $id_cart; In database, there are id_cart and id_timeslot. Table is called ps_cart_timeslot. I am quite stuck as I am baffled as to why the data return is 1 for any data I am retrieving. $id_order is fine, it is returning the right value. Any data select I am querying will return 1. Am I missing anything? Pardon me if this is a silly mistake. Thank you. Link to comment Share on other sites More sharing options...
PrestashopEnthu Posted November 1, 2017 Author Share Posted November 1, 2017 (edited) Solved. $query = new DbQuery(); $query->select('xxx') ->from('yyy') ->where('zzz = ' . (int)$www); Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query); Edited November 1, 2017 by Enthu86 (see edit history) 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