Post by sunburn1979 » Fri Nov 05, 2010 6:06 pm

Hey Guys, Currently running OC 1.4.7 with Google checkout. I keep getting the following error, "Google Checkout : Not available for this product" .... Every thing has been working fine until I had to make the following changes a few days ago.

1. Created a new GEO Zone that has all the European member states so that a customer from any of these members states has the UK VAT rate applied.

2. Created a New Tax class, so that the above European Customers get charged the 17.5% on purchases

Now this seems to disable google checkout, I have proven this by removing the step 2 (deleting TAX CLASS) and the checkout becomes available again.

Can anyone advise, is this correct, a bug, or have I set something up wrong? I have to have step 1 & 2 in place.

Thanks for your help all.
Last edited by i2Paq on Sat Nov 06, 2010 3:06 am, edited 1 time in total.
Reason: Topic moved

New member

Posts

Joined
Thu Aug 13, 2009 4:36 pm

Post by JNeuhoff » Fri Nov 05, 2010 6:37 pm

Can you try the following change in file catalog/controller/module/gcheckout.php, in method available, where it checks for the tax rules being compatible with Google's requirements:

Code: Select all

		.........
		// Make sure product's tax rules, if there, are compatible with Google Checkout
		$rows = $this->model_checkout_gcheckout->findProductTaxRules( $this->cart->getProducts() );
		foreach ($rows as $row) {
			if ($row['iso_code_2']=='US') {
				if (is_null($row['code'])) {
					continue;
				}
				if ($this->model_checkout_gcheckout->isUSStateArea( $row['code'] )) {
					continue;
				}
			}
			else if ($row['iso_code_2']=='GB') {
				if (is_null($row['code'])) {
					continue;
				}
			} else 
				if (is_null($row['code'])) {
					continue;
				}
			}
			error_log( date('Y-m-d H:i:s - ', time())."ControllerModuleGCheckout::available: Product's tax rules not compatible for Google Checkout\n",3,DIR_LOGS."error.txt" );
			return FALSE;
		}
		..........
Let me know if this change will solve your problem, and I'll this change in future releases of the Google Checkout module.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by sunburn1979 » Sat Nov 06, 2010 1:10 am

Hi There, I replaced the code in gcheckout.php with what you provided, but it made no difference :(
error logs read

2010-11-05 17:12:52 - ControllerModuleGCheckout::available: Product's tax rules not compatible for Google Checkout

Any thing else I can try ?

New member

Posts

Joined
Thu Aug 13, 2009 4:36 pm

Post by JNeuhoff » Sat Nov 06, 2010 2:22 am

Add a var_dump into your code and let me know what output you get:

Code: Select all

		......
		// Make sure product's tax rules, if there, are compatible with Google Checkout
		$rows = $this->model_checkout_gcheckout->findProductTaxRules( $this->cart->getProducts() );
		var_dump($rows); exit;
		.....
There is probably something odd with your product's tax rules.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by sunburn1979 » Mon Nov 08, 2010 4:18 am

Hi, ok here is the dump you require....

Code: Select all

array(27) { [0]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(3) "222" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "GB" ["code"]=> NULL } [1]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(3) "117" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "LV" ["code"]=> NULL } [2]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(3) "105" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "IT" ["code"]=> NULL } [3]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(3) "103" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "IE" ["code"]=> NULL } [4]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(2) "97" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "HU" ["code"]=> NULL } [5]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(2) "84" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "GR" ["code"]=> NULL } [6]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(2) "81" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "DE" ["code"]=> NULL } [7]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(2) "73" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "FR" ["code"]=> NULL } [8]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(2) "72" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "FI" ["code"]=> NULL } [9]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(2) "67" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "EE" ["code"]=> NULL } [10]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(2) "57" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "DK" ["code"]=> NULL } [11]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(2) "56" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "CZ" ["code"]=> NULL } [12]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(2) "55" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "CY" ["code"]=> NULL } [13]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(2) "33" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "BG" ["code"]=> NULL } [14]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(2) "21" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "BE" ["code"]=> NULL } [15]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(2) "14" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "AT" ["code"]=> NULL } [16]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(3) "123" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "LT" ["code"]=> NULL } [17]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(3) "124" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "LU" ["code"]=> NULL } [18]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(3) "132" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "MT" ["code"]=> NULL } [19]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(3) "150" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "NL" ["code"]=> NULL } [20]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(3) "170" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "PL" ["code"]=> NULL } [21]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(3) "171" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "PT" ["code"]=> NULL } [22]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(3) "175" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "RO" ["code"]=> NULL } [23]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(3) "189" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "SK" ["code"]=> NULL } [24]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(3) "190" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "SI" ["code"]=> NULL } [25]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(3) "195" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "ES" ["code"]=> NULL } [26]=> array(5) { ["tax_class_id"]=> string(1) "9" ["country_id"]=> string(3) "203" ["zone_id"]=> string(1) "0" ["iso_code_2"]=> string(2) "SE" ["code"]=> NULL } } 

for reference, there is now one tax class that is applied to the European Geo Zone which include 26members states of Europe and UK.

I hope this helps?

New member

Posts

Joined
Thu Aug 13, 2009 4:36 pm

Post by JNeuhoff » Mon Nov 08, 2010 6:11 pm

That defeats me, your tax class is correctly set up.
You should not get this particular error message.

Send me a PM with with Opencart and FTP login details, so that I can further investigate.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by sunburn1979 » Thu Nov 11, 2010 12:41 am

As this is a live store, ill have to setup a public test bed for you.
Will take a day or so, is that ok ?

New member

Posts

Joined
Thu Aug 13, 2009 4:36 pm

Post by JNeuhoff » Thu Nov 11, 2010 2:31 am

That's fine. Please also use a Google Sandbox seller account for your test site.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by sunburn1979 » Thu Nov 11, 2010 9:00 pm

Hi JNeuhoff

Took some time out to really understand what the code was doing, and think I have figured out the problem.

I have replaced the orginal code .....

Code: Select all

// Make sure product's tax rules, if there, are compatible with Google Checkout - ORGINAL
		/*$rows = $this->model_checkout_gcheckout->findProductTaxRules( $this->cart->getProducts() );
		foreach ($rows as $row) {
			if ($row['iso_code_2']=='US') {
				if (is_null($row['code'])) {
					continue;
				}
				if ($this->model_checkout_gcheckout->isUSStateArea( $row['code'] )) {
					continue;
				}
			}
			else if ($row['iso_code_2']=='GB') {
				if (is_null($row['code'])) {
					continue;
				}
			}
			error_log( date('Y-m-d H:i:s - ', time())."ControllerModuleGCheckout::available: Product's tax rules not compatible for Google Checkout\n",3,DIR_LOGS."error.txt" );
			return FALSE;
		}*/
with my editied version.....

Code: Select all

// Make sure product's tax rules, if there, are compatible with Google Checkout	- FIXED
	$rows = $this->model_checkout_gcheckout->findProductTaxRules( $this->cart->getProducts() );
      foreach ($rows as $row) { 
      	 if ($this->model_checkout_gcheckout->isUSStateArea( $row['code'] )) {
            continue;
         } else if (is_null($row['code'])) {
         	continue;
         }
           
        error_log( date('Y-m-d H:i:s - ', time())."ControllerModuleGCheckout::available: Product's tax rules not compatible for Google Checkout\n",3,DIR_LOGS."error.txt" );
         return FALSE;
      }     
This has resolved the problem with products not being able to be checked out with google checkout.
I suspect that the

Code: Select all

if ($this->model_checkout_gcheckout->isUSStateArea( $row['code'] )) {
            continue;
is optional also, and when testing, my fixed code worked without this included, but for argument sake I have kept it in the fix, untill i understand it more.

Is there anything I have missed or pit falls from my approach?

Cheers for your help.

Geoff

New member

Posts

Joined
Thu Aug 13, 2009 4:36 pm

Post by JNeuhoff » Thu Nov 11, 2010 11:33 pm

Geoff,

As I said, the following code should have worked, too:

Code: Select all

      .........
      // Make sure product's tax rules, if there, are compatible with Google Checkout
      $rows = $this->model_checkout_gcheckout->findProductTaxRules( $this->cart->getProducts() );
      foreach ($rows as $row) {
         if ($row['iso_code_2']=='US') {
            if (is_null($row['code'])) {
               continue;
            }
            if ($this->model_checkout_gcheckout->isUSStateArea( $row['code'] )) {
               continue;
            }
         }
         else if ($row['iso_code_2']=='GB') {
            if (is_null($row['code'])) {
               continue;
            }
         } else 
            if (is_null($row['code'])) {
               continue;
            }
         }
         error_log( date('Y-m-d H:i:s - ', time())."ControllerModuleGCheckout::available: Product's tax rules not compatible for Google Checkout\n",3,DIR_LOGS."error.txt" );
         return FALSE;
      }
      ..........
You should changed yours to allow the zones only for US states:

Code: Select all

   // Make sure product's tax rules, if there, are compatible with Google Checkout   - FIXED
   $rows = $this->model_checkout_gcheckout->findProductTaxRules( $this->cart->getProducts() );
      foreach ($rows as $row) { 
          if (($row['iso_code_2']=='US') && ($this->model_checkout_gcheckout->isUSStateArea( $row['code'] ))) {
            continue;
         } else if (is_null($row['code'])) {
            continue;
         }
           
        error_log( date('Y-m-d H:i:s - ', time())."ControllerModuleGCheckout::available: Product's tax rules not compatible for Google Checkout\n",3,DIR_LOGS."error.txt" );
         return FALSE;
      }     


Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by sunburn1979 » Fri Nov 12, 2010 12:33 am

Cheers JNeuhoff,

Ill add your final bit of code and re-test, obviously the less deviation I make from your standard code the better!

Thanks for all your help and advice.

Geoff.

New member

Posts

Joined
Thu Aug 13, 2009 4:36 pm
Who is online

Users browsing this forum: No registered users and 5 guests