Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Offical Google Checkout module for osCommerce Support Thread


Silverado05

Recommended Posts

Another problem I ran into with this install is with the instructions for "shopping_cart.php"

 

I double checked all my contributions to see if they changed the code but none of them did so I do not know why the code is different. Once again I am using osC RC2a.

 

The instructions saying replace

<td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
<?php
  } else {
?>

With

<td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></form></td>
  </tr>
<tr>
  <td>
<?php
// ** GOOGLE CHECKOUT **
// Checks if the Google Checkout payment module has been enabled and if so 
// includes gcheckout.php to add the Checkout button to the page 
if (defined('MODULE_PAYMENT_GOOGLECHECKOUT_STATUS') && MODULE_PAYMENT_GOOGLECHECKOUT_STATUS == 'True') {
  include_once('googlecheckout/gcheckout.php');
} 
// ** END GOOGLE CHECKOUT **
?>
	</td>
  </tr>
<?php
  } else {
?>

but my code is this

<td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
<?php
$initialize_checkout_methods = $payment_modules->checkout_initialization_method();

if (!empty($initialize_checkout_methods)) {
?>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td align="right" class="main" style="padding-right: 50px;"><?php echo TEXT_ALTERNATIVE_CHECKOUT_METHODS; ?></td>
  </tr>
<?php
  reset($initialize_checkout_methods);
  while (list(, $value) = each($initialize_checkout_methods)) {
?>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td align="right" class="main"><?php echo $value; ?></td>
  </tr>
<?php
  }
}
 } else {
?>

 

Can someone please help me solve this.

Powered By osC 2.2RC2a STS 4.5.8 - HTC 2.6.3 - FP 1.5.9 - BCH 1.0.0

Link to comment
Share on other sites

  • Replies 1.2k
  • Created
  • Last Reply

Top Posters In This Topic

Hi. I've got oscCommerce 2.2 that i installed w/ Fantastico. It has other built in payment portals, but i have my business account with Google because they charge the less. Lol. So, I tried installation method A and B, and i still dont see google checkout as an option in osCommerce. Any ideas? I'd really appreciate it.

 

 

Trent

Link to comment
Share on other sites

In order to contain all the support to one thread so I can accurately help those needing help with this module please post your support questions here and I will be more then happy to help you with this to best of my ability.

 

Contribution can be found below.

 

Google Checkout module for osCommerce

 

Current release is version 1.4 Dated 17 Jul 2007

I installed Google Checkout and when I go to the /googlecheckout/responsehandler.php I get a 500 error, page not found. In the admin I installed Google Checkout and when I tried to edit it I get the following error:

 

Fatal error: Call to undefined function: gc_cfg_select_shipping() in /home/penguin/public_html/admin/modules.php(235) : eval()'d code on line 1

 

I was advised to set in Google Checkout the shipping options so I edited the shipping_methods.php with the code generated from the shipping_method_generator.php but I still got the same error.

 

Can anyone help me get this straightened out?

 

Thanks,

 

Dan

Link to comment
Share on other sites

You appear to be missing this code in admin/includes/functions/general:

line 941 // perhaps this function must be moved to googlecheckout class, is not too general

function gc_cfg_select_shipping($select_array, $key_value, $key = '') {

 

 

I installed Google Checkout and when I go to the /googlecheckout/responsehandler.php I get a 500 error, page not found. In the admin I installed Google Checkout and when I tried to edit it I get the following error:

 

Fatal error: Call to undefined function: gc_cfg_select_shipping() in /home/penguin/public_html/admin/modules.php(235) : eval()'d code on line 1

 

I was advised to set in Google Checkout the shipping options so I edited the shipping_methods.php with the code generated from the shipping_method_generator.php but I still got the same error.

 

Can anyone help me get this straightened out?

 

Thanks,

 

Dan

Link to comment
Share on other sites

Verify that you have included googlecheckout.php in includes/modules/payment

 

Hi. I've got oscCommerce 2.2 that i installed w/ Fantastico. It has other built in payment portals, but i have my business account with Google because they charge the less. Lol. So, I tried installation method A and B, and i still dont see google checkout as an option in osCommerce. Any ideas? I'd really appreciate it.

 

 

Trent

Link to comment
Share on other sites

You have to set up an .htaccess file on your server. The easy way to this is to do it is from your server control panel. It should say Password Protect Directories or something like that. Go to Googlecheckout and put in 2 users and 2 passwords. Your usernames will be the Production Merchant ID and Sandbox Merchant ID. Your passwords will be your Production Merchant Key and Sandbox Merchant Key.

 

 

 

 

 

Hi,

 

 

I am not able to implement the google checkout callback. The error shown is

 

We encountered an error trying to access your server at http://212.241.216.213/staging1/googlechec...onsehandler.php -- the error we got is: Send failed with code: 401. Response body was: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <HTML> <HEAD> <TITLE>401 Authorization Required</TITLE> </HEAD> <BODY> <H1>Authorization Required</H1> <P>This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.</p> <HR /> <ADDRESS> Web Server at grehom.co.uk </ADDRESS> </BODY> </HTML> <!-- - Unfortunately, Microsoft has added a clever new - "feature" to Internet Explorer. If the text of - an error's message is "too small", specifically - less than 512 bytes, Internet Explorer returns - its own error message. You can turn that off, - but it's pretty tricky to find switch called - "smart error messages". That means, of course, - that short error messages are censored by default. - IIS always returns error messages that are long - enough to make Internet Explorer happy. The - workaround is pretty simple: pad the error - message with a big comment like this to push it - over the five hundred and twelve bytes minimum. - Of course, that's exactly what you're reading - right now. -->

 

Can somebody please guide me how to implement the callback for googlecheckout.

 

Will I be able to reduce the product quantity as well after the successfull order when the callback is implemented?

 

Please help.

 

Thanks and Regards,

Satwinder

Edited by speed777
Link to comment
Share on other sites

I am seeing this error again: Read timed out Your server must respond faster to merchant calculation callback requests

 

I have this in my logs: Thu Aug 7 11:24:50 EDT 2008:- name lookup timed out

 

I am assuming it comes from this in the response handler:

 

//	GC email is the most important one
  if ($customer_exists['customers_id'] != '') {
	$customer_id = $customer_exists['customers_id'];
	tep_session_register('customer_id');
  }
  else if($customer_info['customers_id'] != ''){
	$customer_id = $customer_info['customers_id'];
	tep_session_register('customer_id');
  }
  else {
	list ($firstname, $lastname) = 
		explode(' ', gc_makeSqlString($gc_data[$root]['buyer-billing-address']['contact-name']['VALUE']), 2);
	$sql_data_array = array (
	  'customers_firstname' => $firstname,
	  'customers_lastname' => $lastname,
	  'customers_email_address' => $gc_data[$root]['buyer-billing-address']['email']['VALUE'],
	  'customers_telephone' => $gc_data[$root]['buyer-billing-address']['phone']['VALUE'],
	  'customers_fax' => $gc_data[$root]['buyer-billing-address']['fax']['VALUE'],
	  'customers_default_address_id' => 0,
	  'customers_password' => tep_encrypt_password(gc_makeSqlString($gc_data[$root]['buyer-id']['VALUE'])),
	  'customers_newsletter' => $gc_data[$root]['buyer-marketing-preferences']['email-allowed']['VALUE']=='true'?1:0
	);
	if (ACCOUNT_DOB == 'true') {
	  $sql_data_array['customers_dob'] = 'now()';
	}
	tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);
	$customer_id = tep_db_insert_id();
	tep_session_register('customer_id');
	tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . "
								  (customers_info_id, customers_info_number_of_logons,
								   customers_info_date_account_created)
							 values ('" . (int) $customer_id . "', '0', now())");
	tep_db_query("insert into " . $googlepayment->table_name . " " .
				  " values ( " . $customer_id . ", " .
				  $gc_data[$root]['buyer-id']['VALUE'] . ")");
	$new_user = true;
  }
  //	  The user exists and is logged in
  //	  Check database to see if the address exist.
  $address_book = tep_db_query("select address_book_id, entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . "
				  where  customers_id = '" . $customer_id . "'
					and entry_street_address = '" . gc_makeSqlString($gc_data[$root]['buyer-shipping-address']['address1']['VALUE']) . "'
					  and entry_suburb = '" . gc_makeSqlString($gc_data[$root]['buyer-shipping-address']['address2']['VALUE']) . "'
					  and entry_postcode = '" . gc_makeSqlString($gc_data[$root]['buyer-shipping-address']['postal-code']['VALUE']) . "'
					  and entry_city = '" . gc_makeSqlString($gc_data[$root]['buyer-shipping-address']['city']['VALUE']) . "'
					");
  //	  If not, add the addr as default one
  if (!tep_db_num_rows($address_book)) {
	$buyer_state = $gc_data[$root]['buyer-shipping-address']['region']['VALUE'];
	$zone_answer = tep_db_fetch_array(tep_db_query("select zone_id, zone_country_id from " .
	TABLE_ZONES . " where zone_code = '" . $buyer_state . "'"));
	list ($firstname, $lastname) = 
		explode(' ', gc_makeSqlString($gc_data[$root]['buyer-shipping-address']['contact-name']['VALUE']), 2);
	$sql_data_array = array (
	  'customers_id' => $customer_id,
	  'entry_gender' => '',
	  'entry_company' => $gc_data[$root]['buyer-shipping-address']['company-name']['VALUE'],
	  'entry_firstname' => $firstname,
	  'entry_lastname' => $lastname,
	  'entry_street_address' => $gc_data[$root]['buyer-shipping-address']['address1']['VALUE'],
	  'entry_suburb' => $gc_data[$root]['buyer-shipping-address']['address2']['VALUE'],
	  'entry_postcode' => $gc_data[$root]['buyer-shipping-address']['postal-code']['VALUE'],
	  'entry_city' => $gc_data[$root]['buyer-shipping-address']['city']['VALUE'],
	  'entry_state' => $buyer_state,
	  'entry_country_id' => $zone_answer['zone_country_id'],
	  'entry_zone_id' => $zone_answer['zone_id']
	);
	tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);

	$address_id = tep_db_insert_id();
	tep_db_query("update " . TABLE_CUSTOMERS . "
							  set customers_default_address_id = '" . (int) $address_id . "'
							  where customers_id = '" . (int) $customer_id . "'");
	$customer_default_address_id = $address_id;
	$customer_country_id = $zone_answer['zone_country_id'];
	$customer_zone_id = $zone_answer['zone_id'];
  } else {
	$customer_default_address_id = $address_book['address_book_id'];
	$customer_country_id = $address_book['entry_country_id'];
	$customer_zone_id = $address_book['entry_zone_id'];
  }
  $customer_first_name = $gc_data[$root]['buyer-billing-address']['contact-name']['VALUE'];
  tep_session_register('customer_default_address_id');
  tep_session_register('customer_country_id');
  tep_session_register('customer_zone_id');
  tep_session_register('customer_first_name');
//  Customer exists, is logged and address book is up to date

 

Is there anything I can do to speed this portion up?

 

I did find this: http://groups.google.com/group/google-chec...c95ae5ae596201# but I'd appreciate it if someone with more knowledge could confirm this would help.

 

Thanks in advance!

Edited by theantiquestore
Link to comment
Share on other sites

Try disabling suburb and gender in the Customer Details, I noticed that you don't have DOB in your Customer Details either. Do you have it listed on your admin panel? If you do, a conflict might arise from having it selected and not having it in your code to be executed. Thus, the server times out.

Edited by speed777
Link to comment
Share on other sites

Try disabling suburb and gender in the Customer Details, I noticed that you don't have DOB in your Customer Details either. Do you have it listed on your admin panel? If you do, a conflict might arise from having it selected and not having it in your code to be executed. Thus, the server times out.

 

I dont ask for DOB (yes it is listed in admin and I have it as false) or Gender. I only ask for Suburb (which no one has ever put anything in that line!). I'll disable suburb.

 

I'm not sure that this is gonna fix the time out issue.

Link to comment
Share on other sites

I have spent two days on this and can not get it..

 

http://my_site/shop/googlecheckout/responsehandler.php

 

 

and I get Invalid or not supported Message

 

I have my sandbox information..

I have added the dataBASE INFORMATION IN THERE

 

 

I read somewhere to do this to the responsehandler.php

 

Change this error_reporting(E_ALL); to this. ==== error_reporting(0);

and add this under this

define('MODULE_PAYMENT_GOOGLECHECKOUT_MULTISOCKET', 'False');

add this

define('SESSION_FORCE_COOKIE_USE', 'False');

 

 

and it still doesn't work.. can any guru's our there help me..

I am very frustrated.

noppie

Link to comment
Share on other sites

You appear to be missing this code in admin/includes/functions/general:

line 941 // perhaps this function must be moved to googlecheckout class, is not too general

function gc_cfg_select_shipping($select_array, $key_value, $key = '') {

No, it is there, it is part of the huge bit of Google code.

Link to comment
Share on other sites

What kind of errors do you see in your Googlecheckout Integration Console?

 

I have spent two days on this and can not get it..

 

http://my_site/shop/googlecheckout/responsehandler.php

 

 

and I get Invalid or not supported Message

 

I have my sandbox information..

I have added the dataBASE INFORMATION IN THERE

 

 

I read somewhere to do this to the responsehandler.php

 

Change this error_reporting(E_ALL); to this. ==== error_reporting(0);

and add this under this

define('MODULE_PAYMENT_GOOGLECHECKOUT_MULTISOCKET', 'False');

add this

define('SESSION_FORCE_COOKIE_USE', 'False');

 

 

and it still doesn't work.. can any guru's our there help me..

I am very frustrated.

noppie

Link to comment
Share on other sites

Hi, I have searched everywhere but not seen an answer. I have google checkout installed and everything works great except for one thing. I only have to charge Tax on 4 items in my store and only if they are shipped within my state. At that time shipping is also taxable. All other items and their shipping costs should not be taxed. However, google is charging tax on all products and shipping within my state.

 

Is there a way to correct this? OSC is charging all my in state shipments tax on shipping, but at least it is only taxing products marked as taxable.

Link to comment
Share on other sites

I'm not sure that this is gonna fix the time out issue.

 

 

It may not solve the problem but it is a process of elimination. When troubleshooting a problem, you first rely on information that you already know (i.e. I've seen that problem before and this is what I did to fix it). If you have never seen the problem but you have some idea of section of the program its affecting, you eliminate elements until you find the cause. If that doesn't work, you research it. If that doesn't solve it, you try to reinstall the module or rely on paid help.

Link to comment
Share on other sites

Hi all,

Really simple one this.

I've just downloaded the google cart contrib and want to install it, however in the install guide it tells me to copy files to the OSC directory and the OSC/Catalogue directory, which I don't have.

My file structure is simply

public_html/osshop/

and from here you can go into admin, download, ext, images, includes or pub

so I don't understand where to put the first sets of files.

Any help would be appreciated.

Thanks

Jon

Link to comment
Share on other sites

Hey guys.

 

I have searched OSC forums and the internet both and I still can not come up with a solution.

 

my - googlecheckout/responsehandler.php gives me this error message:

 

Warning: googlecheckout(/home/mikey/public_html/googlecheckout/includes/languages/english/modules/payment/googlecheckout.php) [function.googlecheckout]: failed to open stream: No such file or directory in /home/mikey/public_html/includes/modules/payment/googlecheckout.php on line 43

 

Fatal error: googlecheckout() [function.require]: Failed opening required '/home/mikey/public_html/googlecheckout/includes/languages/english/modules/payment/googlecheckout.php' (include_path='.:/usr/lib/php:/usr/local/lib/php:.:.') in /home/mikey/public_html/includes/modules/payment/googlecheckout.php on line 43

 

lines 43 - 45 read as follows:

 

require_once(DIR_FS_CATALOG .'/includes/languages/'. $language .'/modules/payment/googlecheckout.php');

require(DIR_FS_CATALOG .'/googlecheckout/shipping_methods.php');

require(DIR_FS_CATALOG .'/googlecheckout/shipping_methods_ccs.php');

 

I have verified and all files are in their correct directories. Any help?

 

Thanks.

Link to comment
Share on other sites

You have to set up an .htaccess file on your server. The easy way to this is to do it is from your server control panel. It should say Password Protect Directories or something like that. Go to Googlecheckout and put in 2 users and 2 passwords. Your usernames will be the Production Merchant ID and Sandbox Merchant ID. Your passwords will be your Production Merchant Key and Sandbox Merchant Key.

 

 

Thanks for the reply, this problem is resolved.

 

Now I have 2 more queries.

 

1. I want the shipping rates to be zone based rates which I have in my OSC admin. How can I do that, It is right now taking only flat shipping rate and "Default Values for Real Time Shipping Rates".

 

2. How to restrict the shipping country as well in googlecheckout.

 

Thanks,

Satwinder

Link to comment
Share on other sites

You would load the Googlecheckout files in the osshop directory so your file structure would look like this: public_html/osshop/googlecheckout. My personal preference is to load them into the public_html directory but it really doesn't matter so much.

 

Hi all,

Really simple one this.

I've just downloaded the google cart contrib and want to install it, however in the install guide it tells me to copy files to the OSC directory and the OSC/Catalogue directory, which I don't have.

My file structure is simply

public_html/osshop/

and from here you can go into admin, download, ext, images, includes or pub

so I don't understand where to put the first sets of files.

Any help would be appreciated.

Thanks

Jon

Link to comment
Share on other sites

1. I can't answer this because I use UPS realtime rates and haven't used the zone rates. Maybe you can find more info at http://groups.google.com/group/google-chec...evelopers-forum

2. There are contributions which address this issue, do a search on the contributions section.

 

Thanks for the reply, this problem is resolved.

 

Now I have 2 more queries.

 

1. I want the shipping rates to be zone based rates which I have in my OSC admin. How can I do that, It is right now taking only flat shipping rate and "Default Values for Real Time Shipping Rates".

 

2. How to restrict the shipping country as well in googlecheckout.

 

Thanks,

Satwinder

Edited by speed777
Link to comment
Share on other sites

Maybe you uploaded the same file in 2 different locations.

 

Hey guys.

 

I have searched OSC forums and the internet both and I still can not come up with a solution.

 

my - googlecheckout/responsehandler.php gives me this error message:

 

Warning: googlecheckout(/home/mikey/public_html/googlecheckout/includes/languages/english/modules/payment/googlecheckout.php) [function.googlecheckout]: failed to open stream: No such file or directory in /home/mikey/public_html/includes/modules/payment/googlecheckout.php on line 43

 

Fatal error: googlecheckout() [function.require]: Failed opening required '/home/mikey/public_html/googlecheckout/includes/languages/english/modules/payment/googlecheckout.php' (include_path='.:/usr/lib/php:/usr/local/lib/php:.:.') in /home/mikey/public_html/includes/modules/payment/googlecheckout.php on line 43

 

lines 43 - 45 read as follows:

 

require_once(DIR_FS_CATALOG .'/includes/languages/'. $language .'/modules/payment/googlecheckout.php');

require(DIR_FS_CATALOG .'/googlecheckout/shipping_methods.php');

require(DIR_FS_CATALOG .'/googlecheckout/shipping_methods_ccs.php');

 

I have verified and all files are in their correct directories. Any help?

 

Thanks.

Link to comment
Share on other sites

Sorry, I made a mistake in adding the link to the Google developers forum, I should have read your post more closely.

 

1. I can't answer this because I use UPS realtime rates and haven't used the zone rates. Maybe you can find more info at http://groups.google.com/group/google-chec...evelopers-forum

2. There are contributions which address this issue, do a search on the contributions section.

Link to comment
Share on other sites

Could you post your admin/modules.php file?

Here it is:

 

<?php

/*

$Id: modules.php,v 1.47 2003/06/29 22:50:52 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

// ** GOOGLE CHECKOUT **

function gc_makeSqlString($str) {

$single_quote = "'";

$escaped_str = addcslashes(stripcslashes($str), "'\"\\\0..\37!@\177..\377");

return ($single_quote.$escaped_str.$single_quote);

}

// **END GOOGLE CHECKOUT**

 

$set = (isset($HTTP_GET_VARS['set']) ? $HTTP_GET_VARS['set'] : '');

 

if (tep_not_null($set)) {

switch ($set) {

case 'shipping':

$module_type = 'shipping';

$module_directory = DIR_FS_CATALOG_MODULES . 'shipping/';

$module_key = 'MODULE_SHIPPING_INSTALLED';

define('HEADING_TITLE', HEADING_TITLE_MODULES_SHIPPING);

break;

case 'ordertotal':

$module_type = 'order_total';

$module_directory = DIR_FS_CATALOG_MODULES . 'order_total/';

$module_key = 'MODULE_ORDER_TOTAL_INSTALLED';

define('HEADING_TITLE', HEADING_TITLE_MODULES_ORDER_TOTAL);

break;

case 'payment':

default:

$module_type = 'payment';

$module_directory = DIR_FS_CATALOG_MODULES . 'payment/';

$module_key = 'MODULE_PAYMENT_INSTALLED';

define('HEADING_TITLE', HEADING_TITLE_MODULES_PAYMENT);

break;

}

}

 

$action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 

if (tep_not_null($action)) {

switch ($action) {

case 'save':

// ** GOOGLE CHECKOUT **

// fix configuration no saving -

reset($HTTP_POST_VARS['configuration']);

// end fix

// ** END GOOGLE CHECKOUT **

while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) {

// ** GOOGLE CHECKOUT **

// Checks if module is of type google checkout and also verfies if this configuration is

// for the check boxes for the shipping options

if( is_array( $value ) ){

$value = implode( ", ", $value);

$value = ereg_replace (", --none--", "", $value);

}

// ** END GOOGLE CHECKOUT **

 

tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = " . gc_makeSqlString($value) . " where configuration_key = " . gc_makeSqlString($key));

}

tep_redirect(tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $HTTP_GET_VARS['module']));

break;

 

case 'install':

case 'remove':

$file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));

$class = basename($HTTP_GET_VARS['module']);

if (file_exists($module_directory . $class . $file_extension)) {

include($module_directory . $class . $file_extension);

$module = new $class;

if ($action == 'install') {

$module->install();

} elseif ($action == 'remove') {

$module->remove();

}

}

tep_redirect(tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class));

break;

}

}

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

<script language="javascript" src="includes/general.js"></script>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="2" cellpadding="2">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_MODULES; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_SORT_ORDER; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>

</tr>

<?php

$file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));

$directory_array = array();

if ($dir = @dir($module_directory)) {

while ($file = $dir->read()) {

if (!is_dir($module_directory . $file)) {

if (substr($file, strrpos($file, '.')) == $file_extension) {

$directory_array[] = $file;

}

}

}

sort($directory_array);

$dir->close();

}

 

$installed_modules = array();

for ($i=0, $n=sizeof($directory_array); $i<$n; $i++) {

$file = $directory_array[$i];

 

include(DIR_FS_CATALOG_LANGUAGES . $language . '/modules/' . $module_type . '/' . $file);

include($module_directory . $file);

 

$class = substr($file, 0, strrpos($file, '.'));

if (tep_class_exists($class)) {

$module = new $class;

if ($module->check() > 0) {

if ($module->sort_order > 0) {

$installed_modules[$module->sort_order] = $file;

} else {

$installed_modules[] = $file;

}

}

 

if ((!isset($HTTP_GET_VARS['module']) || (isset($HTTP_GET_VARS['module']) && ($HTTP_GET_VARS['module'] == $class))) && !isset($mInfo)) {

$module_info = array('code' => $module->code,

'title' => $module->title,

'description' => $module->description,

'status' => $module->check());

 

$module_keys = $module->keys();

 

$keys_extra = array();

for ($j=0, $k=sizeof($module_keys); $j<$k; $j++) {

$key_value_query = tep_db_query("select configuration_title, configuration_value, configuration_description, use_function, set_function from " . TABLE_CONFIGURATION . " where configuration_key = '" . $module_keys[$j] . "'");

$key_value = tep_db_fetch_array($key_value_query);

 

$keys_extra[$module_keys[$j]]['title'] = $key_value['configuration_title'];

$keys_extra[$module_keys[$j]]['value'] = $key_value['configuration_value'];

$keys_extra[$module_keys[$j]]['description'] = $key_value['configuration_description'];

$keys_extra[$module_keys[$j]]['use_function'] = $key_value['use_function'];

$keys_extra[$module_keys[$j]]['set_function'] = $key_value['set_function'];

}

 

$module_info['keys'] = $keys_extra;

 

$mInfo = new objectInfo($module_info);

}

 

if (isset($mInfo) && is_object($mInfo) && ($class == $mInfo->code) ) {

if ($module->check() > 0) {

echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class . '&action=edit') . '\'">' . "\n";

} else {

echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "\n";

}

} else {

echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class) . '\'">' . "\n";

}

?>

<td class="dataTableContent"><?php echo $module->title; ?></td>

<td class="dataTableContent" align="right"><?php if (is_numeric($module->sort_order)) echo $module->sort_order; ?></td>

<td class="dataTableContent" align="right"><?php if (isset($mInfo) && is_object($mInfo) && ($class == $mInfo->code) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif'); } else { echo '<a href="' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>

</tr>

<?php

}

}

 

ksort($installed_modules);

$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = '" . $module_key . "'");

if (tep_db_num_rows($check_query)) {

$check = tep_db_fetch_array($check_query);

if ($check['configuration_value'] != implode(';', $installed_modules)) {

tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . implode(';', $installed_modules) . "', last_modified = now() where configuration_key = '" . $module_key . "'");

}

} else {

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Installed Modules', '" . $module_key . "', '" . implode(';', $installed_modules) . "', 'This is automatically updated. No need to edit.', '6', '0', now())");

}

?>

<tr>

<td colspan="3" class="smallText"><?php echo TEXT_MODULE_DIRECTORY . ' ' . $module_directory; ?></td>

</tr>

</table></td>

<?php

$heading = array();

$contents = array();

 

switch ($action) {

case 'edit':

$keys = '';

reset($mInfo->keys);

while (list($key, $value) = each($mInfo->keys)) {

$keys .= '<b>' . $value['title'] . '</b><br>' . $value['description'] . '<br>';

 

if ($value['set_function']) {

eval('$keys .= ' . $value['set_function'] . "'" . $value['value'] . "', '" . $key . "');");

} else {

$keys .= tep_draw_input_field('configuration[' . $key . ']', $value['value']);

}

$keys .= '<br><br>';

}

$keys = substr($keys, 0, strrpos($keys, '<br><br>'));

 

$heading[] = array('text' => '<b>' . $mInfo->title . '</b>');

 

$contents = array('form' => tep_draw_form('modules', FILENAME_MODULES, 'set=' . $set . '&module=' . $HTTP_GET_VARS['module'] . '&action=save'));

$contents[] = array('text' => $keys);

$contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $HTTP_GET_VARS['module']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');

break;

default:

$heading[] = array('text' => '<b>' . $mInfo->title . '</b>');

 

if ($mInfo->status == '1') {

$keys = '';

reset($mInfo->keys);

while (list(, $value) = each($mInfo->keys)) {

$keys .= '<b>' . $value['title'] . '</b><br>';

if ($value['use_function']) {

$use_function = $value['use_function'];

if (ereg('->', $use_function)) {

$class_method = explode('->', $use_function);

if (!is_object(${$class_method[0]})) {

include(DIR_WS_CLASSES . $class_method[0] . '.php');

${$class_method[0]} = new $class_method[0]();

}

$keys .= tep_call_function($class_method[1], $value['value'], ${$class_method[0]});

} else {

$keys .= tep_call_function($use_function, $value['value']);

}

} else {

$keys .= $value['value'];

}

$keys .= '<br><br>';

}

$keys = substr($keys, 0, strrpos($keys, '<br><br>'));

 

$contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $mInfo->code . '&action=remove') . '">' . tep_image_button('button_module_remove.gif', IMAGE_MODULE_REMOVE) . '</a> <a href="' . tep_href_link(FILENAME_MODULES, 'set=' . $set . (isset($HTTP_GET_VARS['module']) ? '&module=' . $HTTP_GET_VARS['module'] : '') . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a>');

$contents[] = array('text' => '<br>' . $mInfo->description);

$contents[] = array('text' => '<br>' . $keys);

} else {

$contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $mInfo->code . '&action=install') . '">' . tep_image_button('button_module_install.gif', IMAGE_MODULE_INSTALL) . '</a>');

$contents[] = array('text' => '<br>' . $mInfo->description);

}

break;

}

 

if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {

echo ' <td width="25%" valign="top">' . "\n";

 

$box = new box;

echo $box->infoBox($heading, $contents);

 

echo ' </td>' . "\n";

}

?>

</tr>

</table></td>

</tr>

</table></td>

<!-- body_text_eof //-->

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...