Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Offical Google Checkout module for osCommerce Support Thread


1175 replies to this topic

#1 Silverado05

  • Community Member
  • 1,605 posts
  • Real Name:Nick

Posted 11 August 2007, 17:33

In order to contain all the support to one thread so I can accurately help those needing help with this module please post your support questions here and I will be more then happy to help you with this to best of my ability.

Contribution can be found below.

Google Checkout module for osCommerce

Current release is version 1.4 Dated 17 Jul 2007
Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

#2 i960

  • Community Member
  • 133 posts
  • Real Name:Jeff

Posted 11 August 2007, 18:06

Continuing from the previous thread.

I found a new potential issue. In looking at the osCommerce documentation, I found this note:

Quote

Sessions

Customers on AOL cannot use your store with these all set to "True". The only two that
can be set to "True" for aol users are "Force Cookie Use" and "Prevent Spider Sessions".

Does this mean having "Check SSL Session ID" set to true is going to cause problems for my aol customers? We have quite a few of them.

#3 i960

  • Community Member
  • 133 posts
  • Real Name:Jeff

Posted 11 August 2007, 18:38

I also found this page that better explains what each setting does:

http://www.oscommerce.info/kb/osCommerce/D...plementations/4

Seems to me that ideal settings would be "Force Cookie Use" to True (I don't want anyone to have session id's in the URL for privacy/security reasons) and "Check SSL Session ID" to False (So there are no issues with AOL or weird browsers that don't support it). But obviously that isn't going to work with Google Checkout. I also ran across this old thread:

http://forums.oscommerce.com/index.php?showtopic=41451

Doesn't seem like anyone found a solution to AOL being blocked. Also, seeing as it's from 2003, it's possible that AOL is now using a browser that will work just fine. I just have no way of testing that.

#4 i960

  • Community Member
  • 133 posts
  • Real Name:Jeff

Posted 11 August 2007, 18:47

Well, after more testing, I realized that even if my browser accepts cookies, as soon as I hit any of the secure pages, the session ID is appended to the URL. That is something I do not want. Setting "Force Cookie Use" to True solves that problem, but then Google Checkout stops working. There has got to be another way to do this.

#5 Navidjun

  • Community Member
  • 10 posts
  • Real Name:Navid A
  • Gender:Male
  • Location:US

Posted 11 August 2007, 22:20

Hi ,

I have Google checkout installed and it works great, but ...
It does not get the shipping rates from the usps method 2.8 .... it just shows all zeros fo all the shipping options at the google checkout site, even though on OSC itself it shows the correct prices. so my costumers get zero shipping cost.
can you please help

for now I've stopped usps and I'm using the table rate ythat does work with GCO.

tahnks :rolleyes:

#6 Silverado05

  • Community Member
  • 1,605 posts
  • Real Name:Nick

Posted 12 August 2007, 01:36

View Posti960, on Aug 11 2007, 01:47 PM, said:

Well, after more testing, I realized that even if my browser accepts cookies, as soon as I hit any of the secure pages, the session ID is appended to the URL. That is something I do not want. Setting "Force Cookie Use" to True solves that problem, but then Google Checkout stops working. There has got to be another way to do this.

That is a development issue that will need to be addressed with the author of the mod. I told him I would help him with support issues here, but development issues of that magnitude will need to be addressed with him at his board.


http://groups.google.com/group/google-chec...-support/topics


I wish I could help you more with that but that is out of my power.
Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

#7 Silverado05

  • Community Member
  • 1,605 posts
  • Real Name:Nick

Posted 12 August 2007, 01:39

View PostNavidjun, on Aug 11 2007, 05:20 PM, said:

Hi ,

I have Google checkout installed and it works great, but ...
It does not get the shipping rates from the usps method 2.8 .... it just shows all zeros fo all the shipping options at the google checkout site, even though on OSC itself it shows the correct prices. so my costumers get zero shipping cost.
can you please help

for now I've stopped usps and I'm using the table rate ythat does work with GCO.

tahnks :rolleyes:


What is the error you are getting from Google in your settings integration? It is probably a time out issue, do you have long descriptions be passed to google? Also what version are you using?
Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

#8 i960

  • Community Member
  • 133 posts
  • Real Name:Jeff

Posted 12 August 2007, 05:05

View PostSilverado05, on Aug 11 2007, 06:36 PM, said:

That is a development issue that will need to be addressed with the author of the mod. I told him I would help him with support issues here, but development issues of that magnitude will need to be addressed with him at his board.
http://groups.google.com/group/google-chec...-support/topics
I wish I could help you more with that but that is out of my power.

That's what I figured. I guess the logic would be to force cookie use for customers and search spiders, but not force it for Google Checkout. I noticed in posts on the google groups board that he's been recommending people set Force Cookie Use to false in order to get GC working. I'm going to dig into how the force cookie use option actually works and see if I can come up with something. I guess the first step is to figure out what Google Checkout is identifying itself as. I'm guessing it's 'jakarta', as that is what the documentation says to make sure is not in spiders.txt.

#9 i960

  • Community Member
  • 133 posts
  • Real Name:Jeff

Posted 12 August 2007, 05:15

Interesting info on what 'jakarta' actually is: http://en.wikipedia.org/wiki/Jakarta_Project

I'm guessing Google is using that to implement Google Checkout on their side.

#10 i960

  • Community Member
  • 133 posts
  • Real Name:Jeff

Posted 12 August 2007, 05:50

Here is the code in application_top.php that starts the session, based on the session settings in Admin:

// start the session
  $session_started = false;
  if (SESSION_FORCE_COOKIE_USE == 'True') {
    tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain);

    if (isset($HTTP_COOKIE_VARS['cookie_test'])) {
      tep_session_start();
      $session_started = true;
    }
  } elseif (SESSION_BLOCK_SPIDERS == 'True') {
    $user_agent = strtolower(getenv('HTTP_USER_AGENT'));
    $spider_flag = false;

    if (tep_not_null($user_agent)) {
      $spiders = file(DIR_WS_INCLUDES . 'spiders.txt');

      for ($i=0, $n=sizeof($spiders); $i<$n; $i++) {
        if (tep_not_null($spiders[$i])) {
          if (is_integer(strpos($user_agent, trim($spiders[$i])))) {
            $spider_flag = true;
            break;
          }
        }
      }
    }

    if ($spider_flag == false) {
      tep_session_start();
      $session_started = true;
    }
  } else {
    tep_session_start();
    $session_started = true;
  }

If my thinking is correct, it should be possible to test the user_agent string for whatever Google Checkout is calling itself (jakarta or otherwise) and allow the session to be started if it is Google Checkout accessing the site. I will see what I can come up with and post my findings. The only way I can see this not working is if Google Checkout changes it's user_agent string every once in awhile. If that's the case, then maybe setting up a file similar to spiders.txt and keeping a list of all know user_agent strings for Google Checkout would help with that.

#11 i960

  • Community Member
  • 133 posts
  • Real Name:Jeff

Posted 12 August 2007, 06:41

It works!!! Through testing I was able to find out that Google Checkout is reporting itself as 'google checkout notification agent 1.0'. I'll post again in a few minutes showing what I did to make it work.

#12 i960

  • Community Member
  • 133 posts
  • Real Name:Jeff

Posted 12 August 2007, 07:01

Alright, here's how to make this work.

STEP 1:
Create a file called 'gc_user_agent.txt' and place it in your /catalog/includes/ directory. It should be in the same place as spiders.txt. Add the following to this file and save it:

Quote

google checkout notification agent 1.0

STEP 2:
Open 'application_top.php'

Search for the following:

  if (SESSION_FORCE_COOKIE_USE == 'True') {
    tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain);

    if (isset($HTTP_COOKIE_VARS['cookie_test'])) {
      tep_session_start();
      $session_started = true;
    }


And replace it with this:

  if (SESSION_FORCE_COOKIE_USE == 'True') {
    $user_agent = strtolower(getenv('HTTP_USER_AGENT'));
    $gc_flag = false;

    if (tep_not_null($user_agent)) {
      $gc_user_agent = file(DIR_WS_INCLUDES . 'gc_user_agent.txt');

      for ($i=0, $n=sizeof($gc_user_agent); $i<$n; $i++) {
        if (tep_not_null($gc_user_agent[$i])) {
          if (is_integer(strpos($user_agent, trim($gc_user_agent[$i])))) {
            $gc_flag = true;
            break;
          }
        }
      }
    }

    if ($gc_flag == true) {
      tep_session_start();
      $session_started = true;
    } else {
      tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain);
      if (isset($HTTP_COOKIE_VARS['cookie_test'])) {
        tep_session_start();
        $session_started = true;
      }
    }

Make sure you check to see that your original code in 'application_top.php' is the same as mine. The code I listed is from a stock install of 2.2 RC1, but it should be the same in MS2. If yours was modified for whatever reason, you'll need to figure out what to do with the new code to make it work.

STEP 3:
Set 'Force Cookie Use' and 'Prevent Spider Sessions' in Admin to TRUE. Everything else should be FALSE.

That's it! Now you can force the usage of cookies for regular visitors, prevent search spiders from creating sessions, and allow Google Checkout to recreate the session it needs in order to update admin and empty the shopping cart. One thing to keep in mind is that I have no idea if Google will change the user agent string or how often. That is why I placed it in 'gc_user_agent.txt' to allow for easy updates if/when necessary. If I find that Google does change the user agent, then maybe it would be good to write some sort of script that captures the user agent string when Google connects to responsehandler.php and updates the 'gc_user_agent.txt' file automatically.

#13 Navidjun

  • Community Member
  • 10 posts
  • Real Name:Navid A
  • Gender:Male
  • Location:US

Posted 12 August 2007, 07:27

View PostSilverado05, on Aug 11 2007, 09:39 PM, said:

What is the error you are getting from Google in your settings integration? It is probably a time out issue, do you have long descriptions be passed to google? Also what version are you using?

I don't get any errors , I just see zeros for the all the shipping options, it seems GCO retrives the shipping options , but not the pricing for them.

#14 i960

  • Community Member
  • 133 posts
  • Real Name:Jeff

Posted 12 August 2007, 19:09

Looks like there is another potential solution to the problem I was having. I found it in the Google Groups, but the thread title was highly misleading. It was suggested over there that you could redefine the Prevent Spider Sessions setting for responsehandler.php only. Here's a quote of what was said over there:

Quote

Instead open up googlecheckout/responsehandler.php and find this line:

define('MODULE_PAYMENT_GOOGLECHECKOUT_MULTISOCKET', 'False');

Immediately below it add this:

define('SESSION_BLOCK_SPIDERS','False');

This will disable "Prevent Spider Sessions" for responsehandler.php
while leaving the setting as is for the rest of your store.

Ropu responded by saying that would throw up a warning, and suggested adding this to prevent the warning from appearing:

error_reporting(0);

I haven't tested this yet, but I do have an observation. From looking at the code, it's quite obvious that the "Prevent Spider Sessions" option has no effect whatsoever on Google Checkout, as long as 'google checkout notification agent 1.0' is not in your spiders.txt file. In fact, if you have "Force Cookie Use" set to TRUE, then the code behind "Prevent Spider Sessions" doesn't even run. Up to this point the real solution to getting GC to work is to set "Force Cookie Use" to FALSE, but that is a terrible solution for many reasons. That option should always be set to TRUE if possible. So the solution is to set it to FALSE only in responsehandler.php. That can be done just the same as was suggested for "Prevent Spider Sessions", like this:

1.) Open up resonsehandler.php

2.) Search for error_reporting(E_ALL); and change it to error_reporting(0);

3.) Search for define('MODULE_PAYMENT_GOOGLECHECKOUT_MULTISOCKET', 'False');

4.) Immediately below it add this: define('SESSION_FORCE_COOKIE_USE', 'False');


I have not tested this at all, but it appears to be a better solution than what I came up with, because it does not rely on knowing what the user agent is for Google Checkout. The only thing that should ever be connecting to responsehandler.php is Google Checkout, so there are no worries about starting a session for a search spider or anything like that. In fact, if you have it properly password protected via .htaccess, nothing else can get to it. I will test this out to see if it works. If so, then I will recommend using this solution instead of my previous one.

Edited by i960, 12 August 2007, 19:10.


#15 i960

  • Community Member
  • 133 posts
  • Real Name:Jeff

Posted 12 August 2007, 19:22

Ok, testing complete! The solution in my post immediately above works perfectly. As such, I no longer recommend using the solution I posted previously. While the previous solution does indeed work, this new solution works just as well, is easier to implement, and doesn't rely on knowing the user agent for Google Checkout.

#16 i960

  • Community Member
  • 133 posts
  • Real Name:Jeff

Posted 12 August 2007, 19:44

Preliminary testing shows that this fix also works for Google Checkout v1.3RC2. In other words, it's now working on my production site. :D

#17 theantiquestore

  • Community Member
  • 583 posts
  • Real Name:Rachael
  • Gender:Female

Posted 12 August 2007, 20:25

I have a very dumb question, and I apologize for it in advance.

It seems I've been working to the point that I can no longer think rationally.

I've installed the v1.4 beta and somehow I've done something wrong and cant seem to figure out where my issue lies.

While I do see the googlecheckout payment module in the admin, when I click install nothing happens.

I've uploaded the googlecheckout.php file to includes/modules/payment. Looked over my code in admin/modules.php and so on, but I cant find the bugger thats causing this.

I have the catalog installed in the root, so there is no catalog/ in my site (if that makes any difference at all)

I am sure there is one simple place where I can find the problem, I am sure I am just overlooking the obvious, but I need a hint on where I should be looking for this from anyone who would be so kind as to assist me.

Thank you in advance for your help, I'll keep plugging away on it in the meantime.

#18 theantiquestore

  • Community Member
  • 583 posts
  • Real Name:Rachael
  • Gender:Female

Posted 12 August 2007, 20:32

forget it, I knew I would find my mistake as soon as that edit button was no longer available! I edited the wrong functions/general file...duh! ;)

#19 theantiquestore

  • Community Member
  • 583 posts
  • Real Name:Rachael
  • Gender:Female

Posted 12 August 2007, 20:46

ok, install is still not working, I'm dumbfounded! Any suggestions?

#20 Silverado05

  • Community Member
  • 1,605 posts
  • Real Name:Nick

Posted 13 August 2007, 03:20

View PostNavidjun, on Aug 12 2007, 02:27 AM, said:

I don't get any errors , I just see zeros for the all the shipping options, it seems GCO retrives the shipping options , but not the pricing for them.


What shipping modules are you using and what is the version of Google Checkout are you using?
Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.