Zen Cart Logo
Forums / Addon Payment Modules / Trouble Integrating Google Checkout payment module in Zen Cart

Trouble Integrating Google Checkout payment module in Zen Cart

Locked

Views: 5,042

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
24 Dec 2006, 7:54 PM
#1
dave_wilson avatar

dave_wilson

New Zenner

Join Date:
Dec 2006
Posts:
20
Plugin Contributions:
0

Trouble Integrating Google Checkout payment module in Zen Cart

I have a new account with Google Checkout, but have yet to successfully integrate it with my website cart even though I was assured that it should integrate with my present PHP Cart. I have decided to convert over to the more versatile Zen Cart even though it will be a lot of work, but in downloading the Google Checkout payment module and then checking in Zen Cart's admin payment modules, it still does not list Google Checkout, but instead gives the following:

Fatal error: Class googlecheckout: Cannot inherit from undefined class base in /usr/local/4admin/apache/vhosts/nativeamericantrade.com/httpdocs/zencart/includes/modules/payment/googlecheckout.php on line 26

Here is the code that I find in that file. Please look at it an tell me why this fatal error should come up with the Google Checkout Payment Module. I need help to resolve this so I can get Google Checkout up and running.

<?php /* Copyright (C) 2006 Google Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* GOOGLE CHECKOUT * Class provided in modules dir to add googlecheckout as a payment option * Member variables refer to currently set paramter values from the database */ class googlecheckout extends base { var $code, $title, $description, $merchantid, $merchantkey, $mode, $enabled, $shipping_support, $variant; var $schema_url, $base_url, $checkout_url, $checkout_diagnose_url, $request_url, $request_diagnose_url; var $table_name = "google_checkout", $table_order = "google_orders"; // class constructor function googlecheckout() { global $order; require_once(DIR_FS_CATALOG.'includes/languages/'. $_SESSION['language'] . '/modules/payment/googlecheckout.php'); $this->code = 'googlecheckout'; $this->title = MODULE_PAYMENT_GOOGLECHECKOUT_TEXT_TITLE; $this->description = MODULE_PAYMENT_GOOGLECHECKOUT_TEXT_DESCRIPTION; $this->sort_order = MODULE_PAYMENT_GOOGLECHECKOUT_SORT_ORDER; $this->mode= MODULE_PAYMENT_GOOGLECHECKOUT_STATUS; $this->merchantid = MODULE_PAYMENT_GOOGLECHECKOUT_MERCHANTID; $this->merchantkey = MODULE_PAYMENT_GOOGLECHECKOUT_MERCHANTKEY; $this->mode = MODULE_PAYMENT_GOOGLECHECKOUT_MODE; $this->enabled = ((MODULE_PAYMENT_GOOGLECHECKOUT_STATUS == 'True') ? true : false); $this->shipping_support = array("flat", "item", "table"); $this->shipping_display = array(GOOGLECHECKOUT_FLAT_RATE_SHIPPING, GOOGLECHECKOUT_ITEM_RATE_SHIPPING, GOOGLECHECKOUT_TABLE_RATE_SHIPPING); $this->ship_flat_ui = "Standard flat-rate shipping"; $this->schema_url = "<http://checkout.google.com/schema/2>"; $this->base_url = $this->mode."cws/v2/Merchant/" . $this->merchantid; $this->checkout_url = $this->base_url . "/checkout"; $this->checkout_diagnose_url = $this->base_url . "/checkout/diagnose"; $this->request_url = $this->base_url . "/request"; $this->request_diagnose_url = $this->base_url . "/request/diagnose"; $this->variant = 'text'; if ((int)MODULE_PAYMENT_GOOGLECHECKOUT_ORDER_STATUS_ID > 0) { $this->order_status = MODULE_PAYMENT_GOOGLECHECKOUT_ORDER_STATUS_ID; } } //Function used from Google sample code to sign the cart contents with the merchant key function CalcHmacSha1($data) { $key = $this->merchantkey; $blocksize = 64; $hashfunc = 'sha1'; if (strlen($key) > $blocksize) { $key = pack('H*', $hashfunc($key)); } $key = str_pad($key, $blocksize, chr(0x00)); $ipad = str_repeat(chr(0x36), $blocksize); $opad = str_repeat(chr(0x5c), $blocksize); $hmac = pack( 'H*', $hashfunc( ($key^$opad).pack( 'H*', $hashfunc( ($key^$ipad).$data ) ) ) ); return $hmac; } //Decides the shipping name to be used // May not call this if the same name is to be used // Useful if some one wants to map to Google checkout shoppign types(flat, pickup or merchant calculate) function getShippingType($shipping_option) { switch($shipping_option) { case GOOGLECHECKOUT_FLAT_RATE_SHIPPING: return $this->ship_flat_ui."- Flat Rate"; case GOOGLECHECKOUT_ITEM_RATE_SHIPPING: return $this->ship_flat_ui."- Item Rate"; case GOOGLECHECKOUT_TABLE_RATE_SHIPPING: return $this->ship_flat_ui."- Table Rate"; default: return ""; } } // Function used to compute the actual price for shipping depending upon the shipping type // selected function getShippingPrice($ship_option, $cart, $actual_price, $handling=0, $table_mode="") { switch($ship_option) { case GOOGLECHECKOUT_FLAT_RATE_SHIPPING: { return $actual_price; } case GOOGLECHECKOUT_ITEM_RATE_SHIPPING: { return ($actual_price * $cart->count_contents()) + $handling ; } case GOOGLECHECKOUT_TABLE_RATE_SHIPPING: { //Check the mode to be used for pricing the shipping if($table_mode == "price") $table_size = $cart->show_total(); else if ($table_mode == "weight") $table_size = $cart->show_weight(); // Parse the price (value1:price1,value2:price2) $tok = strtok($actual_price, ","); $tab_data = array(); while($tok != FALSE) { $tab_data[] = $tok; $tok = strtok(","); } $initial_val=0; foreach($tab_data as $curr) { $final_val = strtok($curr, ":"); $pricing = strtok(":"); if($table_size >= $initial_val && $table_size <= $final_val) { $price = $pricing + $handling; break; } $initial_val = $final_val; } return $price; } default: return 0; } } // class methods function update_status() { } function javascript_validation() { return false; } function selection() { return array('id' => $this->code,'module' => $this->title); } function pre_confirmation_check() { return false; } function confirmation() { return false; } function process_button() { } function before_process() { return false; } function after_process() { return false; } function output_error() { return false; } function check() { global $db; if (!isset($this->_check)) { $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_GOOGLECHECKOUT_STATUS'"); $this->_check = $check_query->RecordCount(); } return $this->_check; } function install() { global $db; $language = $_SESSION['language']; require_once(DIR_FS_CATALOG.'includes/languages/'. $language . '/modules/payment/googlecheckout.php'); $shipping_list .= "array("; foreach($this->shipping_display as $ship) { $shipping_list .= "\'".$ship."\',"; } $shipping_list = substr($shipping_list,0,strlen($shipping_list)-1); $shipping_list .= ")"; $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable GoogleCheckout Module', 'MODULE_PAYMENT_GOOGLECHECKOUT_STATUS', 'True', 'Accepts payments through Google Checkout on your site', '6', '3', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Merchant ID', 'MODULE_PAYMENT_GOOGLECHECKOUT_MERCHANTID', '', 'Your merchant ID is listed on the \"Integration\" page under the \"Settings\" tab', '6', '1', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Merchant Key', 'MODULE_PAYMENT_GOOGLECHECKOUT_MERCHANTKEY', '', 'Your merchant key is also listed on the \"Integration\" page under the \"Settings\" tab', '6', '2', now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Select Mode of Operation', 'MODULE_PAYMENT_GOOGLECHECKOUT_MODE', 'https://sandbox.google.com/', 'Select either the Developer\'s Sandbox or live Production environment', '6', '3', 'zen_cfg_select_option(array(\'https://sandbox.google.com/\', \'https://checkout.google.com/\'),',now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Select shipping options.', 'MODULE_PAYMENT_GOOGLECHECKOUT_SHIPPING', '', 'Select your shipping option(s), and make sure to configure them under the Shipping Modules section', '6', '0',\"zen_cfg_select_multioption($shipping_list, \",now())"); $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_GOOGLECHECKOUT_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); $db->Execute("create table if not exists " . $this->table_name . " (customers_id int(11), buyer_id bigint(20) )"); $db->Execute("create table if not exists " . $this->table_order ." (orders_id int(11), google_order_number bigint(20), order_amount decimal(15,4) )"); } // If it is requried to delete these tables on removing the module, the two lines below // could be uncommented function remove() { global $db; $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); //$db->Execute("drop table " . $this->table_name); //$db->Execute("drop table " . $this->table_order); } function keys() { return array('MODULE_PAYMENT_GOOGLECHECKOUT_STATUS', 'MODULE_PAYMENT_GOOGLECHECKOUT_MERCHANTID', 'MODULE_PAYMENT_GOOGLECHECKOUT_MERCHANTKEY', 'MODULE_PAYMENT_GOOGLECHECKOUT_MODE','MODULE_PAYMENT_GOOGLECHECKOUT_SHIPPING','MODULE_PAYMENT_GOOGLECHECKOUT_SORT_ORDER'); } } // ** END GOOGLE CHECKOUT ** ?>
24 Dec 2006, 8:19 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Trouble Integrating Google Checkout payment module in Zen Cart

Which version of Zen Cart ae you using?
Which Google module are you using?
Did you get it from Google or here in the Zen Cart downloads section?

Have you checked the thread for this at: http://www.zen-cart.com/forum/showthread.php?p=267898

Zen-Venom Get Bitten

25 Dec 2006, 1:29 AM
#3
dave_wilson avatar

dave_wilson

New Zenner

Join Date:
Dec 2006
Posts:
20
Plugin Contributions:
0

Re: Trouble Integrating Google Checkout payment module in Zen Cart

I do believe that it is version 1.3.5. The Google Checkout payment module was downloaded from Google Checkout as I have yet to see one from Zen Cart. I looked for an applicable threat but did not see one. I will go look at the one you reference. Please understand that I am a novice although I've had my website up an running for four years. At this point I have a STRONG desire to get away from PayPal and Google Checkout seemed to be the way to go. If you have a simple way I can double check the Zen Cart version number, I'd gladly do so. Thanks so much for your help.

25 Dec 2006, 1:43 AM
#4
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,650
Plugin Contributions:
0

Re: Trouble Integrating Google Checkout payment module in Zen Cart

The Google checkout module is very much a beta version and is not fully integrated with Zen Cart. Have you considered a regular merchant account to accept Credit Cards?

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

25 Dec 2006, 1:45 AM
#5
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,650
Plugin Contributions:
0

Re: Trouble Integrating Google Checkout payment module in Zen Cart

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

25 Dec 2006, 3:14 PM
#6
dave_wilson avatar

dave_wilson

New Zenner

Join Date:
Dec 2006
Posts:
20
Plugin Contributions:
0

Re: Trouble Integrating Google Checkout payment module in Zen Cart

Its good to know at least that I am dealing with a Beta version. It may explain a lot. I appreciate the links.

25 Dec 2006, 6:52 PM
#7
woodymon avatar

woodymon

Totally Zenned

Join Date:
Sep 2004
Posts:
2,309
Plugin Contributions:
1

Re: Trouble Integrating Google Checkout payment module in Zen Cart

Dave Wilson:

Its good to know at least that I am dealing with a Beta version. It may explain a lot. I appreciate the links.
Hi Dave-

  1. As Kim stated the GC for ZC mod is in BETA and will likely be that way for some time.

  2. The latest version (v. 1.05) is NOT available in the ZC downloads area. (1.04 is available there). Some folks have had some issues with v.1.05 and I believe the mod developers then decided not to upload (can't say for sure as they have not communicated on that subject).

  3. Full discussion and more info is on mod support thread at link Kobra posted above. May want to review the last few pages first. Also in that same thread see post by ropu reporting where you can download latest mod from Google site (if you are into beta testing... but you will have to "package" up first... mor info in support thread).

  4. ropu also recently reported that devs are working hard to upgrade the mod so development continues.

  5. But it appears that Google Checkout will not be supporting a number of core Zen Cart features. So as Kim suggested a regular merchant account might be preferred in many instances, even if Google is not charging transaction fees for the next year.

Woody