Jump to content

Edit History

jotas torres

jotas torres

On 11/7/2019 at 9:26 PM, uruvaping said:

To archive that, besides the solution above just

add this under select>

x.products,

and this under joints>

LEFT JOIN (SELECT s.id_order, GROUP_CONCAT(s.product_name) AS products FROM `'._DB_PREFIX_.'order_detail` s GROUP BY s.id_order) x ON x.id_order = a.id_order

 

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

jotas torres

jotas torres

On 11/7/2019 at 9:26 PM, uruvaping said:

To archive that, besides the solution above just

add this under select>

x.products,

and this under joints>

LEFT JOIN (SELECT s.id_order, GROUP_CONCAT(s.product_name) AS products FROM `'._DB_PREFIX_.'order_detail` s GROUP BY s.id_order) x ON x.id_order = a.id_order

 

How can I do the same for suppliers? 

 

//supplier -   

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`)

×
×
  • Create New...