Hi Perch,
You can add extra fields to "extra line items" by adding them to the arrays returned by sc_addTax() and sc_addShipping(). To see how things fit together, you may want to look at sc_getExtraLineItems(), which is what collects the extra line items from those two functions.
In sc-order-summary.php, you could add an optional 'desc' field:
<?php foreach ($extraLineItems as $extraLineItem): ?>
<tr>
<td><?php echo htmlspecialchars($extraLineItem['name']); ?>: </td>
<td align="right"><?php echo sc_moneyFormat($extraLineItem['TOTAL']); ?></td>
<td><?php echo @$extraLineItem['desc'] ?></td>
</tr>
<?php endforeach; ?>
Then add it to the array returned by sc_addTax():
function sc_addTax($cartItems) {
$taxRate = @$GLOBALS['SC_TAX_RATE'];
$desc = 'No VAT';
// custom tax rate for canadians
if (@$_REQUEST['billing_country'] == 'United Kingdom') {
$taxRate = 0.14;
$desc = 'VAT Included';
}
$taxTotal = 0;
foreach ($cartItems as $cartItem) {
$taxTotal += @$cartItem['TOTAL'] * $taxRate;
}
$taxTotal = round($taxTotal, 2);
$taxPercentage = $taxRate * 100;
return array( 'name' => "Tax ($taxPercentage%)", 'TOTAL' => $taxTotal, 'desc' => $desc );
}
And add it to the array returned by sc_addShipping():
function sc_addShipping($cartItems) {
$weightTotal = 0;
$shippingTotal = 0;
foreach ($cartItems as $cartItem) {
$shippingTotal += @$cartItem['shipping'] * @$cartItem['quantity'];
$weightTotal += @$cartItem['weight'] * @$cartItem['quantity']
foreach ($cartItem['OPTIONS'] as $option) {
$shippingTotal += @$option['shipping'] * @$cartItem['quantity'];
$weightTotal += @$option['weight'] * @$cartItem['quantity']
}
}
$desc = $weightTotal . "kg";
return array( 'name' => 'Shipping', 'TOTAL' => $shippingTotal, 'desc' => $desc );
}
Does that help?
All the best,
Chris