Jump to content

Edit History

jotas torres

jotas torres

On 12/29/2020 at 8:54 PM, jotas torres said:

How can I do the same for suppliers? 

I know the way to add the supplier column is this one. 

 $this->_select = '

     sup.name AS supplier

 

$this->_join = '

     LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order = a.`id_order`)

     LEFT JOIN `'. _DB_PREFIX_.'product_supplier` ps ON (ps.`id_product` = od.`product_id`)

     LEFT JOIN `'._DB_PREFIX_.'supplier` sup ON (sup.`id_supplier` = ps.`id_supplier`)

 

$this->fields_list = array(

            'supplier' => array(

                'title' => $this->l('Supplier')

            ),

 

But I don't know how to create a GROUP.

 

Thank You

Finally, it's this one

 $this->_join = '

       LEFT JOIN (SELECT od.id_order, GROUP_CONCAT(sup.name) AS supplier, CONCAT( GROUP_CONCAT(od.product_name) AS products

                        FROM `'._DB_PREFIX_.'order_detail` od 

                        LEFT JOIN `'. _DB_PREFIX_.'product_supplier` ps ON (ps.`id_product` = od.`product_id` AND ps.`id_product_attribute` = od.`product_attribute_id`)  

                        LEFT JOIN `'._DB_PREFIX_.'supplier` sup ON (sup.`id_supplier` = ps.`id_supplier`)

                        GROUP BY od.id_order) x ON x.id_order = a.id_order

$this->fields_list = array(

            'products' => array(

                'title' => $this->trans('Products', array(), 'Admin.Global'),

            ),

            'supplier' => array(

                'title' => $this->trans('Supplier', array(), 'Admin.Global'),

            ),

);

jotas torres

jotas torres

On 12/29/2020 at 8:54 PM, jotas torres said:

How can I do the same for suppliers? 

I know the way to add the supplier column is this one. 

 $this->_select = '

     sup.name AS supplier

 

$this->_join = '

     LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order = a.`id_order`)

     LEFT JOIN `'. _DB_PREFIX_.'product_supplier` ps ON (ps.`id_product` = od.`product_id`)

     LEFT JOIN `'._DB_PREFIX_.'supplier` sup ON (sup.`id_supplier` = ps.`id_supplier`)

 

$this->fields_list = array(

            'supplier' => array(

                'title' => $this->l('Supplier')

            ),

 

But I don't know how to create a GROUP.

 

Thank You

Finally, it's this one

 $this->_join = '

       LEFT JOIN (SELECT od.id_order, GROUP_CONCAT(sup.name) AS supplier, CONCAT( GROUP_CONCAT(od.product_name) AS products

                        FROM `'._DB_PREFIX_.'order_detail` od 

                        LEFT JOIN `'. _DB_PREFIX_.'product_supplier` ps ON (ps.`id_product` = od.`product_id` AND ps.`id_product_attribute` = od.`product_attribute_id`)  

                        LEFT JOIN `'._DB_PREFIX_.'supplier` sup ON (sup.`id_supplier` = ps.`id_supplier`)

                        GROUP BY od.id_order) x ON x.id_order = a.id_order

$this->fields_list = array(

            'products' => array(

                'title' => $this->trans('Products', array(), 'Admin.Global'),

            ),

            'supplier' => array(

                'title' => $this->trans('Supplier', array(), 'Admin.Global'),

                'class' => 'fixed-width-xs',

            ),

);

×
×
  • Create New...