function onBeforeCartSave(&$element, &$do)
{
$additional = new stdClass();
$additional->name = 'package1';
$additional->price_currency_id = hikashop_getCurrency(); // this line is compulsary, else it wont change the total price
$additional->input_currency = $this->plugin_params->currencyid;
$additional->price_value = 10;
$additional->price_value_with_tax = -10;
$additional->current_total = 100;
$additional->discounted = 10;
$element->cart_params->additional1 = $additional;
foreach($element->cart_params as $param)
{
$additional = new stdClass();
$additional->name = $param->name;
$additional->price_currency_id = $param->price_currency_id;
$additional->input_currency = $param->input_currency;
$additional->price_value = -$param->discounted;
$additional->price_value_with_tax = -$param->discounted;
$element->additional['package1'] = $additional;
}
$fp = fopen('params.txt', 'w');
fwrite($fp, print_r($element, TRUE));
fclose($fp);
$fp = fopen('addi.txt', 'w');
fwrite($fp, print_r($previous_total, TRUE));
fclose($fp);
}