Google Groups Home
Help | Sign in
Recent pages and files
Installation v1.4-alpha1    

How to Install Google Checkout Mod for Zen Cart (v1.4-alpha1)

Last updated: 8/07/2007

NOTE: This "installation" document is for v1.4-alpha1 ONLY!  Misc install differences apply to more recent versions. See the Installation document in the mod distribution.

An updated readme document will be available for latest v.1.4 soon (link coming soon).

Download latest versions:

Latest release Zip available here:
http://code.google.com/p/google-checkout-zencart/downloads/list

and here:

http://www.zen-cart.com/index.php?main_page=product_contrib_info&&products_id=314


Latest SVN trunk is here:
http://google-checkout-zencart.googlecode.com/svn/trunk/

 

SVN users: Look in SVN branch for most recent minor revision

 

How to Install Google Checkout Mod for Zen Cart (v1.4-alpha1)

If you haven't read the README file yet, please read it first.
 
NOTE for Upgraders upgrading from v.1.3-RC2:

1. Since this new version is very different, its recommended to remove all v1.3* directories 

    and files and re-install mod from scratch the new v1.4 (backup info from payment 

    mod configuration and logs first).

2. If you decide to "Upgrade" see the UPGRADE document in the latest distribution.

3. IMPORTANT if Upgrading: Uninstall and re-install the module. Otherwise new mod features and changes 

  will not be enabled.


INSTALLING THE MODULE (Fresh/new install)
There are two installation options you need to choose from, so please read carefully to determine which option is right for you.
 
OPTION A:
=========
If you have the basic Zen Cart installation without any other modules or
add-on's, simply copy the provided files into your Zen Cart system,
preserving the file structure.
For your reference, here is the list of files you need to copy over to your system:
  YOUR_ZENCART_FOLDER/:
      CHANGELOG
      INSTALLATION
      README
     
  YOUR_ZENCART_FOLDER/admin:
      htaccess.php
      orders.php
     
  YOUR_ZENCART_FOLDER/admin/includes/functions/extra_functions:
      added_function_for_google_checkout.php
     
  YOUR_ZENCART_FOLDER/googlecheckout:
      gcheckout.php
      responsehandler.php
     
  YOUR_ZENCART_FOLDER/googlecheckout/library:
      googlecart.php
      googleitem.php
      googlelog.php
      googlemerchantcalculations.php
      googlerequest.php
      googleresponse.php
      googleresult.php
      googleshipping.php
      googletax.php
     
  YOUR_ZENCART_FOLDER/googlecheckout/library/xml-processing:
      xmlbuilder.php
      xmlparser.php
     
  YOUR_ZENCART_FOLDER/googlecheckout/logs:
      response_error.log
      response_message.log
     
NOTE: v1.4-alpha1 and alpha-2 did not include the two empty log files. You will need to create two empty text files with the names above, and upload to /googlecheckout/logs/. Be sure to chmod 777 the two files after uploading.

  YOUR_ZENCART_FOLDER/googlecheckout/shipping_generator:
      index.php
      multigenerator.php
      multishipping_generator.js
      multishipping_generator.php
      README
      shipping_method_generator.php
     
  YOUR_ZENCART_FOLDER/googlecheckout/shipping_metrics:
      readme
      ship_metrics
      shipping_metrics_commandline.php
      shipping_metrics.log
     
     
  YOUR_ZENCART_FOLDER/includes/languages/english:
      GC_return.php
     
  YOUR_ZENCART_FOLDER/includes/languages/english/modules/payment:
      googlecheckout.php
     
  YOUR_ZENCART_FOLDER/includes/modules:
      show_google_components.php
     
  YOUR_ZENCART_FOLDER/includes/modules/pages/GC_return:
      header_php.php
      jscript_main.php
      jscript_textarea_counter.js
      main_template_vars.php
      main_template_vars_product_type.php
     
  YOUR_ZENCART_FOLDER/includes/modules/payment:
      googlecheckout.php
     
  YOUR_ZENCART_FOLDER/includes/templates/YOUR_TEMPLATE/templates:
      tpl_checkout_payment_default.php
      tpl_gc_return_display.php
      tpl_gc_return_noproduct.php
      tpl_login_default.php
      tpl_shopping_cart_default.php
      tpl_time_out_default.php
* Note: The folder YOUR_TEMPLATE refers to the folder that contains your templates.
 The folder YOUR_TEMPLATE in the package refers to the folder that contains
 your templates, you must put the files in /includes/templates/YOUR_TEMPLATE/
 in your own templates dir there you should see the GC buy button.
 
OPTION B:
=========
If you have other modules installed on your Zen Cart installation, replacing
 your existing files might break your existing installation. In this case, you
 need to edit the existing files manually.
 For this option, follow the instructions below:
 I. Copy the following new files into your existing system, preserving the file structure:
 -----------------------------------------------------------------------------------------
  YOUR_ZENCART_FOLDER/:
      CHANGELOG
      INSTALLATION
      README
     
  YOUR_ZENCART_FOLDER/admin:
      htaccess.php
     
  YOUR_ZENCART_FOLDER/admin/includes/functions/extra_functions:
      added_function_for_google_checkout.php
     
  YOUR_ZENCART_FOLDER/googlecheckout:
      gcheckout.php
      responsehandler.php
     
  YOUR_ZENCART_FOLDER/googlecheckout/library:
      googlecart.php
      googleitem.php
      googlelog.php
      googlemerchantcalculations.php
      googlerequest.php
      googleresponse.php
      googleresult.php
      googleshipping.php
      googletax.php
     
  YOUR_ZENCART_FOLDER/googlecheckout/library/xml-processing:
      xmlbuilder.php
      xmlparser.php
     
  YOUR_ZENCART_FOLDER/googlecheckout/logs:
      response_error.log
      response_message.log
     
  YOUR_ZENCART_FOLDER/googlecheckout/shipping_generator:
      index.php
      multigenerator.php
      multishipping_generator.js
      multishipping_generator.php
      README
      shipping_method_generator.php
     
  YOUR_ZENCART_FOLDER/googlecheckout/shipping_metrics:
      readme
      ship_metrics
      shipping_metrics_commandline.php
      shipping_metrics.log
     
  YOUR_ZENCART_FOLDER/includes/languages/english:
      GC_return.php
     
  YOUR_ZENCART_FOLDER/includes/languages/english/modules/payment:
      googlecheckout.php
     
  YOUR_ZENCART_FOLDER/includes/modules:
      show_google_components.php
     
  YOUR_ZENCART_FOLDER/includes/modules/pages/GC_return:
      header_php.php
      jscript_main.php
      jscript_textarea_counter.js
      main_template_vars.php
      main_template_vars_product_type.php
     
  YOUR_ZENCART_FOLDER/includes/modules/payment:
      googlecheckout.php
     
  YOUR_ZENCART_FOLDER/includes/templates/YOUR_TEMPLATE/templates:
      tpl_gc_return_display.php
      tpl_gc_return_noproduct.php
 II. Manually edit the following files from your system as instructed below:
  YOUR_ZENCART_FOLDER/admin:
      orders.php
     
  YOUR_ZENCART_FOLDER/includes/templates/YOUR_TEMPLATE/templates:
      tpl_checkout_payment_default.php
      tpl_login_default.php
      tpl_shopping_cart_default.php
      tpl_time_out_default.php
* The LINE number indicates where the change would need to be made if the file 
 was unchanged by other modules.
----------------------------------------------------------------------------
1. YOUR_ZENCART_FOLDER/admin/orders.php                             LINE 90
============================================================================
REPLACE:
        if ( ($check_status->fields['orders_status'] != $status) || zen_not_null($comments)) {
          $db->Execute("update " . TABLE_ORDERS . "
                        set orders_status = '" . zen_db_input($status) . "', last_modified = now()
                        where orders_id = '" . (int)$oID . "'");
          $customer_notified = '0';
          if (isset($_POST['notify']) && ($_POST['notify'] == 'on')) {
            $notify_comments = '';
            if (isset($_POST['notify_comments']) && ($_POST['notify_comments'] == 'on') && zen_not_null($comments)) {
              $notify_comments = EMAIL_TEXT_COMMENTS_UPDATE . $comments . "\n\n";
            }

//send emails
      $message = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" .
      EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n\n" .
      EMAIL_TEXT_INVOICE_URL . ' ' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n\n" .
      EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']) . "\n\n" .
      strip_tags($notify_comments) .
      EMAIL_TEXT_STATUS_UPDATED . sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ) .
      EMAIL_TEXT_STATUS_PLEASE_REPLY;
      $html_msg['EMAIL_CUSTOMERS_NAME']    = $check_status->fields['customers_name'];
      $html_msg['EMAIL_TEXT_ORDER_NUMBER'] = EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID;
      $html_msg['EMAIL_TEXT_INVOICE_URL']  = '<a href="' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') .'">'.str_replace(':','',EMAIL_TEXT_INVOICE_URL).'</a>';
      $html_msg['EMAIL_TEXT_DATE_ORDERED'] = EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']);
      $html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = nl2br($notify_comments);
      $html_msg['EMAIL_TEXT_STATUS_UPDATED'] = str_replace('\n','', EMAIL_TEXT_STATUS_UPDATED);
      $html_msg['EMAIL_TEXT_STATUS_LABEL'] = str_replace('\n','', sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ));
      $html_msg['EMAIL_TEXT_NEW_STATUS'] = $orders_status_array[$status];
      $html_msg['EMAIL_TEXT_STATUS_PLEASE_REPLY'] = str_replace('\n','', EMAIL_TEXT_STATUS_PLEASE_REPLY);
            zen_mail($check_status->fields['customers_name'], $check_status->fields['customers_email_address'], EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status');
            $customer_notified = '1';
//send extra emails
            if (SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_STATUS == '1' and SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO != '') {
              zen_mail('', SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO, SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status_extra');
            }
          }
          $db->Execute("insert into " . TABLE_ORDERS_STATUS_HISTORY . "
                      (orders_id, orders_status_id, date_added, customer_notified, comments)
                      values ('" . (int)$oID . "',
                      '" . zen_db_input($status) . "',
                      now(),
                      '" . zen_db_input($customer_notified) . "',
                      '" . zen_db_input($comments)  . "')");
          $order_updated = true;
        }
WITH:
        if ( ($check_status->fields['orders_status'] != $status) || zen_not_null($comments)) {
          $db->Execute("update " . TABLE_ORDERS . "
                        set orders_status = '" . zen_db_input($status) . "', last_modified = now()
                        where orders_id = '" . (int)$oID . "'");
// ** GOOGLE CHECKOUT **
          chdir("./..");
          require_once(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/payment/googlecheckout.php');
          $payment_value= MODULE_PAYMENT_GOOGLECHECKOUT_TEXT_TITLE;
          $result = $db->Execute("select google_order_number from google_orders where orders_id= ". (int)$oID);
          $num_rows = $result->RecordCount();
          if($num_rows != 0) {
            $customer_notified = google_checkout_state_change($check_status, $status, $oID,
                               (@$_POST['notify']=='on'?1:0),
                               (@$_POST['notify_comments']=='on'?$comments:''));
          }
          $customer_notified = isset($customer_notified)?$customer_notified:'0';
// ** END GOOGLE CHECKOUT **
          if (isset($_POST['notify']) && ($_POST['notify'] == 'on')) {
            $notify_comments = '';
            if (isset($_POST['notify_comments']) && ($_POST['notify_comments'] == 'on') && zen_not_null($comments)) {
              $notify_comments = EMAIL_TEXT_COMMENTS_UPDATE . $comments . "\n\n";
            }
// ** GOOGLE CHECKOUT **
            $force_email = false;
            if($num_rows != 0 && (strlen(htmlentities(strip_tags($notify_comments))) > GOOGLE_MESSAGE_LENGTH && MODULE_PAYMENT_GOOGLECHECKOUT_USE_CART_MESSAGING == 'True')) {
              $force_email = true;
              $messageStack->add_session(GOOGLECHECKOUT_WARNING_SYSTEM_EMAIL_SENT, 'warning');         
            }
        if($num_rows == 0 || $force_email) {
// ** END GOOGLE CHECKOUT **
  //send emails, not a google order or configured to use both messaging systems
          $message = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" .
          EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n\n" .
          EMAIL_TEXT_INVOICE_URL . ' ' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n\n" .
          EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']) . "\n\n" .
          strip_tags($notify_comments) .
          EMAIL_TEXT_STATUS_UPDATED . sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ) .
          EMAIL_TEXT_STATUS_PLEASE_REPLY;
    
          $html_msg['EMAIL_CUSTOMERS_NAME']    = $check_status->fields['customers_name'];
          $html_msg['EMAIL_TEXT_ORDER_NUMBER'] = EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID;
          $html_msg['EMAIL_TEXT_INVOICE_URL']  = '<a href="' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') .'">'.str_replace(':','',EMAIL_TEXT_INVOICE_URL).'</a>';
          $html_msg['EMAIL_TEXT_DATE_ORDERED'] = EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']);
          $html_msg['EMAIL_TEXT_STATUS_COMMENTS'] = nl2br($notify_comments);
          $html_msg['EMAIL_TEXT_STATUS_UPDATED'] = str_replace('\n','', EMAIL_TEXT_STATUS_UPDATED);
          $html_msg['EMAIL_TEXT_STATUS_LABEL'] = str_replace('\n','', sprintf(EMAIL_TEXT_STATUS_LABEL, $orders_status_array[$status] ));
          $html_msg['EMAIL_TEXT_NEW_STATUS'] = $orders_status_array[$status];
          $html_msg['EMAIL_TEXT_STATUS_PLEASE_REPLY'] = str_replace('\n','', EMAIL_TEXT_STATUS_PLEASE_REPLY);
 
             zen_mail($check_status->fields['customers_name'], $check_status->fields['customers_email_address'], EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status');
 
             $customer_notified = '1';
 //send extra emails
             if (SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_STATUS == '1' and SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO != '') {
               zen_mail('', SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO, SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status_extra');
             }
// ** GOOGLE CHECKOUT **
           }
// ** END GOOGLE CHECKOUT **
        }
          $db->Execute("insert into " . TABLE_ORDERS_STATUS_HISTORY . "
                      (orders_id, orders_status_id, date_added, customer_notified, comments)
                      values ('" . (int)$oID . "',
                      '" . zen_db_input($status) . "',
                      now(),
                      '" . zen_db_input($customer_notified) . "',
                      '" . zen_db_input($comments)  . "')");
          $order_updated = true;
        }
----------------------------------------------------------------------------
1. YOUR_ZENCART_FOLDER/admin/orders.php                             LINE 570
============================================================================
REPLACE:
 <td valign="top"><?php echo zen_image_submit('button_update.gif', IMAGE_UPDATE); ?></td>
          </tr>
        </table></td>
WITH:
           <td valign="top"><?php echo zen_image_submit('button_update.gif', IMAGE_UPDATE); ?></td>
            <!-- googlecheckout Tracking Number -->
<?php
// orders_status == STATE_PROCESSING -> Processing before delivery
 if($order->info['payment_method'] == 'Google Checkout' && $order->info['orders_status'] == STATE_PROCESSING){
   echo '<td><table border="0" cellpadding="3" cellspacing="0" width="100%">  
    <tbody>
     <tr> 
      <td style="border-top: 2px solid rgb(255, 255, 255); border-right: 2px solid rgb(255, 255, 255);" nowrap="nowrap" colspan="2">
        <b>Shipping Information</b> 
      </td> 
     </tr>
     <tr> 
      <td nowrap="nowrap" valign="middle" width="1%"> 
       <font size="2"> 
        <b>Tracking:</b> 
       </font> 
      </td> 
      <td style="border-right: 2px solid rgb(255, 255, 255); border-bottom: 2px solid rgb(255, 255, 255);" nowrap="nowrap">  
       <input name="tracking_number" style="color: rgb(0, 0, 0);" id="trackingBox" size="20" type="text">  
      </td> 
     </tr> 
     <tr> 
      <td nowrap="nowrap" valign="middle" width="1%"> 
       <font size="2"> 
        <b>Carrier:</b> 
       </font> 
      </td> 
      <td style="border-right: 2px solid rgb(255, 255, 255);" nowrap="nowrap"> 
       <select name="carrier_select" style="color: rgb(0, 0, 0);" id="carrierSelect"> 
        <option value="select" selected="selected">
         Select ... 
        </option>  
        <option value="USPS">
         USPS 
        </option>  
        <option value="DHL">
         DHL 
        </option>  
        <option value="UPS">
         UPS 
        </option>  
        <option value="Other">
         Other 
        </option>  
        <option value="FedEx">
         FedEx 
        </option>  
       </select> 
      </td> 
     </tr>    
    </tbody>
   </table></td>';
  
 }
?>
<!-- end googlecheckout Tracking Number -->
          </tr>
        </table></td>
-------------------------------------------------------------------------------------------------------------------
2. YOUR_ZENCART_FOLDER/includes/templates/YOUR_TEMPLATE/templates/tpl_checkout_payment_default.php    LINE 117
===================================================================================================================
REPLACE:
<?php
  $selection = $payment_modules->selection();
  if (sizeof($selection) > 1) {
WITH:
<?php
  foreach($payment_modules->modules as $pm_code => $pm) {
    if(substr($pm, 0, strrpos($pm, '.')) == 'googlecheckout') {
      unset($payment_modules->modules[$pm_code]);
    }
  }
  $selection = $payment_modules->selection();
  if (sizeof($selection) > 1) {
 
-------------------------------------------------------------------------------------------------------------------
2. YOUR_ZENCART_FOLDER/includes/templates/YOUR_TEMPLATE/templates/tpl_login_default.php    LINE  56
===================================================================================================================
REPLACE:
<br class="clearBoth" />
<!--EOF PPEC split login- DO NOT REMOVE-->
WITH:
<br class="clearBoth" />
 <?php
  // ** GOOGLE CHECKOUT **
    include(DIR_WS_MODULES . 'show_google_components.php'); 
  // ** END GOOGLE CHECKOUT **
 ?>
<!--EOF PPEC split login- DO NOT REMOVE-->
-------------------------------------------------------------------------------------------------------------------
2. YOUR_ZENCART_FOLDER/includes/templates/YOUR_TEMPLATE/templates/tpl_login_default.php    LINE  82
===================================================================================================================
REPLACE:
</form>
<br class="clearBoth" />
WITH:
</form>
<br class="clearBoth" />
 <?php
  // ** GOOGLE CHECKOUT **
    include(DIR_WS_MODULES . 'show_google_components.php'); 
  // ** END GOOGLE CHECKOUT **
 ?>
 
----------------------------------------------------------------------------------------------------------------------------
3. YOUR_ZENCART_FOLDER/includes/templates/YOUR_TEMPLATE/templates/tpl_shopping_cart_default.php    LINE 223
============================================================================================================================
REPLACE:
<?php
  }
?>
<!-- ** BEGIN PAYPAL EXPRESS CHECKOUT ** -->
WITH:
<?php
  }
?>
<!-- * BEGIN GOOGLE CHECKOUT * -->
 <?php
  // ** GOOGLE CHECKOUT **
    include(DIR_WS_MODULES . 'show_google_components.php'); 
  // ** END GOOGLE CHECKOUT **
 ?>
<!-- * END GOOGLE CHECKOUT * -->
<!-- ** BEGIN PAYPAL EXPRESS CHECKOUT ** -->
----------------------------------------------------------------------------------------------------------------------------
3. YOUR_ZENCART_FOLDER/includes/templates/YOUR_TEMPLATE/templates/tpl_time_out_default.php.php    LINE 41
============================================================================================================================
REPLACE:
</div>
<?php
 }
 ?>
WITH:
</div>
<?php
  // ** GOOGLE CHECKOUT **
    include(DIR_WS_MODULES . 'show_google_components.php'); 
  // ** END GOOGLE CHECKOUT **
 ?>
<?php
 }
 ?>
 

Version: 
Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google