teralite Posted October 9, 2014 Share Posted October 9, 2014 Hi all! Im trying to set up a new field in the orders tab where i can connect a seller to a customer. I want this to be visible in the orders tab so i can make a search on each sellers name and see what orders they have. I have created a new field in DB called sellers and i added it to ps_customers. Now i try this in AdminOrdersController.php but when i type in the code the whole order page is just blank. Anyone know what im doing wrong here? $this->_join = ' LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`) 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.') LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`sellers` = a.`sellers`)'; $this->_orderBy = 'id_order'; $this->_orderWay = 'DESC'; $this->fields_list = array( 'id_order' => array( 'title' => $this->l('ID'), 'align' => 'center', 'width' => 25 ), 'reference' => array( 'title' => $this->l('Reference'), 'align' => 'center', 'width' => 65 ), 'sellers' => array( 'title' => $this->l('Sellers'), 'align' => 'center', 'width' => 65 ), 'new' => array( 'title' => $this->l('New'), 'width' => 25, 'align' => 'center', 'type' => 'bool', 'tmpTableFilter' => true, 'icon' => array( 0 => 'blank.gif', 1 => array( 'src' => 'note.png', 'alt' => $this->l('First customer order'), ) Link to comment Share on other sites More sharing options...
cristic Posted October 9, 2014 Share Posted October 9, 2014 I don't know if this is the only problem that makes your page go blind, but you used the same alias for ps_customer table : c $this->_join = ' LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`) 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.') LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`sellers` = a.`sellers`)'; $this->_orderBy = 'id_order'; $this->_orderWay = 'DESC'; Second thing is that your extra LEFT JOIN is useless. You already have a join with ps_customer table. Link to comment Share on other sites More sharing options...
cristic Posted October 9, 2014 Share Posted October 9, 2014 Also, remember to always turn ON _PS_MODE_DEV_ while developing. Not only that it shows you the actual error (instead of a white page), but you can also see all the warnings. Link to comment Share on other sites More sharing options...
teralite Posted October 9, 2014 Author Share Posted October 9, 2014 Thanks, it seems to work when i delete the whole LEFT JOIN command, which is strange since it didnt work before i put it there. I am very new to this scripting so sorry for all the errors and mistakes. 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