mohsart Posted December 9, 2012 Share Posted December 9, 2012 (edited) I was never very good at SQL and I am quite rusty now. Anyways, if someone could have a look, I'd apreciate it! In classes/Supplier.php I have $query = new DbQuery(); $query->select('s.*, sl.`description`, a.`address1`'); $query->from('supplier', 's'); $query->leftJoin('supplier_lang', 'sl', 's.`id_supplier` = sl.`id_supplier` AND sl.`id_lang` = '.(int)$id_lang); $query->leftJoin('address', 'a', 's.`id_supplier` = a.`id_supplier`'); $query->join(Shop::addSqlAssociation('supplier', 's')); if ($active) $query->where('s.`active` = 1'); $query->orderBy(' s.`name` ASC'); $query->limit($n, ($p - 1) * $n); $query->groupBy('s.id_supplier'); $suppliers = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); The idea is that the field address1 in db table address should be added to the $supplier array. Am I totally off track here or is it a simple mistake? Edit: On line 2 ", a.`address1`" is added Line 5 is added /Mats Edited December 9, 2012 by mohsart (see edit history) Link to comment Share on other sites More sharing options...
mohsart Posted December 9, 2012 Author Share Posted December 9, 2012 Added "public $address1;" and "'address1' => array('type' => self::TYPE_STRING)," $suppliers_list->address1 holds correct info in supplier-list, but in supplier $supplier->address1 is NULL /Mats Link to comment Share on other sites More sharing options...
mohsart Posted December 9, 2012 Author Share Posted December 9, 2012 Ok, I have the correct info at the correct place now, but I'm obviously doing it wrong... /Mats 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