Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

### POINTS AND REWARDS MODULE V1.00 ###


Recommended Posts

Hi there,

 

i'm using the points and rewards module for quite a while now and have just added the 'add points for product reviews' so that customers can get points for any rewards their giving.

 

But the problem is, that there is a sneaky customer who is adding his review to almost every product he can find. This means that the standard 40 points he's getting, he's getting about 40 times at this moment.

 

is it possible to restrict this kind of rewarding to just one per customer? Other wise this customer can get up to 50 euro's discount with his next order.

 

kind regards,

Marcus

Link to comment
Share on other sites

Hi there,

 

i'm using the points and rewards module for quite a while now and have just added the 'add points for product reviews' so that customers can get points for any rewards their giving.

 

But the problem is, that there is a sneaky customer who is adding his review to almost every product he can find. This means that the standard 40 points he's getting, he's getting about 40 times at this moment.

 

is it possible to restrict this kind of rewarding to just one per customer? Other wise this customer can get up to 50 euro's discount with his next order.

 

kind regards,

Marcus

 

 

As far as I know, currently there is no way to restrict this - although you could probably modify the "award points for new account referral" script as this only allows a once time points allocation - but how are your programming skills :-)

 

I just put a note on the referral page that says "conditions of receiving review points: You must have bought the product; only one per customer per week" etc.... and then just manually approve or reject....

 

Works for me...

Link to comment
Share on other sites

can someone please advise where i have to place this code in the paypal_ipn.php file, i have been trying all different things all night and can not get it right.

 

 

In my paypal IPN file it is here:

 

around line 77 Find:

  function pre_confirmation_check() {
  return false;
}

function confirmation() {

 

AFTER, add this:

 

#### Points/Rewards Module V2.00 balance customer points BOF ####
//	global $cartID, $cart_PayPal_IPN_ID, $customer_id, $languages_id, $order, $order_total_modules;

  global $cartID, $cart_PayPal_IPN_ID, $customer_id, $languages_id, $order, $customer_shopping_points, $customer_shopping_points_spending, $order_total_modules;
#### Points/Rewards Module V2.00 balance customer points EOF ####*/

 

 

THEN around line 177, find

 

tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array); }

 

afterwards paste this code

 

#### Points/Rewards Module V2.00 balance customer points BOF ####
	  if ((USE_POINTS_SYSTEM == 'true') && (USE_REDEEM_SYSTEM == 'true')) {
// customer pending points added 
		if (($order->info['total'] > 0) && (get_award_discounted($order) == true)) {
		  $points_toadd = get_points_toadd($order);
		  $points_comment = 'TEXT_DEFAULT_COMMENT';
		  $points_type = 'SP';
		  if ((get_redemption_awards($customer_shopping_points_spending) == true) && ($points_toadd >0)) {
			tep_add_pending_points($customer_id, $insert_id, $points_toadd, $points_comment, $points_type);
		  }
		}
// customer referral points added 
		if ((tep_session_is_registered('customer_referral')) && (tep_not_null(USE_REFERRAL_SYSTEM))) {
		 $points_toadd = USE_REFERRAL_SYSTEM;
		 $points_comment = 'TEXT_DEFAULT_REFERRAL';
		 $points_type = 'RF';
		 tep_add_pending_points($customer_referral, $insert_id, $points_toadd, $points_comment, $points_type);
		}
// customer shoppping points account balanced 
		if ($customer_shopping_points_spending) {
		  tep_redeemed_points($customer_id, $insert_id, $customer_shopping_points_spending);
		}
	  }
#### Points/Rewards Module V2.00 balance customer points EOF ####*/

 

Finally - at the end of the file, around line 534, find this

 

// unregister session variables used during checkout
  tep_session_unregister('sendto');
  tep_session_unregister('billto');
  tep_session_unregister('shipping');
  tep_session_unregister('payment');
  tep_session_unregister('comments');

 

AFTER the above, add this

 

tep_session_unregister('customer_shopping_points');// Points/Rewards Module V2.00
  tep_session_unregister('customer_shopping_points_spending');// Points/Rewards Module V2.00
  tep_session_unregister('customer_referral');// Points/Rewards Module V2.00

 

Hope that helps

Edited by ssnb
Link to comment
Share on other sites

I Just was looking for someone to answer just this, I had not entered any of my product with tax so I did it last night and all of a sudden when doing a test run a got a lot of the mistakes I got when my cart would not ZERO out. I got this warning although plenty of points

<font color="red">Total Purchase is greater than the maximum points allowed, you will also need to choose a payment method .</font>

and also some odd number of cents. I am playing with all the config to try and marry up the decimals. But it went away when I took taxes off my product.

 

even this does not solve my problem

 

here's page at checkout

 

total price of products is $63.48

Sub-Total: $57.13

Per Item (Best Way): $0.05

Points Redeemed: -$2.12

Discount Coupon 1 applied: -$6.35

Total: $0.04

 

please check it here's the link of my site currently its on our server.

 

http://prowebdesignsolutions.com/sulbha/

username: [email protected]

password : asasas

http://prowebdesignsolutions.com/sulbha/admin

username : admin

password : admin

Link to comment
Share on other sites

As far as I know, currently there is no way to restrict this - although you could probably modify the "award points for new account referral" script as this only allows a once time points allocation - but how are your programming skills :-)

 

I just put a note on the referral page that says "conditions of receiving review points: You must have bought the product; only one per customer per week" etc.... and then just manually approve or reject....

 

Works for me...

 

Hi,

 

that should be an idea. I'll take a look at it and try to modify this new account referral. when I got something working, I'll let you know.

 

marcus

Link to comment
Share on other sites

Dear All,

 

First, thank you for all of you in making this contribution more perfect.

As now I am going to install this addon, I have several question and hope someone can help.

 

I have add other contributions before, so there are 3 places that I don't know how to follow the instruction:

 

#1

CATALOG STEP = 5. where the file is catalog/checkout_process.php

(I don't know where to place the addon, below is my existing one)

 

<?php

/*

$Id: checkout_process.php,v 1.128 2003/05/28 18:00:29 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

include('includes/application_top.php');

 

// if the customer is not logged on, redirect them to the login page

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

 

if (!tep_session_is_registered('sendto')) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

}

 

if ( (tep_not_null(MODULE_PAYMENT_INSTALLED)) && (!tep_session_is_registered('payment')) ) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

}

 

// avoid hack attempts during the checkout procedure by checking the internal cartID

if (isset($cart->cartID) && tep_session_is_registered('cartID')) {

if ($cart->cartID != $cartID) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));

}

}

 

include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS);

 

// load selected payment module

require(DIR_WS_CLASSES . 'payment.php');

$payment_modules = new payment($payment);

 

// load the selected shipping module

require(DIR_WS_CLASSES . 'shipping.php');

$shipping_modules = new shipping($shipping);

 

require(DIR_WS_CLASSES . 'order.php');

$order = new order;

 

// load the before_process function from the payment modules

$payment_modules->before_process();

 

require(DIR_WS_CLASSES . 'order_total.php');

$order_total_modules = new order_total;

 

$order_totals = $order_total_modules->process();

 

$sql_data_array = array('customers_id' => $customer_id,

'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],

'customers_company' => $order->customer['company'],

'customers_street_address' => $order->customer['street_address'],

'customers_suburb' => $order->customer['suburb'],

'customers_city' => $order->customer['city'],

'customers_postcode' => $order->customer['postcode'],

'customers_state' => $order->customer['state'],

'customers_country' => $order->customer['country']['title'],

'customers_telephone' => $order->customer['telephone'],

'customers_email_address' => $order->customer['email_address'],

'customers_address_format_id' => $order->customer['format_id'],

'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],

'delivery_company' => $order->delivery['company'],

'delivery_street_address' => $order->delivery['street_address'],

'delivery_suburb' => $order->delivery['suburb'],

'delivery_city' => $order->delivery['city'],

'delivery_postcode' => $order->delivery['postcode'],

'delivery_state' => $order->delivery['state'],

'delivery_country' => $order->delivery['country']['title'],

'delivery_address_format_id' => $order->delivery['format_id'],

'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'],

'billing_company' => $order->billing['company'],

'billing_street_address' => $order->billing['street_address'],

'billing_suburb' => $order->billing['suburb'],

'billing_city' => $order->billing['city'],

'billing_postcode' => $order->billing['postcode'],

'billing_state' => $order->billing['state'],

'billing_country' => $order->billing['country']['title'],

'billing_address_format_id' => $order->billing['format_id'],

'payment_method' => $order->info['payment_method'],

'cc_type' => $order->info['cc_type'],

'cc_owner' => $order->info['cc_owner'],

'cc_number' => $order->info['cc_number'],

'cc_expires' => $order->info['cc_expires'],

'date_purchased' => 'now()',

'orders_status' => $order->info['order_status'],

'currency' => $order->info['currency'],

'currency_value' => $order->info['currency_value']);

tep_db_perform(TABLE_ORDERS, $sql_data_array);

$insert_id = tep_db_insert_id();

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

$sql_data_array = array('orders_id' => $insert_id,

'title' => $order_totals[$i]['title'],

'text' => $order_totals[$i]['text'],

'value' => $order_totals[$i]['value'],

'class' => $order_totals[$i]['code'],

'sort_order' => $order_totals[$i]['sort_order']);

tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);

}

#### Points/Rewards Module V2.1rc2a balance customer points BOF ####

if ((USE_POINTS_SYSTEM == 'true') && (USE_REDEEM_SYSTEM == 'true')) {

// customer pending points added

if ($order->info['total'] > 0) {

$points_toadd = get_points_toadd($order);

$points_comment = 'TEXT_DEFAULT_COMMENT';

$points_type = 'SP';

if ((get_redemption_awards($customer_shopping_points_spending) == true) && ($points_toadd >0)) {

tep_add_pending_points($customer_id, $insert_id, $points_toadd, $points_comment, $points_type);

}

}

// customer referral points added

if ((tep_session_is_registered('customer_referral')) && (tep_not_null(USE_REFERRAL_SYSTEM))) {

$referral_twice_query = tep_db_query("select unique_id from " . TABLE_CUSTOMERS_POINTS_PENDING . " where orders_id = '". (int)$insert_id ."' and points_type = 'RF' limit 1");

if (!tep_db_num_rows($referral_twice_query)) {

$points_toadd = USE_REFERRAL_SYSTEM;

$points_comment = 'TEXT_DEFAULT_REFERRAL';

$points_type = 'RF';

tep_add_pending_points($customer_referral, $insert_id, $points_toadd, $points_comment, $points_type);

}

}

// customer shoppping points account balanced

if ($customer_shopping_points_spending) {

tep_redeemed_points($customer_id, $insert_id, $customer_shopping_points_spending);

}

}

#### Points/Rewards Module V2.1rc2a balance customer points EOF ####*/

$customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';

$sql_data_array = array('orders_id' => $insert_id,

'orders_status_id' => $order->info['order_status'],

'date_added' => 'now()',

'customer_notified' => $customer_notification,

'comments' => $order->info['comments']);

tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

 

// initialized for the email confirmation

$products_ordered = '';

$subtotal = 0;

$total_tax = 0;

 

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

// Stock Update - Joao Correia

if (STOCK_LIMITED == 'true') {

if (DOWNLOAD_ENABLED == 'true') {

$stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename

FROM " . TABLE_PRODUCTS . " p

LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa

ON p.products_id=pa.products_id

LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad

ON pa.products_attributes_id=pad.products_attributes_id

WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";

// Will work with only one option for downloadable products

// otherwise, we have to build the query dynamically with a loop

$products_attributes = $order->products[$i]['attributes'];

if (is_array($products_attributes)) {

$stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";

}

$stock_query = tep_db_query($stock_query_raw);

} else {

$stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

}

if (tep_db_num_rows($stock_query) > 0) {

$stock_values = tep_db_fetch_array($stock_query);

// do not decrement quantities if products_attributes_filename exists

if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {

$stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];

} else {

$stock_left = $stock_values['products_quantity'];

}

tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {

tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

}

}

}

 

// Update products_ordered (for bestsellers list)

tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

 

$sql_data_array = array('orders_id' => $insert_id,

'products_id' => tep_get_prid($order->products[$i]['id']),

'products_model' => $order->products[$i]['model'],

'products_name' => $order->products[$i]['name'],

'products_price' => $order->products[$i]['price'],

'final_price' => $order->products[$i]['final_price'],

'products_tax' => $order->products[$i]['tax'],

'products_quantity' => $order->products[$i]['qty']);

tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

$order_products_id = tep_db_insert_id();

 

//------insert customer choosen option to order--------

$attributes_exist = '0';

$products_ordered_attributes = '';

if (isset($order->products[$i]['attributes'])) {

$attributes_exist = '1';

for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {

if (DOWNLOAD_ENABLED == 'true') {

$attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename

from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa

left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad

on pa.products_attributes_id=pad.products_attributes_id

where pa.products_id = '" . $order->products[$i]['id'] . "'

and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'

and pa.options_id = popt.products_options_id

and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'

and pa.options_values_id = poval.products_options_values_id

and popt.language_id = '" . $languages_id . "'

and poval.language_id = '" . $languages_id . "'";

$attributes = tep_db_query($attributes_query);

} else {

$attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");

}

$attributes_values = tep_db_fetch_array($attributes);

 

$sql_data_array = array('orders_id' => $insert_id,

'orders_products_id' => $order_products_id,

'products_options' => $attributes_values['products_options_name'],

'products_options_values' => $attributes_values['products_options_values_name'],

'options_values_price' => $attributes_values['options_values_price'],

'price_prefix' => $attributes_values['price_prefix']);

tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);

 

if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename'])) {

$sql_data_array = array('orders_id' => $insert_id,

'orders_products_id' => $order_products_id,

'orders_products_filename' => $attributes_values['products_attributes_filename'],

'download_maxdays' => $attributes_values['products_attributes_maxdays'],

'download_count' => $attributes_values['products_attributes_maxcount']);

tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);

}

$products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];

}

}

//------insert customer choosen option eof ----

$total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);

$total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];

$total_cost += $total_products_price;

 

$products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";

}

 

// lets start with the email confirmation

$email_order = EMAIL_THANK_YOU . "\n" .

EMAIL_SEPARATOR . "\n" .

EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .

EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .

EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";

if ($order->info['comments']) {

$email_order .= tep_db_output($order->info['comments']) . "\n\n";

}

$email_order .= EMAIL_TEXT_PRODUCTS . "\n" .

EMAIL_SEPARATOR . "\n" .

$products_ordered .

EMAIL_SEPARATOR . "\n";

 

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

$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";

}

 

if ($order->content_type != 'virtual') {

$email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .

EMAIL_SEPARATOR . "\n" .

tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";

}

 

$email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .

EMAIL_SEPARATOR . "\n" .

tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";

if (is_object($$payment)) {

$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .

EMAIL_SEPARATOR . "\n";

$payment_class = $$payment;

$email_order .= $payment_class->title . "\n\n";

if ($payment_class->email_footer) {

$email_order .= $payment_class->email_footer . "\n\n";

}

}

$email_text = EMAIL_HEAD_PIC . $email_order. EMAIL_FOOT_PIC;

tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

// send emails to other people

if (SEND_EXTRA_ORDER_EMAILS_TO != '') {

tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

}

 

// load the after_process function from the payment modules

$payment_modules->after_process();

 

$cart->reset(true);

 

// unregister session variables used during checkout

tep_session_unregister('sendto');

tep_session_unregister('billto');

tep_session_unregister('shipping');

tep_session_unregister('payment');

tep_session_unregister('comments');

#### Points/Rewards Module V2.1rc2a balance customer points EOF ####*/

if (tep_session_is_registered('customer_shopping_points')) tep_session_unregister('customer_shopping_points');

if (tep_session_is_registered('customer_shopping_points_spending')) tep_session_unregister('customer_shopping_points_spending');

if (tep_session_is_registered('customer_referral')) tep_session_unregister('customer_referral');

#### Points/Rewards Module V2.1rc2a balance customer points EOF ####*/

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));

 

require(DIR_WS_INCLUDES . 'application_bottom.php');

?>

 

#2

CATALOG STEP = 6. where the file is catalog/create_account.php

(I don't know where to place the addon, below is my existing one)

 

<?php

 

 

require('includes/application_top.php');

 

// needs to be included earlier to set the success message in the messageStack

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CREATE_ACCOUNT);

 

$process = false;

if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process')) {

$process = true;

 

if (ACCOUNT_GENDER == 'true') {

if (isset($HTTP_POST_VARS['gender'])) {

$gender = tep_db_prepare_input($HTTP_POST_VARS['gender']);

} else {

$gender = false;

}

}

$firstname = tep_db_prepare_input($HTTP_POST_VARS['firstname']);

$lastname = tep_db_prepare_input($HTTP_POST_VARS['lastname']);

if (ACCOUNT_DOB == 'true') $dob = tep_db_prepare_input($HTTP_POST_VARS['dob']);

$email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);

if (ACCOUNT_COMPANY == 'true') $company = tep_db_prepare_input($HTTP_POST_VARS['company']);

$street_address = tep_db_prepare_input($HTTP_POST_VARS['street_address']);

if (ACCOUNT_SUBURB == 'true') $suburb = tep_db_prepare_input($HTTP_POST_VARS['suburb']);

$postcode = tep_db_prepare_input($HTTP_POST_VARS['postcode']);

$city = tep_db_prepare_input($HTTP_POST_VARS['city']);

if (ACCOUNT_STATE == 'true') {

$state = tep_db_prepare_input($HTTP_POST_VARS['state']);

if (isset($HTTP_POST_VARS['zone_id'])) {

$zone_id = tep_db_prepare_input($HTTP_POST_VARS['zone_id']);

} else {

$zone_id = false;

}

}

$country = tep_db_prepare_input($HTTP_POST_VARS['country']);

$telephone = tep_db_prepare_input($HTTP_POST_VARS['telephone']);

$fax = tep_db_prepare_input($HTTP_POST_VARS['fax']);

if (isset($HTTP_POST_VARS['newsletter'])) {

$newsletter = tep_db_prepare_input($HTTP_POST_VARS['newsletter']);

} else {

$newsletter = false;

}

$password = tep_db_prepare_input($HTTP_POST_VARS['password']);

$confirmation = tep_db_prepare_input($HTTP_POST_VARS['confirmation']);

// BOC Added for Account Agreement

$agreement = tep_db_prepare_input($HTTP_POST_VARS['agreement']);

// EOC Added for Account Agreement

 

$error = false;

 

if (ACCOUNT_GENDER == 'true') {

if ( ($gender != 'm') && ($gender != 'f') ) {

$error = true;

 

$messageStack->add('create_account', ENTRY_GENDER_ERROR);

}

}

 

if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {

$error = true;

 

$messageStack->add('create_account', ENTRY_FIRST_NAME_ERROR);

}

 

if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {

$error = true;

 

$messageStack->add('create_account', ENTRY_LAST_NAME_ERROR);

}

 

if (ACCOUNT_DOB == 'true') {

if (checkdate(substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 0, 4)) == false) {

$error = true;

 

$messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR);

}

}

 

if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {

$error = true;

 

$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR);

} elseif (tep_validate_email($email_address) == false) {

$error = true;

 

$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);

} else {

$check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");

$check_email = tep_db_fetch_array($check_email_query);

if ($check_email['total'] > 0) {

$error = true;

 

$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);

}

}

 

if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {

$error = true;

 

$messageStack->add('create_account', ENTRY_STREET_ADDRESS_ERROR);

}

 

if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {

$error = true;

 

$messageStack->add('create_account', ENTRY_POST_CODE_ERROR);

}

 

if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {

$error = true;

 

$messageStack->add('create_account', ENTRY_CITY_ERROR);

}

 

if (is_numeric($country) == false) {

$error = true;

 

$messageStack->add('create_account', ENTRY_COUNTRY_ERROR);

}

 

if (ACCOUNT_STATE == 'true') {

$zone_id = 0;

$check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "'");

$check = tep_db_fetch_array($check_query);

$entry_state_has_zones = ($check['total'] > 0);

if ($entry_state_has_zones == true) {

$zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and (zone_name like '" . tep_db_input($state) . "%' or zone_code like '%" . tep_db_input($state) . "%')");

if (tep_db_num_rows($zone_query) == 1) {

$zone = tep_db_fetch_array($zone_query);

$zone_id = $zone['zone_id'];

} else {

$error = true;

 

$messageStack->add('create_account', ENTRY_STATE_ERROR_SELECT);

}

} else {

if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {

$error = true;

 

$messageStack->add('create_account', ENTRY_STATE_ERROR);

}

}

}

 

if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {

$error = true;

 

$messageStack->add('create_account', ENTRY_TELEPHONE_NUMBER_ERROR);

}

 

 

if (strlen($password) < ENTRY_PASSWORD_MIN_LENGTH) {

$error = true;

 

$messageStack->add('create_account', ENTRY_PASSWORD_ERROR);

} elseif ($password != $confirmation) {

$error = true;

 

$messageStack->add('create_account', ENTRY_PASSWORD_ERROR_NOT_MATCHING);

}

// BOC Added for Account Agreement

if (ACCOUNT_AGREEMENT_REQUIRED == 'true') {

if ($agreement == false) {

$error = true;

 

$messageStack->add('create_account',ENTRY_AGREEMENT_ERROR);

}

}

// EOC Added for Account Agreement

 

 

//VISUAL VERIFY CODE start

require(DIR_WS_FUNCTIONS . 'visual_verify_code.php');

 

$code_query = tep_db_query("select code from visual_verify_code where oscsid = '" . $HTTP_GET_VARS['osCsid'] . "'");

$code_array = tep_db_fetch_array($code_query);

$code = $code_array['code'];

 

tep_db_query("DELETE FROM " . TABLE_VISUAL_VERIFY_CODE . " WHERE oscsid='" . $vvcode_oscsid . "'"); //remove the visual verify code associated with this session to clean database and ensure new results

 

$user_entered_code = $HTTP_POST_VARS['visual_verify_code'];

if (!(strcasecmp($user_entered_code, $code) == 0)) { //make the check case insensitive

$error = true;

$messageStack->add('create_account', VISUAL_VERIFY_CODE_ENTRY_ERROR);

}

//VISUAL VERIFY CODE stop

if ($error == false) {

$sql_data_array = array('customers_firstname' => $firstname,

'customers_lastname' => $lastname,

'customers_email_address' => $email_address,

'customers_telephone' => $telephone,

'customers_fax' => $fax,

'customers_newsletter' => $newsletter,

'customers_agreement' => $agreement,

'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();

 

$sql_data_array = array('customers_id' => $customer_id,

'entry_firstname' => $firstname,

'entry_lastname' => $lastname,

'entry_street_address' => $street_address,

'entry_postcode' => $postcode,

'entry_city' => $city,

'entry_country_id' => $country);

 

if (ACCOUNT_GENDER == 'true') $sql_data_array['entry_gender'] = $gender;

if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $company;

if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $suburb;

if (ACCOUNT_STATE == 'true') {

if ($zone_id > 0) {

$sql_data_array['entry_zone_id'] = $zone_id;

$sql_data_array['entry_state'] = '';

} else {

$sql_data_array['entry_zone_id'] = '0';

$sql_data_array['entry_state'] = $state;

}

}

 

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 . "'");

 

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())");

 

if (SESSION_RECREATE == 'True') {

tep_session_recreate();

}

 

$customer_first_name = $firstname;

$customer_default_address_id = $address_id;

$customer_country_id = $country;

$customer_zone_id = $zone_id;

tep_session_register('customer_id');

tep_session_register('customer_first_name');

tep_session_register('customer_default_address_id');

tep_session_register('customer_country_id');

tep_session_register('customer_zone_id');

 

// restore cart contents

$cart->restore_contents();

 

// build the message content

$name = $firstname . ' ' . $lastname;

 

if (ACCOUNT_GENDER == 'true') {

if ($gender == 'm') {

$email_text = EMAIL_HEAD_PIC . sprintf(EMAIL_GREET_MR, $lastname);

} else {

$email_text = EMAIL_HEAD_PIC . sprintf(EMAIL_GREET_MS, $lastname);

}

} else {

$email_text = EMAIL_HEAD_PIC . sprintf(EMAIL_GREET_NONE, $firstname);

}

 

$email_text .= EMAIL_WELCOME . EMAIL_USERNAME . EMAIL_PASSWORD . LOGIN_LINK . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING . EMAIL_FOOT_PIC;

tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));

}

}

 

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));

?>

<!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=utf-8">

<title>scylla closet</title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="<?php echo DIR_WS_LANGUAGES . $language . '/'; ?>stylesheet.css">

<?php require('includes/form_check.js.php'); ?>

</head>

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

<table cellpadding="0" cellspacing="0" border="0" width="830" align="center"><tr><td style="background:url(images/bg.gif) left top repeat-x;">

<table cellpadding="0" cellspacing="0" border="0" align="center">

<tr><td>

 

<!-- header //-->

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

<!-- header_eof //-->

 

<!-- body //-->

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

<tr>

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

<!-- left_navigation //-->

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

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><?php echo tep_draw_form('create_account', tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'), 'post', 'onSubmit="return check_form(create_account);"') . tep_draw_hidden_field('action', 'process'); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

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

<tr>

<td class="pageHeading"><?php echo tep_image_button('image-register.gif',IMAGE_BUTTON_REGISTER) . '</a>'; ?><?php //echo HEADING_TITLE; ?></td>

<td class="pageHeading" align="right"> </td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?>

</td>

</tr>

<tr>

<td class="smallText"><br><?php echo sprintf(TEXT_ORIGIN_LOGIN, tep_href_link(FILENAME_LOGIN, tep_get_all_get_params(), 'SSL')); ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

if ($messageStack->size('create_account') > 0) {

?>

<tr>

<td><?php echo $messageStack->output('create_account'); ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

}

?>

<tr>

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

<tr>

<td class="main"><b><?php echo CATEGORY_PERSONAL; ?></b></td>

<td class="inputRequirement" align="right"><?php echo FORM_REQUIRED_INFORMATION; ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" cellspacing="2" cellpadding="2">

<?php

if (ACCOUNT_GENDER == 'true') {

?>

<tr>

<td class="main"><?php echo ENTRY_GENDER; ?></td>

<td class="main"><?php echo tep_draw_radio_field('gender', 'm') . '  ' . MALE . '  ' . tep_draw_radio_field('gender', 'f') . '  ' . FEMALE . ' ' . (tep_not_null(ENTRY_GENDER_TEXT) ? '<span class="inputRequirement">' . ENTRY_GENDER_TEXT . '</span>': ''); ?></td>

</tr>

<?php

}

?>

<tr>

<td class="main"><?php echo ENTRY_FIRST_NAME; ?></td>

<td class="main"><?php echo tep_draw_input_field('firstname') . ' ' . (tep_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?></td>

</tr>

<tr>

<td class="main"><?php echo ENTRY_LAST_NAME; ?></td>

<td class="main"><?php echo tep_draw_input_field('lastname') . ' ' . (tep_not_null(ENTRY_LAST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_LAST_NAME_TEXT . '</span>': ''); ?></td>

</tr>

<?php

if (ACCOUNT_DOB == 'true') {

?>

<tr>

<td class="main"><?php echo ENTRY_DATE_OF_BIRTH; ?></td>

<td class="main"><?php echo tep_draw_input_field('dob') . ' ' . (tep_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '<span class="inputRequirement">' . ENTRY_DATE_OF_BIRTH_TEXT . '</span>': ''); ?></td>

</tr>

<?php

}

?>

<tr>

<td class="main"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>

<td class="main"><?php echo tep_draw_input_field('email_address') . ' ' . (tep_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>': ''); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<?php

if (ACCOUNT_COMPANY == 'true') {

?>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td class="main"><b><?php echo CATEGORY_COMPANY; ?></b></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" cellspacing="2" cellpadding="2">

<tr>

<td class="main"><?php echo ENTRY_COMPANY; ?></td>

<td class="main"><?php echo tep_draw_input_field('company') . ' ' . (tep_not_null(ENTRY_COMPANY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COMPANY_TEXT . '</span>': ''); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<?php

}

?>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td class="main"><b><?php echo CATEGORY_ADDRESS; ?></b></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" cellspacing="2" cellpadding="2">

<tr>

<td class="main"><?php echo ENTRY_STREET_ADDRESS; ?></td>

<td class="main"><?php echo tep_draw_input_field('street_address') . ' ' . (tep_not_null(ENTRY_STREET_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_STREET_ADDRESS_TEXT . '</span>': ''); ?></td>

</tr>

<?php

if (ACCOUNT_SUBURB == 'true') {

?>

<tr>

<td class="main"><?php //echo ENTRY_SUBURB; ?></td>

<td class="main"><?php //echo tep_draw_input_field('suburb') . ' ' . (tep_not_null(ENTRY_SUBURB_TEXT) ? '<span class="inputRequirement">' . ENTRY_SUBURB_TEXT . '</span>': ''); ?></td>

</tr>

<?php

}

?>

<tr>

<td class="main"><?php echo ENTRY_POST_CODE; ?></td>

<td class="main"><?php echo tep_draw_input_field('postcode') . ' ' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>

</tr>

<tr>

<td class="main"><?php echo ENTRY_CITY; ?></td>

<td class="main"><?php echo tep_draw_input_field('city') . ' ' . (tep_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?></td>

</tr>

<?php

if (ACCOUNT_STATE == 'true') {

?>

<tr>

<td class="main"><?php echo ENTRY_STATE; ?></td>

<td class="main">

<?php

if ($process == true) {

if ($entry_state_has_zones == true) {

$zones_array = array();

$zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' order by zone_name");

while ($zones_values = tep_db_fetch_array($zones_query)) {

$zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);

}

echo tep_draw_pull_down_menu('state', $zones_array);

} else {

echo tep_draw_input_field('state');

}

} else {

echo tep_draw_input_field('state');

}

 

if (tep_not_null(ENTRY_STATE_TEXT)) echo ' <span class="inputRequirement">' . ENTRY_STATE_TEXT;

?> </td>

</tr>

<?php

}

?>

<tr>

<td class="main"><?php echo ENTRY_COUNTRY; ?></td>

<td class="main"><?php echo tep_get_country_list('country') . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td class="main"><b><?php echo CATEGORY_CONTACT; ?></b></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" cellspacing="2" cellpadding="2">

<tr>

<td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>

<td class="main"><?php echo tep_draw_input_field('telephone') . ' ' . (tep_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td>

</tr>

<tr>

<td class="main"><?php echo ENTRY_FAX_NUMBER; ?></td>

<td class="main"><?php echo tep_draw_input_field('fax') . ' ' . (tep_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td class="main"><b><?php echo CATEGORY_OPTIONS; ?></b></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" cellspacing="2" cellpadding="2">

<tr>

<td class="main"><?php echo ENTRY_NEWSLETTER; ?></td>

<td class="main"><?php echo tep_draw_checkbox_field('newsletter', '1') . ' ' . (tep_not_null(ENTRY_NEWSLETTER_TEXT) ? '<span class="inputRequirement">' . ENTRY_NEWSLETTER_TEXT . '</span>': ''); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td class="main"><b><?php echo CATEGORY_PASSWORD; ?></b></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" cellspacing="2" cellpadding="2">

<tr>

<td class="main"><?php echo ENTRY_PASSWORD; ?></td>

<td class="main"><?php echo tep_draw_password_field('password') . ' ' . (tep_not_null(ENTRY_PASSWORD_TEXT) ? '<span class="inputRequirement">' . ENTRY_PASSWORD_TEXT . '</span>': ''); ?></td>

</tr>

<tr>

<td class="main"><?php echo ENTRY_PASSWORD_CONFIRMATION; ?></td>

<td class="main"><?php echo tep_draw_password_field('confirmation') . ' ' . (tep_not_null(ENTRY_PASSWORD_CONFIRMATION_TEXT) ? '<span class="inputRequirement">' . ENTRY_PASSWORD_CONFIRMATION_TEXT . '</span>': ''); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<!-- BOC Added for Account Agreement -->

<?php

if (ACCOUNT_AGREEMENT_REQUIRED == 'true') {

?>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td class="main"><b><?php echo ACCOUNT_AGREEMENT; ?></b></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents">

<td><table border="0" cellspacing="2" cellpadding="2">

<tr>

<td class="main"><?php echo tep_draw_checkbox_field('agreement', '1') . ' ' . (tep_not_null(ENTRY_AGREEMENT_TEXT) ? '<span class="inputRequirement">' . ENTRY_AGREEMENT_TEXT . '</span>' . ENTRY_AGREEMENT : ''); ?> </td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

}

?>

<!-- EOC Added for Account Agreement -->

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<!-------------------------------------------------------------------- -->

<!--

VISUAL VERIFY CODE start -->

<tr>

<td class="main"><b><?php echo VISUAL_VERIFY_CODE_CATEGORY; ?></b></td>

</tr>

<tr>

<td class="main"><table width="100%" border="0">

<tr>

<td bgcolor="E9FEFD"><table border="0" cellspacing="2" cellpadding="2">

 

<tr>

<td class="main"><?php

//can replace the following loop with $visual_verify_code = substr(str_shuffle (VISUAL_VERIFY_CODE_CHARACTER_POOL), 0, rand(3,6)); if you have PHP 4.3

$visual_verify_code = "";

for ($i = 1; $i <= rand(3,6); $i++){

$visual_verify_code = $visual_verify_code . substr(VISUAL_VERIFY_CODE_CHARACTER_POOL, rand(0, strlen(VISUAL_VERIFY_CODE_CHARACTER_POOL)-1), 1);

}

$vvcode_oscsid = $HTTP_GET_VARS['osCsid'];

tep_db_query("DELETE FROM " . TABLE_VISUAL_VERIFY_CODE . " WHERE oscsid='" . $vvcode_oscsid . "'");

$sql_data_array = array('oscsid' => $vvcode_oscsid, 'code' => $visual_verify_code);

tep_db_perform(TABLE_VISUAL_VERIFY_CODE, $sql_data_array);

$visual_verify_code = "";

echo('<img src="' . FILENAME_VISUAL_VERIFY_CODE_DISPLAY . '?vvc=' . $vvcode_oscsid . '"');

?></td>

<td class="main"><?php echo VISUAL_VERIFY_CODE_TEXT_INSTRUCTIONS; ?></td>

 

<td class="main"><?php echo tep_draw_input_field('visual_verify_code'); ?></td>

<td class="main"> </td>

</tr>

<tr>

<td colspan="4" class="note"><?php echo VERIFY_REMINDER; ?></td>

</tr>

</table>

</tr>

</table></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<!--

VISUAL VERIFY CODE stop -->

<!-------------------------------------------------------------------- -->

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

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

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table>

</form></td>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

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

<!-- footer_eof //-->

<br>

</td></tr>

</table>

</td></tr></table>

</body>

</html>

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

 

 

#3

ADMIN STEP = 4. where the file is admin/includes/boxes/customers.php

(I don't know where to place the addon, below is my existing one)

 

<?php

/*

$Id: customers.php,v 1.16 2003/07/09 01:18:53 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

?>

<!-- customers //-->

<tr>

<td>

<?php

$heading = array();

$contents = array();

 

$heading[] = array('text' => BOX_HEADING_CUSTOMERS,

'link' => tep_href_link(FILENAME_CUSTOMERS, 'selected_box=customers'));

 

if ($selected_box == 'customers') {

$contents[] = array('text' =>

//Admin begin

// '<a href="' . tep_href_link(FILENAME_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CUSTOMERS_CUSTOMERS . '</a><br>' .

// '<a href="' . tep_href_link(FILENAME_ORDERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CUSTOMERS_ORDERS . '</a>');

tep_admin_files_boxes(FILENAME_CUSTOMERS, BOX_CUSTOMERS_CUSTOMERS) .

tep_admin_files_boxes(FILENAME_ORDERS, BOX_CUSTOMERS_ORDERS));

//Admin end

}

 

$box = new box;

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

?>

</td>

</tr>

<!-- customers_eof //-->

 

 

So please teach me how to make the relevant modification is these 3 files, thank you very much!

Link to comment
Share on other sites

Hi all,

 

And now I have a new problem, everytime, when the order amount is equal or over $1,000, when the customers choose

to redeem the bonus points, after subtracting the points, the order total amount will be $1.00

It is terrible, hahaha.... no matter what original amount it should be, everytime it reaches 4 digit, then the total amount

will be equal to 1.

 

So please someone can help me solve this problem.

 

(one of my customers DID pay $1 for order originally equal to $1,395, <_< )

Link to comment
Share on other sites

Hi all,

 

And now I have a new problem, everytime, when the order amount is equal or over $1,000, when the customers choose

to redeem the bonus points, after subtracting the points, the order total amount will be $1.00

It is terrible, hahaha.... no matter what original amount it should be, everytime it reaches 4 digit, then the total amount

will be equal to 1.

 

So please someone can help me solve this problem.

 

(one of my customers DID pay $1 for order originally equal to $1,395, <_< )

 

I'm having this exact same problem, but I did not realize it was on orders over $1000 until seeing your post. If you find a solution please please please send me a PM.

 

Thanks!

Link to comment
Share on other sites

Hi frankc420,

 

I just find out the "trigger point" by trial and error. And at last I found that when the order amount is $999.9, everything

is okay. But when it reaches $1,000 or above, the problem will occur.

 

Though I am an idiot to computer knowledge, I guess, will it be possible that somewhere in the SQL database, the "place"

to hold the net amount (order total - redemption amount) is only set to have 3 digits before decimal place and 2 digits after

decimal place?

 

I don know what exactly the problems are. So I just throw out my basic instict idea, hope someone can solve this problem!

Many thx!

 

P.S. pls be noted that this problem is not related to the currency you are using. Let me put it in this way:

For example,

I choose HK$ to be the standard currency (let say 10pts = 1HK$) and 1US$ = 7.75 HK$

So this problem will occur when order amount reaches or exceeds HK$1,000

when you switch to US$,

this problem will occur when order amount reaches or exceeds US$129 (but not US$1,000)

This is why I guess there are some restrictions on the sql file.....

Link to comment
Share on other sites

quote]

 

First Sorry I thought my taxes caused problem I was having but no

I used post 1940 and 1942 to get me around bad totals I do not use the coupon thing so not sure if this will help also I found that if I had one total ending in 99 it gave me trouble with my checkout payments page telling me not enough points I just got read of any 99 in the initial price still not sure what causes this

Edited by mightysaviour0826
Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

I am hoping someon ewill be able to help me resolve this issue.

 

Everything seemed to be working fine on the newly installed Points & Rewards modification until I tested it in the checkout process.

 

When you reach the 'Payment Information' page, checkout_payment.php I receive the following error within my website template:

Fatal error: Call to a member function show_total() on a non-object in /home/joeyh/domains/electrec.co.uk/public_html/shoponline/includes/functions/redemptions.php on line 341

 

 

I do not know what may be causing this as redemptions.php is a new file? Any ideas?

 

Thanks in advance.

Link to comment
Share on other sites

  • 4 weeks later...
The PayPal Standard module has been patched to work with the Points module. Check the download area to get the diff. Don't crab to me if it doesn't work! :D

 

The one problem I still have on it is that is deducts the points at the checkout_confirmation.php instead of after you click the Confirm Order button to take you to PayPal's website. So if a customer backs out of the order at the last second the points get deducted when they should not have. Other credit card modules work correctly.

 

Deep Silver...how do I change it to deduct the points after the customer clicks the Confirm Order button?

 

TIA

Link to comment
Share on other sites

Dear Forum,

 

I wil thanks the builder of this great contribution. Points & Rewards. I install it one week ago and everything is working fantastic.

Iám Dutch and have to translate everything so perhaps thats the reason but this is the question.

 

If I order something I will not see the possibility to pay with the Points I have rewarded.

By checking out the program gives me no possibility to pay with Points. Everything else is working fine.

Checked everything including the configuration in the admin.

 

Can somebody help me out. Where can I find the php who is taking care of this?

Whats the filename witch is taking care of this possibility?

 

Thanks

 

Hans Meijer

Link to comment
Share on other sites

  • 2 weeks later...

hi all, i've installed the rewards and points... all seems to be working fine until ->

 

if a customer pays total order with points they are not presented with a download link

 

how does one switch the processed order to processing or delivered so that they can retrieve their download item??

 

*** without using any points to pay the order is processed successfully and download link is available***

 

thanks for giving help

liz

Link to comment
Share on other sites

hi all,

 

 

 

just updated my site and re-installed the points contrib.

 

it gets to the payment info page and im getting this:

 

Parse error: syntax error, unexpected '<' in /clientdata/n5200-2-dynamic/s/i/silkycreations.com.au/www/checkout_payment.php on line 455

 

When i went back and checked the code its actually the rewards points

 

<?php
   $radio_buttons++;
 }

<!-- Points/Rewards Module V2.1rc2a Redeemption box bof -->
<?php
 if ((USE_POINTS_SYSTEM == 'true') && (USE_REDEEM_SYSTEM == 'true')) {
  echo points_selection();
  if (tep_not_null(USE_REFERRAL_SYSTEM) && (tep_count_customer_orders() == 0)) {
	  echo referral_input();
  }
 }
?>
<!-- Points/Rewards Module V2.1rc2a Redeemption box eof -->

// Start - CREDIT CLASS Gift Voucher Contribution
if (tep_session_is_registered('customer_id')) {

 

 

<!-- Points/Rewards Module V2.1rc2a Redeemption box eof --> is actually line 455

 

any ideas? i'd like to get it sorted so i can test the rest of my site

 

thanks

 

Tracy

Link to comment
Share on other sites

i should add that i have CCCG installed and its only on the checkout that its not working....the checkout_payment.php to be exact.

ive followed the combined install instructions and still no luck. im sorta at the point that i would pay someone to do it.

 

I really need to get this going as i have customers waiting to place orders that want to use their point :(

 

also with the paypal standard fix are there any actual install instructions in regards where to place the changes?

Edited by silkvixen
Link to comment
Share on other sites

  • 2 weeks later...

ok its all there and the points redemption option is displaying now but the points arent being taken off the total (even without the coupons)

 

im getting really desperate as clients need to order things.....ANYONE!!!!!!!!!!!!!!!!!!!!!

Link to comment
Share on other sites

hi all,

 

 

 

just updated my site and re-installed the points contrib.

 

it gets to the payment info page and im getting this:

 

Parse error: syntax error, unexpected '<' in /clientdata/n5200-2-dynamic/s/i/silkycreations.com.au/www/checkout_payment.php on line 455

 

When i went back and checked the code its actually the rewards points

 

<?php
   $radio_buttons++;
 }

<!-- Points/Rewards Module V2.1rc2a Redeemption box bof -->
<?php
 if ((USE_POINTS_SYSTEM == 'true') && (USE_REDEEM_SYSTEM == 'true')) {
  echo points_selection();
  if (tep_not_null(USE_REFERRAL_SYSTEM) && (tep_count_customer_orders() == 0)) {
	  echo referral_input();
  }
 }
?>
<!-- Points/Rewards Module V2.1rc2a Redeemption box eof -->

// Start - CREDIT CLASS Gift Voucher Contribution
if (tep_session_is_registered('customer_id')) {

 

 

<!-- Points/Rewards Module V2.1rc2a Redeemption box eof --> is actually line 455

 

any ideas? i'd like to get it sorted so i can test the rest of my site

 

thanks

 

Tracy

 

Hi Tracy,

 

The code you're reffering to is just a code to set up the file redemptions.php. Just take a look at includes/functions/redemptions.php and search for the wrong placed '<'. After deleting that you're problem should be fixed.

 

Marcus

Link to comment
Share on other sites

Hi there,

 

I've got a question about paying shipping by points. I don't want that the customer can use points to pay for shipping. I've got a few orders where the payment is zero euro's. The customers had enough points to pay for the products they want to buy as well as the shipping costs so they didn't have to pay for the orders !

 

I'm fine with the idea that the customer can pay their products with points so that the subtotal is set to 0.00, but I still want the customer to pay for the shipping costs.

 

I've found out in includes/functions/redemptions.php that the line with TEP_CALC_SHOPPING_PVALUE is the one which is presenting the total amount. Does anyone know if it is possible to change this function so that shippings costs are not calculated in this function? I can't seem to find it myself.

 

marcus

Link to comment
Share on other sites

Hey everyone,

 

Im currently trying to get the contribution to work with PayPal Website Payments Standard.

 

I saw the .patch update that was posted on the contribution website but I dont know what to do with it.

 

Does anyone how I am supposed to use the .patch file?

 

...Or did anyone here manage to get everything to work good with PayPal Website Payments Standard some how?

 

Thanks.

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...