Question: Can We Show Product Varriants In Sale And Puchase

Can We Show Product Varriants In Sale And Puchase

Hello support, I have products varriants and I am struggling with product detail page, where it shows only product name (qty) so I have to basically click each invoice to see the detail o

PV

Prom Vongchann

Asked

Hello support,

I have products varriants and I am struggling with product detail page, where it shows only product name (qty) so I have to basically click each invoice to see the detail of varriants product and check if quantity is right or not.

is there a way or modification i can make to show the Product Varriants next to the Product name in Product detail page?

example now it shows Product name (qty) please see my screenshot of how it looks now .

could it be >> Product name (varriants 1 = qty) (varriants 2 = qty) etc… or it could display like what it display in invoice as summary (see my last attachment)

Thank you

  • PV

    Prom Vongchann

    Answered

    Mian Saleem yes, exactly column E. I just need to have the variant name and qty on that field so we can find the items faster.

  • MS

    Mian Saleem

    Answered

    Hello,

    I get the code from repo. You can try replace the line 2232 - 2239 with following

    $this->db
        ->select("date, reference_no, biller, customer, GROUP_CONCAT(CONCAT({$this->db->dbprefix('sale_items')}.product_name, ' ', {$this->db->dbprefix('product_variants')}.name, ' (', ROUND({$this->db->dbprefix('sale_items')}.quantity, {$this->Settings->qty_decimals}), ')') SEPARATOR '\n') as iname, grand_total, paid, payment_status", false)
        ->from('sales')
        ->join('sale_items', 'sale_items.sale_id=sales.id', 'left')
        ->join('warehouses', 'warehouses.id=sales.warehouse_id', 'left')
        ->join('product_variants', 'product_variants.id=sale_items.option_id', 'left')
        ->group_by('sales.id')
        ->order_by('sales.date desc');
    

    I don’t have machine with php8 so I am unable to check this but it should add the variant name after products name in column E.

    Thank you

  • PV

    Prom Vongchann

    Answered

    Mian Saleem I have tried but the exported report are missing data and variant still not showing you could check my attached screenshot

  • PV

    Prom Vongchann

    Answered
  • PV

    Prom Vongchann

    Answered

    The item those are not showing maybe because they are not having any variants, so it might be a bit of query condition missing.

  • PV

    Prom Vongchann

    Answered

    Mian Saleem so you have any idea about that ?

  • MS

    Mian Saleem

    Answered

    Hello,

    I am not so sure but it should be due to new changes. Maybe you can try case statement, something like

    $this->db
        ->select("date, reference_no, biller, customer, GROUP_CONCAT(CONCAT({$this->db->dbprefix('sale_items')}.product_name, (CASE WHEN {$this->db->dbprefix('sale_items')}.option_id > 0 THEN CONCAT(' ', {$this->db->dbprefix('product_variants')}.name) ELSE '' END), ' (', ROUND({$this->db->dbprefix('sale_items')}.quantity, {$this->Settings->qty_decimals}), ')') SEPARATOR '\n') as iname, grand_total, paid, payment_status", false)
        ->from('sales')
        ->join('sale_items', 'sale_items.sale_id=sales.id', 'left')
        ->join('warehouses', 'warehouses.id=sales.warehouse_id', 'left')
        ->join('product_variants', 'product_variants.id=sale_items.option_id', 'left')
        ->group_by('sales.id')
        ->order_by('sales.date desc');
    

    Thank you

  • PV

    Prom Vongchann

    Answered

    Mian Saleem Wonderful, It works.

    Thank you very much

  • Login to Reply