Post by vna822 » Wed Apr 13, 2011 1:07 pm

The basic authentication is being done by the PHP script gcheckout.php on line 386 using the HTTPAuthentication() function. This function is declared in googleresonse.php in the system/google/library directory. This uses variables like $_SERVER['PHP_AUTH_USER']) , ($_SERVER['HTTP_AUTHORIZATION']) , etc. to get the authentication information and validate it. So, I am not sure what disabling basic authentication on the server means and how that can help. My understanding is that my server is running in CGI mode and so Apache does not pass HTTP Basic Authentication to it and so it is failing. Please correct me if I am wrong as I am just starting to understand this stuff.

Now, I have disabled the basic authentication by forcing the HTTPAuthentication() to return true without any validation. This seems to have fixed the problem. I dont get the

HTTP response code: 401. Response body was: Failed to Get Basic Authentication Headers

error anymore. I am not sure of the security implication of this. Would this mean anyone can send any XML data to the callback function, and potentially cause any harm? I will look to see how I could make Apache pass the HTTP information to the PHP and fix this loop hole.

Anyways, now I am have another simpler problem. I get the following parse error:

Error parsing XML; message from parser is: The value following "version" in the XML declaration must be a quoted string.

Warnings:
XML we received:

<?xml version=1.0 encoding=utf-8 ?>
<merchant-calculation-results xmlns="http://checkout.google.com/schema/2">
<results>
<result shipping-name="Weight Based Shipping - Zone (1-2)" address-id=113815907023469>
<shipping-rate currency=USD>6.99</shipping-rate>
<shippable>true</shippable>
</result>
</results>
</merchant-calculation-results>

XML we sent:

<?xml version="1.0" encoding="UTF-8"?>
<merchant-calculation-callback xmlns="http://checkout.google.com/schema/2" serial-number="00da4d8e-ebe8-4f3c-84f4-ed0cb70e6630">
<shopping-cart>
<merchant-private-data>

- - - - - - - - - - - - - - -


I quickly tried to look in the gcheckout.php to see how the XML string is generated so I could add the quotes but I could find it. I tried searching for this error but no opencart users seem to have got this error ( why me! ). If you could point me to where I should add these quotes I might be good to go. Again, thanks for all your help.

New member

Posts

Joined
Sat Mar 05, 2011 12:42 am

Post by JNeuhoff » Wed Apr 13, 2011 10:53 pm

Not sure how you manage to get the missing quotes.

Look at

system/google/library/xml-processing/gc_xmlbuilder.php

at line 35 which should be

Code: Select all

      $this->xml = '<?xml version="1.0" encoding="utf-8"?>'."\n";

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 vna822 » Thu Apr 14, 2011 2:07 am

The code in my file is exactly the same. I tried to put extra quotes and see what happens and then it failed the first time it tried to communicate with google checkout. It wont even go to the google checkout page when I click the google checkout button. It would give a red color error message on my site. So, I am guessing the quotes are being stripped out somewhere in the callback. Also interesting is that if you look in the XML message google received that I posted in my previous post, only that line is missing the quotes - missing around version and missing around utf. The line immediately next to it has the quotes. So, may be there is some formatting function that is being run on that line before putting it together with the rest of the XML and this is stripping out the quotes?

Is that a possibility at all the way the callback is written? Is there a way I can see what the callback is sending to google? Is there a variable in which the complete XML string is stored before returning it to google? If so which one? May be I could put some code to check the variable right before it is returned to google and make the necessary correction.

New member

Posts

Joined
Sat Mar 05, 2011 12:42 am

Post by JNeuhoff » Thu Apr 14, 2011 4:19 am

In file system/google/library/googleresponse.php you could temporarily add some logging in method ProcessMerchantCalculations:

Code: Select all

    function ProcessMerchantCalculations($merchant_calc) {
      $this->SendOKStatus();
      $result = $merchant_calc->GetXML();
      ob_start();
      var_dump( $result );
      error_log( ob_get_contents(),3,DIR_LOGS."error.txt" );
      ob_end_clean();
      echo $result;
    }

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 vna822 » Thu Apr 14, 2011 7:46 am

Okay, now this is the most bizarre thing I have ever seen. I get the parse error at random. Yes, at random. This is NOT a problem in opencart or the google checkout module. It may have something to do with XML. I found this link which is what I am probably facing.

http://forums.devx.com/showthread.php?t=157549

I will try and explain what I mean by random. I add the product on my website and hit google checkout and suddenly I see the correct shipping price ( $6.99 and NOT $0.00 ). Then I wanted to test if it updates and restricts based on selected region. so, I use different addresses that I have saved on my google checkout buyer account. I change from RI to a CA address and I see the yellow no shipping available message. Good. Now, I change it to my MA address and the shipping changes to the zone and the shipping is $0.00. Now, I change it back to RI. The shipping is $6.99. Now, I change it back to MA and surprisingly the shipping is $6.99.
I change it back to CA. - no shipping
Change it to MA - $6.99
change it to CT - $0.00
change it to CA - no shipping
change it to CT - $0.00 ...

At this point I just give up. I found that there is a backup shipping cost that can be used in case there is errors which is passed with the "GoogleMerchantCalculatedShipping()" function. So, I simply changed this function on line 173 in the gcheckout.php to :

Code: Select all

$shipping = new GoogleMerchantCalculatedShipping( $names[$code], 6.99 );
I will see if i can contact Google and see why this is happening and how I can fix it. If any of you know a direct way to contact Google checkout please let me know.

JNeuhoff - Thank you so much for all your time. I greatly appreciate it.

New member

Posts

Joined
Sat Mar 05, 2011 12:42 am

Post by JNeuhoff » Thu Apr 14, 2011 5:11 pm

OK, one step at a time.

What's in your system/logs/error.txt ?

Does it show the generated XML response correctly, e.g. with correct quotes for the version attribute?

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 vna822 » Fri Apr 15, 2011 4:26 am

Yes it has the correct quotes. Here is a copy from the error log:

string(369) "<?xml version="1.0" encoding="utf-8"?>
<merchant-calculation-results xmlns="http://checkout.google.com/schema/2">
<results>
<result shipping-name="Weight Based Shipping - Zone (1-2)" address-id="113815907023469">
<shipping-rate currency="USD">6.99</shipping-rate>
<shippable>true</shippable>
</result>
</results>
</merchant-calculation-results>
"

New member

Posts

Joined
Sat Mar 05, 2011 12:42 am

Post by JNeuhoff » Fri Apr 15, 2011 4:47 pm

Now, I change it back to RI. The shipping is $6.99. Now, I change it back to MA and surprisingly the shipping is $6.99.
Can you look up the corresponding log entries in your

system/logs/googlemessage.log and system/logs/googleerror.log ?

You problem appears to be a session or browser caching issue.

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 vna822 » Fri Apr 15, 2011 11:17 pm

I am not sure if it is a browser caching problem. Because I see the error messages in the Integration console in my google checkout account. Also, I tried to use the google checkout from another computer and I still get the errors. I attached the log files. I didn't see anything in it either.

Attachments

Google Message Log

Google Error Log


New member

Posts

Joined
Sat Mar 05, 2011 12:42 am

Post by JNeuhoff » Sat Apr 16, 2011 5:41 am

I can't find any entries in your googlemessage.log with a $6.99 shipping quote for MA, all your successful shipping quotes according to this log are for RI.

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 vna822 » Sat Apr 16, 2011 6:11 am

I understand that is not good but I still dont know how to fix it.

New member

Posts

Joined
Sat Mar 05, 2011 12:42 am

Post by vna822 » Sat Apr 16, 2011 9:27 am

I was able to install this on my test server though and it works fine. I think the problem is with how the PHP is setup on Dreamhost. I have a quick question though. Now, with the test server I submitted an order and it went through fine. I got an email that there was an order placed but I dont see the order in my opencart backend. Does this module put the orders in the database or do I deal with the orders from google checkout separately?

New member

Posts

Joined
Sat Mar 05, 2011 12:42 am

Post by JNeuhoff » Tue Apr 19, 2011 5:35 pm

Orders from Google Checkout are not stored in Opencart, order fulfilment is through the Google account.

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 vna822 » Wed Apr 20, 2011 8:28 am

I moved my site to godaddy and now it is working. It still has the Basic authentication problem but when I bypass that, the callbacks are now working. So, I want to once again thank you for all your help.

I did see in the module description that you mentioned all order processing is done in google checkout. But I noticed this post http://forum.opencart.com/viewtopic.php?t=20919 where Kathlk said "Now I can see my cart get empty when returning from the Google cart. Also I have seen new order created in open cart." So, I wasn't sure if that feature was really not there or if it was an artifact of all the errors I had been seeing. Although, it would nice to have the orders created in opencart so I can manage them all at one place for future accounting and all. I did notice that you have some code for "adding ordered digital items to the database". I could probably use this and code up something that will create orders in the database for all orders but I will save it for another day.

Once again thanks for all your help.

New member

Posts

Joined
Sat Mar 05, 2011 12:42 am

Post by 247TopDeals » Sun May 22, 2011 1:26 am

Not sure if this might have anything to do with the problem but I was having
the same problem with GC not getting the shipping right.
I had my shop in maintenance mode and it wasn't working but when
I took it out of maintenance mode it did work correctly and had the correct shipping cost.

Just thought I'd let you all know just in case that had something to do with it.


Gerrit 8)

The all new home for 24/7 TopDeals Furniture is here.
Traditional, Rustic and Stylish oak and pine, bedroom and living room furniture.


New member

Posts

Joined
Thu Feb 11, 2010 7:31 pm
Location - United Kingdom

Post by nickt15 » Thu Apr 26, 2012 12:05 am

Hi,
I am using 1.5.1.3 I can't get google checkout to calculate shipping, this is the url call back

http://www.toysandbaby.com/index.php?ro ... t/callback

I also tried using https and that didn't work, I also tried having google calculate the shipping from my google merchant acct shipping settings & that didn't work, I have looked at other solutions in this forum & nothing worked, so please any help would be appreciated !!

I am using hostgator as the host with dedicated ssl

The only thing it does calculate the tax.

What else can be the problem ?

Thanks in advance

New member

Posts

Joined
Tue Jan 25, 2011 8:50 am

Post by JNeuhoff » Thu Apr 26, 2012 12:38 am

Have you checked the Google account integration console for any message? Also are there any message in Opencart system/logs/error.txt?

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 nickt15 » Thu Apr 26, 2012 12:52 am

Hi,
I just checked the error log & I am not a programmer but I have a load of these error message so far today:

2012-04-25 16:35:41 - PHP Notice: Undefined index: route in /home/y7hkr3t7/public_html/catalog/view/theme/default/template/module/shippingestimate.tpl on line 121

I use a theme not the default template if that has anything to so with it ?

2012-04-25 13:50:46 - PHP Notice: Undefined index: name in /home/y7hkr3t7/public_html/catalog/controller/module/shippingestimate.php on line 98
2012-04-25 13:50:46 - PHP Notice: Undefined index: code in /home/y7hkr3t7/public_html/catalog/controller/module/shippingestimate.php on line 99

There are no error messages in my admin in the google checkout module & no errors mssgs in my google merchant acct either as far as the shipping ?

So Im assuming its because of the above error messages ?

New member

Posts

Joined
Tue Jan 25, 2011 8:50 am

Post by JNeuhoff » Thu Apr 26, 2012 2:04 am

nickt15 wrote:Hi,
I just checked the error log & I am not a programmer but I have a load of these error message so far today:

2012-04-25 16:35:41 - PHP Notice: Undefined index: route in /home/y7hkr3t7/public_html/catalog/view/theme/default/template/module/shippingestimate.tpl on line 121

I use a theme not the default template if that has anything to so with it ?

2012-04-25 13:50:46 - PHP Notice: Undefined index: name in /home/y7hkr3t7/public_html/catalog/controller/module/shippingestimate.php on line 98
2012-04-25 13:50:46 - PHP Notice: Undefined index: code in /home/y7hkr3t7/public_html/catalog/controller/module/shippingestimate.php on line 99

There are no error messages in my admin in the google checkout module & no errors mssgs in my google merchant acct either as far as the shipping ?

So Im assuming its because of the above error messages ?
This is a bug in the 3rd party shipping estimate module which has nothing to do with Google Checkout.

Your callback URL (provided you have the SSL) should be https://www.toysandbaby.com/index.php?r ... t/callback

You don't have any messages from Google Checkout, so I am unable to help you wiothout further details.

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 nickt15 » Thu Apr 26, 2012 2:36 am

I re-installed it & messed up my whole site, so I just deleted all the files to get my site back to working.
Thanks anyway

New member

Posts

Joined
Tue Jan 25, 2011 8:50 am
Who is online

Users browsing this forum: No registered users and 22 guests