Total unit product

I created quantity and unit on product module.
Quantity = Total boxes of product.
Unit = one box how many item inside the box.

i wanted to add one more database column called total_unit.
which means --> quantity * unit = total_unit

but product controller direct save the array to database.
if ($this->mdl_products->run_validation()) {
$this->mdl_products->save($id);
redirect(‘products’);
}

How to add total_unit to that array and save it.

Please advice…
Thank you

I solved it.

Could you Plesse share how you solved this for other people who might be interested in this?

I used this way on product.php

get the value from user insert.
$quantity = $this->input->post(‘item_quantity’);
$UOM = $this->input->post(‘unit_of_measurement’);
$total_quantity = $quantity * $UOM;

set the value before save.
$this->mdl_products->set(‘total_quantity’, $total_quantity );

2 Likes