HOW TO INSTALL GOOGLE CHECKOUT MODULE FOR ZEN-CART (v1.4.7RC1) If you haven't read the README file yet, please read it first. UPGRADE ======= Check UPGRADE file. IMPORTANT: Uninstall and re install the module. If not, many new configuration will not be enabled. -------------------------------------------------------------------------------- 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 shipping_methods.php shipping_methods_uk.php shipping_methods_ccs.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: gc_xmlbuilder.php gc_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 downloads.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 * 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 shipping_methods.php shipping_methods_uk.php shipping_methods_ccs.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: gc_xmlbuilder.php gc_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/modules/: downloads.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.a YOUR_ZENCART_FOLDER/admin/orders.php LINE 592 ============================================================================ REPLACE: WITH: Processing before delivery if($order->info['payment_module_code'] == 'googlecheckout' && $order->info['orders_status'] == GC_STATE_PROCESSING){ echo '
Shipping Information
Tracking:
Carrier:
'; } ?> ---------------------------------------------------------------------------- 1.b YOUR_ZENCART_FOLDER/admin/orders.php LINE 94 ============================================================================ 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 . "'"); $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'] = ''.str_replace(':','',EMAIL_TEXT_INVOICE_URL).''; $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); $customer_notified = '0'; if (isset($_POST['notify']) && ($_POST['notify'] == 'on')) { 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'); } $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'] = ''.str_replace(':','',EMAIL_TEXT_INVOICE_URL).''; $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); if($num_rows == 0 || $force_email) { //send emails, not a google order or configured to use both messaging systems 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'); $messageStack->add_session(GOOGLECHECKOUT_SUCCESS_SEND_ADMIN_COPY_EMAIL, 'success'); } // ** 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; } ---------------------------------------------------------------- 2. YOUR_ZENCART_FOLDER/includes/modules/downloads.php LINE 24 ================================================================ REPLACE: $last_order = $_GET['order_id']; } // Now get all downloadable products in that order $downloads_query = "select date_format(o.date_purchased, '%Y-%m-%d') as date_purchased_day, opd.download_maxdays, op.products_name, opd.orders_products_download_id, opd.orders_products_filename, opd.download_count, opd.download_maxdays from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd where o.customers_id = '" . (int)$_SESSION['customer_id'] . "' and (o.orders_status >= '" . DOWNLOADS_CONTROLLER_ORDERS_STATUS . "' and o.orders_status <= '" . DOWNLOADS_CONTROLLER_ORDERS_STATUS_END . "') and o.orders_id = '" . (int)$last_order . "' and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_filename != ''"; $downloads = $db->Execute($downloads_query); WITH: $last_order = $_GET['order_id']; } // Support for Google Checkout new Order states to enable downloads define('GC_STATE_PROCESSING', 101); define('GC_STATE_SHIPPED_REFUNDED', 109); // Now get all downloadable products in that order $downloads_query = "select date_format(o.date_purchased, '%Y-%m-%d') as date_purchased_day, opd.download_maxdays, op.products_name, opd.orders_products_download_id, opd.orders_products_filename, opd.download_count, opd.download_maxdays from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd where o.customers_id = '" . (int)$_SESSION['customer_id'] . "' and ((o.orders_status >= '" . DOWNLOADS_CONTROLLER_ORDERS_STATUS . "' and o.orders_status <= '" . DOWNLOADS_CONTROLLER_ORDERS_STATUS_END . "') or (o.orders_status >= '" . GC_STATE_PROCESSING . "' and o.orders_status <= '" . GC_STATE_SHIPPED_REFUNDED . "')) and o.orders_id = '" . (int)$last_order . "' and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_filename != ''"; // end - Support for Google Checkout new Order states to enable downloads $downloads = $db->Execute($downloads_query); -------------------------------------------------------------------------------------------------------------- 3. YOUR_ZENCART_FOLDER/includes/templates/YOUR_TEMPLATE/templates/tpl_checkout_payment_default.php LINE 117 ============================================================================================================== REPLACE: selection(); if (sizeof($selection) > 1) { WITH: 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) { --------------------------------------------------------------------------------------------------- 4. YOUR_ZENCART_FOLDER/includes/templates/YOUR_TEMPLATE/templates/tpl_login_default.php LINE 84 =================================================================================================== REPLACE:
WITH:
--------------------------------------------------------------------------------------------------- 5. YOUR_ZENCART_FOLDER/includes/templates/YOUR_TEMPLATE/templates/tpl_login_default.php LINE 55 =================================================================================================== REPLACE:
WITH:
----------------------------------------------------------------------------------------------------------- 6. YOUR_ZENCART_FOLDER/includes/templates/YOUR_TEMPLATE/templates/tpl_shopping_cart_default.php LINE 156 =========================================================================================================== REPLACE: WITH: --------------------------------------------------------------------------------------------------------- 7. YOUR_ZENCART_FOLDER/includes/templates/YOUR_TEMPLATE/templates/tpl_time_out_default.php.php LINE 41 ========================================================================================================= REPLACE:
WITH: