Hello,
I am trying to add in my Order page a category (just like ID, new client, company, total..) that correspond to the Shopify order ID.
my table where is the shopify ID is named shopify_order and look like that :
So, in my AdminOrderController.php i have my field list like that :
$this->_select = ' a.id_currency, a.id_order AS id_pdf, CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`, osl.`name` AS `osname`, os.`color`, IF((SELECT so.id_order FROM `'._DB_PREFIX_.'orders` so WHERE so.id_customer = a.id_customer AND so.id_order < a.id_order LIMIT 1) > 0, 0, 1) as new, country_lang.name as cname, IF(a.valid, 1, 0) badge_success'; $this->_join = ' LEFT JOIN '._DB_PREFIX_.'shopify_order so WHERE id_order_ps = '.(int)$order->id.' ')' LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`) INNER JOIN `'._DB_PREFIX_.'address` address ON address.id_address = a.id_address_delivery INNER JOIN `'._DB_PREFIX_.'country` country ON address.id_country = country.id_country INNER JOIN `'._DB_PREFIX_.'country_lang` country_lang ON (country.`id_country` = country_lang.`id_country` AND country_lang.`id_lang` = '.(int)$this->context->language->id.') LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = a.`current_state`) LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$this->context->language->id.')'; $this->_orderBy = 'id_order'; $this->_orderWay = 'DESC'; $this->_use_found_rows = true; $statuses = OrderState::getOrderStates((int)$this->context->language->id); foreach ($statuses as $status) { $this->statuses_array[$status['id_order_state']] = $status['name']; } $this->fields_list = array( 'id_order' => array( 'title' => $this->trans('ID', array(), 'Admin.Global'), 'align' => 'text-center', 'class' => 'fixed-width-xs' ), 'reference' => array( 'title' => $this->trans('Reference', array(), 'Admin.Global') ), 'new' => array( 'title' => $this->trans('New client', array(), 'Admin.Orderscustomers.Feature'), 'align' => 'text-center', 'type' => 'bool', 'tmpTableFilter' => true, 'orderby' => false, ), 'customer' => array( 'title' => $this->trans('Customer', array(), 'Admin.Global'), 'havingFilter' => true, ), ); if (Configuration::get('PS_B2B_ENABLE')) { $this->fields_list = array_merge($this->fields_list, array( 'company' => array( 'title' => $this->trans('Company', array(), 'Admin.Global'), 'filter_key' => 'c!company' ), )); }
The shopify ID is displayed further in the code :
$id_shopify_order = Db::getInstance()->getValue('SELECT ref_order_shopify FROM '._DB_PREFIX_.'shopify_order WHERE id_order_ps = '.(int)$order->id.' ');
and appear in order's details page : (shopify ref)
But i have no idea how to add it in the field list and display the ID for each order in my order page.
Thanks for reading.