diff --git a/lib/WebGUI/Shop/Tax.pm b/lib/WebGUI/Shop/Tax.pm
index 50f42dd34..eafbac434 100644
--- a/lib/WebGUI/Shop/Tax.pm
+++ b/lib/WebGUI/Shop/Tax.pm
@@ -110,19 +110,22 @@ sub calculate {
return 0 if $cart->get('shippingAddressId') eq "";
my $address = $book->getAddress($cart->get('shippingAddressId'));
my $tax = 0;
+ ##Fetch the tax data for the cart address so it doesn't have to look it up for every item
+ ##in the cart with that address.
+ my $cartTaxables = $self->getTaxRates($address);
foreach my $item (@{ $cart->getItems }) {
my $sku = $item->getSku;
my $unitPrice = $sku->getPrice;
my $quantity = $item->get('quantity');
##Check for an item specific shipping address
- my $itemAddress;
+ my $taxables;
if (defined $item->get('shippingAddressId')) {
- $itemAddress = $book->getAddress($item->get('shippingAddressId'));
+ my $itemAddress = $book->getAddress($item->get('shippingAddressId'));
+ $taxables = $self->getTaxRates($itemAddress);
}
else {
- $itemAddress = $address;
+ $taxables = $cartTaxables;
}
- my $taxables = $self->getTaxRates($itemAddress);
##Check for a SKU specific tax override rate
my $skuTaxRate = $sku->getTaxRate();
my $itemTax;
@@ -398,11 +401,53 @@ sub www_view {
$style->setScript($url->extras('yui/build/datatable/datatable-beta-min.js'), {type => 'text/javascript'});
##YUI JSON handler
$style->setScript($url->extras('yui/build/json/json-min.js'), {type => 'text/javascript'});
+ ##Default CSS
$style->setRawHeadTags('');
my $i18n=WebGUI::International->new($session, 'Tax');
- ##Build column headers.
- my $output = sprintf <<'EOCHJS', $i18n->get('country'), $i18n->get('state'), $i18n->get('city'), $i18n->get('code');
+
+ my $output =<
+
+
+
+
+