Tax is not showing in order summary

regarding:
// $Id: tax.module,v 1.16.2.4.4.7 2007/02/27 06:53:51 sime Exp $

in the function function tax_checkoutapi()

change this:

  foreach ($rules as $rule) {
	switch ($rule->realm) {
	  case 'city':
		if (drupal_strtoupper($billing->city) == $rule->realm_value && tax_rule_product_match($txn, $rule)) {
		  if ($tax = tax_calculate($taxable_amount, $rule->operand, $rule->operator)) {
			$total_tax += $tax;
		  }
		}
		break;
	  case 'country':
		if (drupal_strtoupper($billing->country) == $rule->realm_value && tax_rule_product_match($txn, $rule)) {
		  if ($tax = tax_calculate($taxable_amount, $rule->operand, $rule->operator)) {
			$total_tax += $tax;
		  }
		}
		break;
	  case 'state':
		if ($billing->state) {
		  if (drupal_strtoupper($states[$billing->state]) == $rule->realm_value && tax_rule_product_match($txn, $rule)) {
			if ($tax = tax_calculate($taxable_amount, $rule->operand, $rule->operator)) {
			  $total_tax += $tax;
			}
		  }
		}
		break;
	}
  }

to (removed drupal_strtoupper() 3 times):

  foreach ($rules as $rule) {
	switch ($rule->realm) {
	  case 'city':
		if ($billing->city == $rule->realm_value && tax_rule_product_match($txn, $rule)) {
		  if ($tax = tax_calculate($taxable_amount, $rule->operand, $rule->operator)) {
			$total_tax += $tax;
		  }
		}
		break;
	  case 'country':
		if ($billing->country == $rule->realm_value && tax_rule_product_match($txn, $rule)) {
		  if ($tax = tax_calculate($taxable_amount, $rule->operand, $rule->operator)) {
			$total_tax += $tax;
		  }
		}
		break;
	  case 'state':
		if ($billing->state) {
		  if ($states[$billing->state] == $rule->realm_value && tax_rule_product_match($txn, $rule)) {
			if ($tax = tax_calculate($taxable_amount, $rule->operand, $rule->operator)) {
			  $total_tax += $tax;
			}
		  }
		}
		break;
	}
  }

or (added drupal_strtoupper() 3 times):

  foreach ($rules as $rule) {
	switch ($rule->realm) {
	  case 'city':
		if (drupal_strtoupper($billing->city) == drupal_strtoupper($rule->realm_value) && tax_rule_product_match($txn, $rule)) {
		  if ($tax = tax_calculate($taxable_amount, $rule->operand, $rule->operator)) {
			$total_tax += $tax;
		  }
		}
		break;
	  case 'country':
		if (drupal_strtoupper($billing->country) == drupal_strtoupper($rule->realm_value) && tax_rule_product_match($txn, $rule)) {
		  if ($tax = tax_calculate($taxable_amount, $rule->operand, $rule->operator)) {
			$total_tax += $tax;
		  }
		}
		break;
	  case 'state':
		if ($billing->state) {
		  if (drupal_strtoupper($states[$billing->state]) == drupal_strtoupper($rule->realm_value) && tax_rule_product_match($txn, $rule)) {
			if ($tax = tax_calculate($taxable_amount, $rule->operand, $rule->operator)) {
			  $total_tax += $tax;
			}
		  }
		}
		break;
	}
  }

Both options work, adding drupal_strtoupper() (suggestion 2) may be saver but generates some extra function calls.

Regards, Jos

Comments

gordon’s picture

Status: Needs review » Fixed

Thanks this has now been commited to D5 and 4.7

Anonymous’s picture

Status: Fixed » Closed (fixed)
biohabit’s picture

Version: 5.x-3.0-rc1 » 4.7.x-3.1
Status: Closed (fixed) » Active

I'm seeing this exact issue with drupal 4.7.6 and ecommerce 3.1. When I'm at /admin/store/settings/checkout I see only the following.

ec_anon
address
flexicharge
payment
shipping
cart

Taxes are not being applied (a sales tax for California).

brmassa’s picture

Status: Active » Patch (to be ported)

guys,

I found the bug:
if (drupal_strtoupper($states[$billing->state]) == $rule->realm_value && tax_rule_product_match($txn, $rule)) {
should be:
if (drupal_strtoupper($billing->state) == $rule->realm_value && tax_rule_product_match($txn, $rule)) {

i fixed on EC4. this needs porting to EC3.

regards,

massa

biohabit’s picture

I manually applied this change to my d4.7.6 E3.1 site and it works as expected, Thanks!

brmassa’s picture

Status: Patch (to be ported) » Fixed
yareckon’s picture

This one line change also works for us using drupal 5.x and eCom 3.x

Anonymous’s picture

Status: Fixed » Closed (fixed)
Anonymous’s picture

Status: Closed (fixed) » Active

Hi - I am encountering this bug on version 5.3.4 -- applying the patch above.

Anonymous’s picture

Just confirming, Massa's fix above (at line 116 in 5.3.4) is not rolled into the released code. Applying the patch fixed it.

Thank you...

jbomb’s picture

Version: 4.7.x-3.1 » 5.x-3.5

This is also relevant for the 3.5 release. I also applied the patch with satisfactory results.

davea’s picture

Status: Active » Fixed

Applied to 5.x.3.5 HEAD

davea’s picture

Status: Fixed » Closed (fixed)

complete