Offical Google Checkout module for osCommerce Support Thread
#1
Posted 11 August 2007, 17:33
Contribution can be found below.
Google Checkout module for osCommerce
Current release is version 1.4 Dated 17 Jul 2007
#2
Posted 11 August 2007, 18:06
I found a new potential issue. In looking at the osCommerce documentation, I found this note:
Quote
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
Posted 11 August 2007, 18:38
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
Posted 11 August 2007, 18:47
#5
Posted 11 August 2007, 22:20
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
Posted 12 August 2007, 01:36
i960, on Aug 11 2007, 01:47 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.
#7
Posted 12 August 2007, 01:39
Navidjun, on Aug 11 2007, 05:20 PM, said:
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
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?
#8
Posted 12 August 2007, 05:05
Silverado05, on Aug 11 2007, 06:36 PM, said:
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
Posted 12 August 2007, 05:15
I'm guessing Google is using that to implement Google Checkout on their side.
#10
Posted 12 August 2007, 05:50
// 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
Posted 12 August 2007, 06:41
#12
Posted 12 August 2007, 07:01
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
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
Posted 12 August 2007, 07:27
Silverado05, on Aug 11 2007, 09:39 PM, 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.
#14
Posted 12 August 2007, 19:09
Quote
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
Posted 12 August 2007, 19:22
#16
Posted 12 August 2007, 19:44
#17
Posted 12 August 2007, 20:25
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
Posted 12 August 2007, 20:32
#19
Posted 12 August 2007, 20:46
#20
Posted 13 August 2007, 03:20
Navidjun, on Aug 12 2007, 02:27 AM, said:
What shipping modules are you using and what is the version of Google Checkout are you using?














