Problem with table_name_before_insert

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
trevorm
Veteran Member
Posts: 35
Joined: 2014-07-29 08:41

Problem with table_name_before_insert

Post by trevorm » 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

Post Reply