jager Posted March 10, 2012 Share Posted March 10, 2012 Hi all, someone can tell me how can I show the value in a table other than the "callback" with ? public function __ construct () The portion of the code below it refers to the table "order" $ this-> table = 'order'; of the file AdminOrders.php I would like to show the value (company name), however in this table is not there. I added: 'Company' => array ('title' => $ this-> l ('Company'), 'width' => 100), But of course I do not see any value in the table because in "order" element "company" does not exist. The latter is instead present in table "address" How can "I tell him" the value of "company" "Catch him" from the table "address"? public function __ construct () { global $ cookie; $ This-> table = 'order'; $ This-> className = 'Order'; $ This-> view = true; $ This-> colorOnBackground = true; $ This-> delete = true; $ This-> _select = ' a.id_order id_pdf AS, CONCAT (LEFT (c. `firstname`, 1) \ '. \', C. `Lastname`) AS `customer`, OSL. `name` AS `` osname, os. `color`, IF ((SELECT COUNT (so.id_order) FROM `'. _DB_PREFIX_.' Orders` WHERE I so.id_customer = a.id_customer)> 1, 0, 1) as new, (SELECT COUNT (`od. id_order`) FROM `'. _DB_PREFIX_.' Or` WHERE or Order_Detail. Id_order `=` a. Id_order `` GROUP BY `id_order`) AS product_number '; $ This-> _join = 'LEFT JOIN `'. _DB_PREFIX_. 'Customer` c ON (c. id_customer `=` a. `` Id_customer) LEFT JOIN `'. _DB_PREFIX_.' Order_history ON` oh (Oh. id_order `=` a. `` Id_order) LEFT JOIN `'. _DB_PREFIX_.' Order_state os` ON ??(`Hosea id_order_state` = oh. `` Id_order_state) LEFT JOIN `'. _DB_PREFIX_.' Order_state_lang OSL` ON (`Hosea id_order_state = OSL`. `AND` id_order_state OSL. Id_lang `` = '. (Int) ($ cookie-> id_lang).') '; $ This-> _where = 'AND oh. Id_order_history `` = (SELECT MAX (`id_order_history`) FROM `'. _DB_PREFIX_. 'Order_history` WHERE moh moh. Id_order `=` a. Id_order `GROUP BY` moh. `Id_order `) ';$ StatesArray = array (); $ States = OrderState getOrderStates :: ((int) ($ cookie-> id_lang)); foreach ($ states as $ state) StatesArray $ [$ state ['id_order_state']] = $ state ['name']; $ This-> fieldsDisplay = array ( 'Id_order' => array ('title' => $ this-> l ('ID'), 'align' => 'center', 'width' => 25), / / 'New' => array ('title' => $ this-> l ('New'), 'width' => 25, 'align' => 'center', 'type' => 'bool', 'filter_key' => 'new', 'tmpTableFilter' => true, 'icon' => array (0 => 'blank.gif', 1 => 'news-new.gif'), 'orderby' => false ), 'company' => array ('title' => $ this-> l ('Company'), 'width' => 100), 'Customer' => array ('title' => $ this-> l ('Customer'), 'widthColumn' => 160, 'width' => 140, 'filter_key' => 'customer', 'tmpTableFilter' = > true), 'Total_paid' => array ('title' => $ this-> l ('Total'), 'width' => 70, 'align' => 'right', 'prefix' => '<b>', 'suffix' => '</ b>', 'price' => true, 'currency' => true), 'Payment' => array ('title' => $ this-> l ('Payment'), 'width' => 100), 'Osname' => array ('title' => $ this-> l ('Status'), 'widthColumn' => 230, 'type' => 'select', 'select' => $ statesArray, 'filter_key' => 'os! id_order_state', 'filter_type' => 'int', 'width' => 200), 'DATE_ADD' => array ('title' => $ this-> l ('Date'), 'width' => 35, 'align' => 'right', 'type' => 'datetime', 'filter_key '=>' a! DATE_ADD '), 'Id_pdf' => array ('title' => $ this-> l ('PDF'), 'callback' => 'printPDFIcons', 'orderby' => false, 'search' => false)); parent :: __construct (); } With the line of code I added: 'company' => array ('title' => $ this-> l ('Company'), 'width' => 100), I created the column "Company" but obviously it does not show any value [see also attached image] Thank in advance who has the patience to help me Link to comment Share on other sites More sharing options...
Kaspi88 Posted April 22, 2012 Share Posted April 22, 2012 ..... $this->_select = ' c.`company` AS `company`, a.id_order AS id_pdf, ..... Link to comment Share on other sites More sharing options...
drew_m Posted April 25, 2012 Share Posted April 25, 2012 $this->_select = ' c.`company` AS `company`, a.id_order AS id_pdf, This is no good, as c is the customer table and company is stored in the address table. Instead: $this->_select = ' ad.`company` AS `company`, a.id_order AS id_pdf, ... LEFT JOIN `'._DB_PREFIX_.'address` ad ON (ad.`id_customer` = a.`id_customer`) LEFT JOIN `'._DB_PREFIX_.'order_history` oh ON (oh.`id_order` = a.`id_order`) For some reason that gives you twice the same result for some orders with a company name. I don't have time to look into that and I've already wasted way to much time fixing things in PrestaShop that should simply work in the first place. When I learned that you cannot look for a company name in the orders tab, I got the haunting feeling that I might be the only serious user of this software with actual products and customers and such... I hope I'm wrong. 1 Link to comment Share on other sites More sharing options...
pxloft Posted August 6, 2015 Share Posted August 6, 2015 This is no good, as c is the customer table and company is stored in the address table. Instead: $this->_select = ' ad.`company` AS `company`, a.id_order AS id_pdf, ... LEFT JOIN `'._DB_PREFIX_.'address` ad ON (ad.`id_customer` = a.`id_customer`) LEFT JOIN `'._DB_PREFIX_.'order_history` oh ON (oh.`id_order` = a.`id_order`) For some reason that gives you twice the same result for some orders with a company name. I don't have time to look into that and I've already wasted way to much time fixing things in PrestaShop that should simply work in the first place. When I learned that you cannot look for a company name in the orders tab, I got the haunting feeling that I might be the only serious user of this software with actual products and customers and such... I hope I'm wrong. ANY LUCK WITH THIS SO FAR??? 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