google-code-export / google-checkout-oscommerce

Automatically exported from code.google.com/p/google-checkout-oscommerce
1 stars 0 forks source link

Syntax error in 'includes/modules/payment/googlecheckout.php' initial insert query. #83

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Follow the installation steps for a modified install and during the
initial reading of the module into the database the db insert query will
fail due to a couple of things:

- 1.  The table title is too long for the default field settings.  People 
 will need to increase this to be able to handle the length of that string.

- 2.  The mysql function 'now()' being wrapped in single quotes will cause
a syntax error.  I fixed it by changing this in
'includes/modules/payment/googlecheckout.php':

    $value_array = array($title, $key, $default_value, $description,    
$group_id, $sort_order, 'now()');
    if (!is_null($set_function)) {
      $value_array[] = $set_function;
    }
    $value_list = "('" . join("', '", $value_array) . "')";

to this:

    $value_array = array($title, $key, $default_value, $description,
$group_id, $sort_order, 'now()');
    if (!is_null($set_function)) {
      $value_array[] = $set_function;
    }
    $values_fixed = "'" . join("', '", $value_array) . "'";
    $values_fixed = str_replace("'now()'", 'now()', $values_fixed);
    $value_list = "(" . $values_fixed . ")";

I'm sure there are other ways, but it works.

After fixing this issue I ran into another trying to install the module,
'Fatal error: Cannot redeclare class googlecheckout...'

The only way I found this was to temporarily comment out the redirect after
the install step to see what was going on since the redirect after the
install hides it.  It was failing because of multiple configuration keys
added to the configuration table with the same name during my fixing of the
above issues, therefore trying to load the same module multiple times.

Not normally the first place you look for what initially appears to be an
include problem...

Original issue reported on code.google.com by themetho...@gmail.com on 3 Jul 2009 at 4:05