Problem with table_name_before_insert
Posted: 2014-08-11 21:07
Hi
I am trying to use the hook "table_name_before_insert" to multiply the field "unit_price" by the field "quantity". The following is how I have modified the "table_name_before_insert" hook in the "Hooks" folder:
function invoice_items_before_insert(&$data, $memberInfo, &$args){
$data['price'] = $data['qty'] * $data['unit_price'];
return TRUE;
}
However, the "price" field is not updating with the calculated result.
Can someone advise me where I am going wrong? Thanks
Kind regards,
Trevorm
I am trying to use the hook "table_name_before_insert" to multiply the field "unit_price" by the field "quantity". The following is how I have modified the "table_name_before_insert" hook in the "Hooks" folder:
function invoice_items_before_insert(&$data, $memberInfo, &$args){
$data['price'] = $data['qty'] * $data['unit_price'];
return TRUE;
}
However, the "price" field is not updating with the calculated result.
Can someone advise me where I am going wrong? Thanks
Kind regards,
Trevorm