External Web Hosting Companies Support 
   
Home :: About Us :: Contact Us :: Partnership :: Privacy Policy :: Forum 
Server Monitoring :: Remote NetAdmin :: Script Installation & Customization 
 
 

  Table of contest


H-Sphere Help4Hosters accepts credit card payments via 2CheckOut
Credit card purchases
will be sold by 2Checkout.com,
Inc. - Ohio, U.S.A.

Services provided by Help4Hosters

Installation of the H4H Affiliate Program

  1. 1. Files Copying
  2. 2. Database Update
  3. 3. Changing your shop settings (Admin)
  4. 4. Changing your shop settings (User)

1. Files Copying

Please copy the files from the package to your catalog/ and admin/ folders corresponding to the tree structure.


2. Database Update

Run the admin/h4h_ap_db.php script. It will create the Affiliate Program database tables or upgrade existing ones.
It is important to run the script before you edit your shop files. Please run the script only once.


3. Changing your shop settings (Admin)

(in case of upgrade please delete all the changes you've made during previous installations)

3.1. Edit your admin/includes/configure.php file

Add the following to your admin/includes/configure.php file:
// H4H AFFILIATE PROGRAM
define('FILENAME_REFERRAL','referrals.php');
define('DIR_WS_REFERRAL', 'referral/');
// H4H AFFILIATE PROGRAM

3.2. Edit your admin/includes/application_top.php file

In admin/includes/application_top.php around the line 130 right after
} else {
$lng->get_browser_language();
}

$language = $lng->language['directory'];
$languages_id = $lng->language['id'];
}

add

// H4H AFFILIATE PROGRAM
include('includes/h4h_affiliate_config.php');
// H4H AFFILIATE PROGRAM

3.3. Edit your admin/includes/column_left.php file

To admin/includes/column_left.php add
// H4H AFFILIATE PROGRAM
require(DIR_WS_BOXES . 'h4h_affiliate.php');
// H4H AFFILIATE PROGRAM

3.4. Edit your admin/orders_status.php file

Add to admin/orders_status.php right after

} elseif ($action == 'save') {
tep_db_perform(TABLE_ORDERS_STATUS, $sql_data_array, 'update',
"orders_status_id = '" . (int)$orders_status_id . "' and language_id = '" . (int)$language_id . "'");
}
}

if (isset($HTTP_POST_VARS['default']) && ($HTTP_POST_VARS['default'] == 'on')) {
tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" .
tep_db_input($orders_status_id) . "' where configuration_key = 'DEFAULT_ORDERS_STATUS_ID'");
}

(around the line 50):

// H4H AFFILIATE PROGRAM
include(DIR_WS_INCLUDES . 'h4h_affiliate_orders_status_add.php');
// H4H AFFILIATE PROGRAM

(add this right before

tep_redirect(tep_href_link(FILENAME_ORDERS_STATUS,
'page=' . $HTTP_GET_VARS['page'] . '&oID=' . $orders_status_id));

)

3.5. Edit your admin/orders_status.php file

Add to admin/orders_status.php right after

case 'deleteconfirm':
$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

$orders_status_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION .
" where configuration_key = 'DEFAULT_ORDERS_STATUS_ID'");
$orders_status = tep_db_fetch_array($orders_status_query);

if ($orders_status['configuration_value'] == $oID) {
tep_db_query("update " . TABLE_CONFIGURATION .
" set configuration_value = '' where configuration_key = 'DEFAULT_ORDERS_STATUS_ID'");
}

tep_db_query("delete from " . TABLE_ORDERS_STATUS . " where orders_status_id = '" .
tep_db_input($oID) . "'");

(around the line 67):

// H4H AFFILIATE PROGRAM
include(DIR_WS_INCLUDES . 'h4h_affiliate_orders_status_remove.php');
// H4H AFFILIATE PROGRAM

(add this right before

tep_redirect(tep_href_link(FILENAME_ORDERS_STATUS, 'page=' . $HTTP_GET_VARS['page']));

)

3.6. Edit your admin/orders.php file

To admin/orders.php right after

if ( ($check_status['orders_status'] != $status) || tep_not_null($comments)) {
tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" .
tep_db_input($status) .
"', last_modified = now() where orders_id = '" . (int)$oID . "'");

$customer_notified = '0';
if (isset($HTTP_POST_VARS['notify']) && ($HTTP_POST_VARS['notify'] == 'on')) {
$notify_comments = '';
if (isset($HTTP_POST_VARS['notify_comments']) &&
($HTTP_POST_VARS['notify_comments'] == 'on')) {
$notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n\n";
}

$email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER .
' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' .
tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO,
'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' .
tep_date_long($check_status['date_purchased']) . "\n\n" .
$notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

tep_mail($check_status['customers_name'], $check_status['customers_email_address'],
EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

$customer_notified = '1';
}

tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY .
" (orders_id, orders_status_id, date_added, customer_notified, comments) VALUES (1'" .
(int)$oID . "', '" . tep_db_input($status) . "', now(), '" .
tep_db_input($customer_notified) . "', '" . tep_db_input($comments) . "')");


around the line 57 add

// H4H AFFILIATE PROGRAM
include (DIR_WS_INCLUDES . 'h4h_affiliate_orders_status_change.php');
// H4H AFFILIATE PROGRAM

3.7. Edit your admin/includes/classes/order.php file

In admin/includes/classes/order.php change

$index = 0;
$orders_products_query = tep_db_query("select
orders_products_id, products_name, products_model,
products_price, products_tax, products_quantity,
final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" .
(int)$order_id . "'");
while ($orders_products = tep_db_fetch_array($orders_products_query)) {
$this->products[$index] = array('qty' => $orders_products['products_quantity'],
'name' => $orders_products['products_name'],
'model' => $orders_products['products_model'],
'tax' => $orders_products['products_tax'],
'price' => $orders_products['products_price'],
'final_price' => $orders_products['final_price']);


to

$index = 0;
$orders_products_query = tep_db_query("select orders_products_id, products_id,
products_name, products_model, products_price, products_tax, products_quantity,
final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" .
(int)$order_id . "'");
while ($orders_products = tep_db_fetch_array($orders_products_query)) {
$this->products[$index] = array('qty' => $orders_products['products_quantity'],
'name' => $orders_products['products_name'],
'model' => $orders_products['products_model'],
'tax' => $orders_products['products_tax'],
'price' => $orders_products['products_price'],
'final_price' => $orders_products['final_price'],
'products_id' => $orders_products['products_id']
);


4. Changing your shop settings (User)

(in case of upgrade please delete all the changes you've made during previous installations)

4.1. Edit your catalog/includes/configure.php file

Add to catalog/includes/configure.php

// H4H AFFILIATE PROGRAM
if (isset($Module) && $Module == 'Affiliate') {
define('DIR_WS_INCLUDES', '../includes/');
} else {
define('DIR_WS_INCLUDES', 'includes/');
}
// H4H AFFILIATE PROGRAM

4.2. Edit your catalog/includes/application_top.php file

In catalog/includes/application_top.php replace

// Set the local configuration parameters - mainly for developers
if (file_exists('includes/local/configure.php')) include('includes/local/configure.php');

// include server parameters
require('includes/configure.php');


with

// H4H AFFILIATE PROGRAM
if (isset($Module) && $Module == 'Affiliate') {
// Set the local configuration parameters - mainly for developers
if (file_exists('../includes/local/configure.php'))
include('../includes/local/configure.php');
// include server parameters
require('../includes/configure.php');
} else {
// Set the local configuration parameters - mainly for developers
if (file_exists('includes/local/configure.php'))
include('includes/local/configure.php');
// include server parameters
require('includes/configure.php');
}
// H4H AFFILIATE PROGRAM

4.3. Edit your catalog/includes/application_top.php file

In catalog/includes/application_top.php around the line 308 right after

} else {
$lng->get_browser_language();
}

$language = $lng->language['directory'];
$languages_id = $lng->language['id'];
}

// include the language translations
require(DIR_WS_LANGUAGES . $language . '.php');


add

// H4H AFFILIATE PROGRAM
require(DIR_WS_LANGUAGES . 'h4h_affiliate_' . $language . '.php');
// H4H AFFILIATE PROGRAM

4.4. Edit your catalog/includes/application_top.php file

At the bottom of catalog/includes/application_top.php right before the last
?>

add

// H4H AFFILIATE PROGRAM
require(DIR_WS_INCLUDES . 'h4h_affiliate_config.php');
// H4H AFFILIATE PROGRAM

4.5. Edit your catalog/includes/column_left.php file

To catalog/includes/column_left.php add

// H4H AFFILIATE PROGRAM
require(DIR_WS_BOXES . 'h4h_affiliate.php');
// H4H AFFILIATE PROGRAM

4.6. Edit your catalog/create_account.php file

To catalog/create_account.php right after

'customers_newsletter' => $newsletter,
'customers_password' => tep_encrypt_password($password));

if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;
if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($dob);

tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

$customer_id = tep_db_insert_id();

around the line 185 add

// H4H AFFILIATE PROGRAM
include(DIR_WS_INCLUDES . 'h4h_affiliate_account_create.php');
// H4H AFFILIATE PROGRAM

If your OsCommerce is running on Preview Release 2.2-CVS

A. Make changes in your admin/includes/general.js file

Add the following to your admin/includes/general.js:

function rowOverEffect(object) {
if (object.className == 'dataTableRow') object.className = 'dataTableRowOver';
}

function rowOutEffect(object) {
if (object.className == 'dataTableRowOver') object.className = 'dataTableRow';
}

B. Make changes in your admin/includes/functions/html_output.php

In your admin/includes/functions/html_output.php change
function tep_image_submit($image, $alt, $params = '') {

to

function tep_image_submit($image, $alt = '', $params = '') {

Installation is now complete.

[ <<Introduction to the H4H Affiliate Program ] [ OsCommerce Affiliate program users guide ] [ Configuring the H4H Affiliate Program >> ]


Copyright Help4Hosters Team © 2009