Iam trying to write a small discounts module for our system.
This is what Iam doing
<?php
function uc_vingodiscounts_line_item(){
$items[] = array(
'id'=>'vingodisc',
'title'=>t('Vingo Discounts'),
'weight'=>4,
'default'=>TRUE,
'stored'=>TRUE,
'add_list'=>TRUE,
'calculated'=>TRUE,
'display_only'=>FALSE,
'callback'=>'uc_vingodiscounts_discount'
);
return $items;
}
function uc_vingodiscounts_discount($op,$order){
//$discounts = uc_vingodiscounts_calculate($order);
switch ($op){
case 'cart-preview':
$script = "set_line_item('vingodisc','Vingo Discount1','-5.00');\n";
if ($script){
drupal_add_js("\$(document).ready( function() { ". $script ." } );", 'inline');
}
break;
case 'load':
$lines[] = array(
'id' => 'vingodisc',
'title' => 'Vingo Discount1',
'amount' => -5.00,
);
return $lines;
break;
}
}
?>I see the discount in the checkout page. But when i review my order it seems to still not discount it. Where Am i going wrong?








Joined: 08/08/2007