Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


Recommended Posts

im having this error, please help me

 

error: Fatal error: Call to undefined function tep_draw_pull_down_menu() in /home/pchardwa/public_html/admin/customers_points.php on line 257

<?php
/*
 $Id: customers_points.php, v 2.00 2006/JULY/07 09:00:46 dsa_ Exp $
 created by Ben Zukrel, Deep Silver Accessories
 http://www.deep-silver.com

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2005 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();

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


 if (tep_not_null($action)) {
switch ($action) {
  case 'addconfirm':
	$customers_id = tep_db_prepare_input($HTTP_GET_VARS['cID']);
	$pointstoadd = tep_db_prepare_input($HTTP_POST_VARS['points_to_add']);
	$comment = tep_db_prepare_input($HTTP_POST_VARS['comment']);

	$points_added = false;
	if ($pointstoadd > 0) {
	  if (isset($HTTP_POST_VARS['set_exp']) && ($HTTP_POST_VARS['set_exp'] == 'on')) {
		$expire  = date('Y-m-d', strtotime('+ '. POINTS_AUTO_EXPIRES .' month'));
		$expire_date = "\n" . sprintf(EMAIL_TEXT_EXPIRE, tep_date_short($expire));
		tep_db_query("UPDATE " . TABLE_CUSTOMERS . " SET customers_shopping_points = customers_shopping_points + '". $pointstoadd ."', customers_points_expires = '". $expire ."' WHERE customers_id = '". (int)$customers_id ."'");
	  } else {
		tep_db_query("UPDATE " . TABLE_CUSTOMERS . " SET customers_shopping_points = customers_shopping_points + '". $pointstoadd ."' WHERE customers_id = '". (int)$customers_id ."'");
		$expire_date = "\n" . sprintf(EMAIL_TEXT_EXPIRE, tep_date_short($HTTP_POST_VARS['customers_points_expires']));
	  }

	  $customer_notified = '0';
	  if (isset($HTTP_POST_VARS['notify']) && ($HTTP_POST_VARS['notify'] == 'on')) {
		$balance = ($HTTP_POST_VARS['customers_shopping_points'] + $pointstoadd);
		$customer_balance = sprintf(EMAIL_TEXT_BALANCE, number_format($balance,POINTS_DECIMAL_PLACES), $currencies->format($balance * REDEEM_POINT_VALUE));
		$gender = $HTTP_POST_VARS['customers_gender'];
		$first_name = $HTTP_POST_VARS['customers_firstname'];
		$last_name = $HTTP_POST_VARS['customers_lastname'];
		$name = $first_name . ' ' . $last_name;

		$notify_comment = '';
		if (isset($HTTP_POST_VARS['comment']) && tep_not_null($comment)) {
		  $notify_comment = sprintf(EMAIL_TEXT_COMMENT, $comment) . "\n";
		}

		if (ACCOUNT_GENDER == 'true') {
		  if ($gender == 'm') {
			$greet = sprintf(EMAIL_GREET_MR, $last_name);
		  } else {
			$greet = sprintf(EMAIL_GREET_MS, $last_name);
		  }
		} else {
			$greet = sprintf(EMAIL_GREET_NONE, $first_name);
		}
		if (tep_not_null(POINTS_AUTO_EXPIRES)){
		  $points_expire_date = $expire_date;
		}
		$can_use = "\n\n" . EMAIL_TEXT_SUCCESS_POINTS;
		$email_text = $greet  . "\n" . EMAIL_TEXT_INTRO . "\n" . sprintf(EMAIL_TEXT_BALANCE_ADD, $pointstoadd, $currencies->format($pointstoadd * REDEEM_POINT_VALUE)) . "\n" . $notify_comment . $customer_balance  . $points_expire_date . "\n\n" . sprintf(EMAIL_TEXT_POINTS_URL, tep_catalog_href_link(FILENAME_CATALOG_MY_POINTS, '', 'SSL')) . "\n\n" . sprintf(EMAIL_TEXT_POINTS_URL_HELP, tep_catalog_href_link(FILENAME_CATALOG_MY_POINTS_HELP, '', 'NONSSL')) . $can_use . "\n" . EMAIL_CONTACT . "\n" . EMAIL_SEPARATOR . "\n" . '<b>' . STORE_NAME . '</b>.' . "\n";

		tep_mail($name, $customers_email_address, EMAIL_TEXT_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

		$customer_notified = '1';
		$messageStack->add_session(sprintf(NOTICE_EMAIL_SENT_TO, $name . '(' . $customers_email_address . ').'), 'success');
	  }

	  $database_queue = '0';
	  if (isset($HTTP_POST_VARS['queue_add']) && ($HTTP_POST_VARS['queue_add'] == 'on')) {

		 $sql_data_array = array('unique_id' => '',
						'customer_id' => (int)$customers_id,
						'orders_id' => 0,
						'points_comment' => $comment,
						'points_pending' => $pointstoadd,
						'date_added' => 'now()',
						'points_status' => 2);

		   tep_db_perform(TABLE_CUSTOMERS_POINTS_PENDING, $sql_data_array);
	  $database_queue = '1';
	  $messageStack->add_session(SUCCESS_DATABASE_UPDATED, 'success');
	  }
	  $points_added = true;
	}
	if ($points_added == true) {
	 $messageStack->add_session(SUCCESS_POINTS_UPDATED, 'success');
	} else {
	  $messageStack->add_session(WARNING_DATABASE_NOT_UPDATED, 'warning');
	}
	tep_redirect(tep_href_link(FILENAME_CUSTOMERS_POINTS, tep_get_all_get_params(array('oID', 'action'))));
	break;
  case 'delconfirm':
	$customers_id = tep_db_prepare_input($HTTP_GET_VARS['cID']);
	$pointstodel = tep_db_prepare_input($HTTP_POST_VARS['points_to_delete']);
	$comment = tep_db_prepare_input($HTTP_POST_VARS['comment']);
	$balance = $HTTP_POST_VARS['customers_shopping_points'] - $pointstodel;

	$points_deleted = false;
	if ($pointstodel > 0) {
	  if (isset($HTTP_POST_VARS['set_exp']) && ($HTTP_POST_VARS['set_exp'] == 'on')) {
		$expire  = date('Y-m-d', strtotime('+ '. POINTS_AUTO_EXPIRES .' month'));
		$exp = ($balance > 0) ? $expire : 'NULL';
		$expire_date = "\n" . sprintf(EMAIL_TEXT_EXPIRE, tep_date_short($expire));
		tep_db_query("UPDATE " . TABLE_CUSTOMERS . " SET customers_shopping_points = customers_shopping_points - '". $pointstodel ."', customers_points_expires = '". $exp ."' WHERE customers_id = '". (int)$customers_id ."'");
	  } else {
		tep_db_query("UPDATE " . TABLE_CUSTOMERS . " SET customers_shopping_points = customers_shopping_points - '". $pointstodel ."' WHERE customers_id = '". (int)$customers_id ."'");
		$expire_date = "\n" . sprintf(EMAIL_TEXT_EXPIRE, tep_date_short($HTTP_POST_VARS['customers_points_expires']));
	  }

	  $customer_notified = '0';

	  if (isset($HTTP_POST_VARS['notify']) && ($HTTP_POST_VARS['notify'] == 'on')) {
		$gender = $HTTP_POST_VARS['customers_gender'];
		$first_name = $HTTP_POST_VARS['customers_firstname'];
		$last_name = $HTTP_POST_VARS['customers_lastname'];
		$name = $first_name . ' ' . $last_name;

		$notify_comment = '';
		if (isset($HTTP_POST_VARS['comment']) && tep_not_null($comment)) {
		  $notify_comment = sprintf(EMAIL_TEXT_COMMENT, $comment) . "\n";
		}

		if (ACCOUNT_GENDER == 'true') {
		  if ($gender == 'm') {
			$greet = sprintf(EMAIL_GREET_MR, $last_name);
		  } else {
			$greet = sprintf(EMAIL_GREET_MS, $last_name);
		  }
		} else {
			$greet = sprintf(EMAIL_GREET_NONE, $first_name);
		}

		if ($balance> 0) {
		  $customer_balance = sprintf(EMAIL_TEXT_BALANCE, number_format($balance,POINTS_DECIMAL_PLACES), $currencies->format($balance * REDEEM_POINT_VALUE));
		  $can_use = "\n\n" . EMAIL_TEXT_SUCCESS_POINTS;
		}
		if (tep_not_null(POINTS_AUTO_EXPIRES)){
		  $points_expire_date = $expire_date;
		}

		$email_text = $greet  . "\n" . EMAIL_TEXT_INTRO . "\n" . sprintf(EMAIL_TEXT_BALANCE_DEL, $pointstodel, $currencies->format($pointstodel * REDEEM_POINT_VALUE)) . "\n" . $notify_comment . $customer_balance  . $points_expire_date . "\n\n" . sprintf(EMAIL_TEXT_POINTS_URL, tep_catalog_href_link(FILENAME_CATALOG_MY_POINTS, '', 'SSL')) . "\n\n" . sprintf(EMAIL_TEXT_POINTS_URL_HELP, tep_catalog_href_link(FILENAME_CATALOG_MY_POINTS_HELP, '', 'NONSSL')) . $can_use . "\n" . EMAIL_CONTACT . "\n" . EMAIL_SEPARATOR . "\n" . '<b>' . STORE_NAME . '</b>.' . "\n";

		tep_mail($name, $customers_email_address, EMAIL_TEXT_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

		$customer_notified = '1';
		$messageStack->add_session(sprintf(NOTICE_EMAIL_SENT_TO, $name . '(' . $customers_email_address . ').'), 'success');
	  }

	  $database_queue = '0';
	  if (isset($HTTP_POST_VARS['queue_add']) && ($HTTP_POST_VARS['queue_add'] == 'on')) {

		$sql_data_array = array('unique_id' => '',
						'customer_id' => $customers_id,
						'orders_id' => 0,
						'points_comment' => $comment,
						'points_pending' => -$pointstodel,
						'date_added' => 'now()',
						'points_status' => 3);

		tep_db_perform(TABLE_CUSTOMERS_POINTS_PENDING, $sql_data_array);
	  $database_queue = '1';
	  $messageStack->add_session(SUCCESS_DATABASE_UPDATED, 'success');
	  }
	  $points_added = true;
	}
	if ($points_added == true) {
	 $messageStack->add_session(SUCCESS_POINTS_UPDATED, 'success');
	} else {
	  $messageStack->add_session(WARNING_DATABASE_NOT_UPDATED, 'warning');
	}
	tep_redirect(tep_href_link(FILENAME_CUSTOMERS_POINTS, tep_get_all_get_params(array('oID', 'action'))));
	break;
 case 'adjustpoints':
	$customers_id = tep_db_prepare_input($HTTP_GET_VARS['cID']);
	$adjust = tep_db_prepare_input($HTTP_POST_VARS['points_to_aj']);

	if ($adjust >=0) {
	  if (isset($HTTP_POST_VARS['set_exp']) && ($HTTP_POST_VARS['set_exp'] == 'on')) {
		$exp = ($adjust > 0) ? "DATE_ADD(NOW(),INTERVAL '". (int)POINTS_AUTO_EXPIRES ."' MONTH)" : 'NULL';
		tep_db_query("UPDATE " . TABLE_CUSTOMERS . " SET customers_shopping_points = '". $adjust ."', customers_points_expires = $exp WHERE customers_id = '". (int)$customers_id ."'");
	  } else {
		tep_db_query("UPDATE " . TABLE_CUSTOMERS . " SET customers_shopping_points = '". $adjust ."' WHERE customers_id = '". (int)$customers_id ."'");
	  }
	}
	tep_redirect(tep_href_link(FILENAME_CUSTOMERS_POINTS, tep_get_all_get_params(array('oID', 'action'))));
	break;
}
 }

//drop-down filter array
 $filter_array = array( array('id' => '1', 'text' => TEXT_SHOW_ALL),
							   array('id' => '2', 'text' => TEXT_SORT_POINTS),
							   array('id' => '3', 'text' => TEXT_SORT_NO_POINTS),
							   array('id' => '4', 'text' => TEXT_SORT_BIRTH),
							   array('id' => '5', 'text' => TEXT_SORT_BIRTH_NEXT),
							   array('id' => '6', 'text' => TEXT_SORT_EXPIRE),
							   array('id' => '7', 'text' => TEXT_SORT_EXPIRE_NEXT),
							   array('id' => '8', 'text' => TEXT_SORT_EXPIRE_WIN));

 $point_or_points = ((POINTS_PER_AMOUNT_PURCHASE > 1) ? HEADING_POINTS : HEADING_POINT);
?>
<!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>
<script language="javascript"><!--
function validate(field) {
 var valid = "0123456789."
 var ok = "yes";
 var temp;
for (var i=0; i<field.value.length; i++) {
 temp = "" + field.value.substring(i, i+1);
 if (valid.indexOf(temp) == "-1") ok = "no";
 }
 if (ok == "no") {
alert("<?php echo POINTS_ENTER_JS_ERROR; ?>");
field.focus();
field.value = "";
 }
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onLoad="SetFocus();">
<!-- 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 . '<br /><span class="smallText">' . HEADING_RATE . '   ' .  HEADING_AWARDS . $currencies->format(1) . ' = ' . number_format(POINTS_PER_AMOUNT_PURCHASE,POINTS_DECIMAL_PLACES) .' ' . $point_or_points . '   ' . HEADING_REDEEM  .  number_format(POINTS_PER_AMOUNT_PURCHASE,POINTS_DECIMAL_PLACES) . ' ' . $point_or_points . ' = ' . $currencies->format(POINTS_PER_AMOUNT_PURCHASE * REDEEM_POINT_VALUE); ?></td>
		<td align="right"><table border="0" width="100%" cellspacing="0" cellpadding="0"><?php echo tep_draw_form('orders', FILENAME_CUSTOMERS_POINTS, '', 'get'); ?>
		<td class="smallText" align="right"><?php echo HEADING_TITLE_SEARCH . ' ' . tep_draw_input_field('search'); ?></td>
		  </form>
		  <tr><?php echo tep_draw_form('status', FILENAME_CUSTOMERS_POINTS, '', 'get'); ?>
			<td class="smallText" align="right"><?php echo ' '. TEXT_SORT_CUSTOMERS . ': '. tep_draw_pull_down_menu('filter', $filter_array, '', 'onChange="this.form.submit();"'); ?></td>
		  </form></tr>			
		</table></td>
	  </tr>
	</table></td>
  </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"><a href="<?php echo "$PHP_SELF?viewedSort=lastname-asc"; ?>"title="<?php echo TABLE_HEADING_SORT . TABLE_HEADING_LASTNAME . TABLE_HEADING_SORT_UA; ?>">+</a> <?php echo TABLE_HEADING_LASTNAME; ?> <a href="<?php echo "$PHP_SELF?viewedSort=lastname-desc"; ?>"title="<?php echo TABLE_HEADING_SORT . TABLE_HEADING_LASTNAME . TABLE_HEADING_SORT_DA; ?>">-</a></td>
			<td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?viewedSort=firstname-asc"; ?>"title="<?php echo TABLE_HEADING_SORT . TABLE_HEADING_FIRSTNAME . TABLE_HEADING_SORT_UA; ?>">+</a> <?php echo TABLE_HEADING_FIRSTNAME; ?> <a href="<?php echo "$PHP_SELF?viewedSort=firstname-desc"; ?>"title="<?php echo TABLE_HEADING_SORT . TABLE_HEADING_FIRSTNAME . TABLE_HEADING_SORT_DA; ?>">-</a></td>
			<td class="dataTableHeadingContent"><a href="<?php echo "$PHP_SELF?viewedSort=date-asc"; ?>"title="<?php echo TABLE_HEADING_SORT . TABLE_HEADING_DOB . TABLE_HEADING_SORT_U1; ?>">+</a> <?php echo TABLE_HEADING_DOB; ?> <a href="<?php echo "$PHP_SELF?viewedSort=date-desc"; ?>"title="<?php echo TABLE_HEADING_SORT . TABLE_HEADING_DOB . TABLE_HEADING_SORT_D1; ?>">-</a></td>
			<td class="dataTableHeadingContent" align="right"><a href="<?php echo "$PHP_SELF?viewedSort=points-asc"; ?>"title="<?php echo TABLE_HEADING_SORT . TABLE_HEADING_POINTS . TABLE_HEADING_SORT_U1; ?>">+</a> <?php echo TABLE_HEADING_POINTS; ?> <a href="<?php echo "$PHP_SELF?viewedSort=poinst-desc"; ?>"title="<?php echo TABLE_HEADING_SORT . TABLE_HEADING_POINTS . TABLE_HEADING_SORT_D1; ?>">-</a></td>				
			<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_POINTS_VALUE; ?></td>
			<td class="dataTableHeadingContent" align="right"><a href="<?php echo "$PHP_SELF?viewedSort=expires-asc"; ?>"title="<?php echo TABLE_HEADING_SORT . TABLE_HEADING_POINTS_EXPIRES . TABLE_HEADING_SORT_U1; ?>">+</a> <?php echo TABLE_HEADING_POINTS_EXPIRES; ?> <a href="<?php echo "$PHP_SELF?viewedSort=expires-desc"; ?>"title="<?php echo TABLE_HEADING_SORT . TABLE_HEADING_POINTS_EXPIRES . TABLE_HEADING_SORT_D1; ?>">-</a></td>
			<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
		  </tr>
<?php
$search = '';
if (isset($HTTP_GET_VARS['search']) && tep_not_null($HTTP_GET_VARS['search'])) {
  $keywords = tep_db_input(tep_db_prepare_input($HTTP_GET_VARS['search']));
  $search = "WHERE customers_id LIKE '%" . $keywords . "%' OR customers_lastname LIKE '%" . $keywords . "%' OR customers_firstname LIKE '%" . $keywords . "%' OR customers_points_expires LIKE '%" . date("Y-". $keywords) . "%'";
}

$filter = $HTTP_GET_VARS['filter'];
switch ($filter) {
 case '1':
$filter = '';
break;
 case '2':
$filter = "WHERE customers_shopping_points > 0";
break;
 case '3':
$filter = "WHERE customers_shopping_points = 0";
break;
 case '4':
$filter = "WHERE MONTH(customers_dob) = MONTH(DATE_ADD(NOW(),INTERVAL 0 MONTH))";
break;
 case '5':
$filter = "WHERE MONTH(customers_dob) = MONTH(DATE_ADD(NOW(),INTERVAL 1 MONTH))";
break;
 case '6':
$filter = "WHERE customers_points_expires LIKE '%" . date('Y-m') . "%'";
break;
 case '7':
$filter = "WHERE customers_points_expires LIKE '%" . date('Y-m', strtotime('+ 1 month')) . "%'";
break;
 case '8':
$filter = "WHERE customers_points_expires = DATE_ADD(NOW(),INTERVAL 1 MONTH)";
break;
}

//sort view  bof  
  if (isset($HTTP_GET_VARS['viewedSort'])){
 $viewedSort = $HTTP_GET_VARS['viewedSort'];
 tep_session_register('viewedSort');
  }
  if (isset($HTTP_GET_VARS['page']))
  {
 $page = $HTTP_GET_VARS['page'];
 tep_session_register('page');
  }
  if(!isset($page)) $page = 1;

  switch ($viewedSort) {
   case "lastname-asc":
	 $sort .= "customers_lastname";
   break;
   case "lastname-desc":
	 $sort .= "customers_lastname DESC";
   break;
   case "firstname-asc":
	 $sort .= "customers_firstname";
   break;
   case "firstname-desc":
	 $sort .= "customers_firstname DESC";
   break;
   case "date-asc":
	 $sort .= "customers_dob";
   break;
   case "date-desc":
	 $sort .= "customers_dob DESC";
   break;
   case "points-asc":
	 $sort .= "customers_shopping_points";
   break;
   case "points-desc":
	 $sort .= "customers_shopping_points DESC";
   break;
   case "expires-asc":
	 $sort .= "customers_points_expires";
   break;
   case "expires-desc":
	 $sort .= "customers_points_expires DESC";
   break;
	default:
	$sort .= "customers_lastname ASC";
  }
//sort view  bof

  $customers_query_raw = "SELECT customers_id, customers_gender, customers_lastname, customers_firstname, customers_dob, customers_email_address, customers_shopping_points, customers_points_expires from " . TABLE_CUSTOMERS . " " . $search . " " . $filter . " ORDER BY $sort";
  $customers_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $customers_query_raw, $customers_query_numrows);
  $customers_query = tep_db_query($customers_query_raw);

  while ($customers = tep_db_fetch_array($customers_query)) {
 $info_query = tep_db_query("SELECT SUM(op.products_quantity * op.final_price) AS ordersum FROM " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS . " o WHERE customers_id = '" . (int)$customers['customers_id'] . "' AND o.orders_id = op.orders_id GROUP BY customers_id ");
 $info = tep_db_fetch_array($info_query);

 if ((!isset($HTTP_GET_VARS['cID']) || (isset($HTTP_GET_VARS['cID']) && ($HTTP_GET_VARS['cID'] == $customers['customers_id']))) && !isset($cInfo)) {
   $pending_query = tep_db_query("SELECT SUM(points_pending) AS pending_total FROM " . TABLE_CUSTOMERS_POINTS_PENDING . " WHERE points_status = 1 AND customer_id = '" . (int)$customers['customers_id'] . "'");
   $pending = tep_db_fetch_array($pending_query);

   if (is_array($info)) { 
	$cInfo_array = array_merge($customers, $pending, $info);
   } else {
	 $cInfo_array = array_merge($customers, $pending);
   }
	$cInfo = new objectInfo($cInfo_array);
  }

  if (isset($cInfo) && is_object($cInfo) && ($customers['customers_id'] == $cInfo->customers_id)) {
	echo '<tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CUSTOMERS_POINTS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=edit') . '\'">' . "\n";
  } else {
	echo '<tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CUSTOMERS_POINTS, tep_get_all_get_params(array('cID')) . 'cID=' . $customers['customers_id']) . '\'">' . "\n";
  }
?>
			<td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_ORDERS, 'cID=' . $cInfo->customers_id) . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a> ' . $customers['customers_lastname']; ?></td>
			<td class="dataTableContent"><?php echo $customers['customers_firstname']; ?></td>
			<td class="dataTableContent"><?php echo tep_date_short($customers['customers_dob']); ?></td>
			<td class="dataTableContent" align="right"><?php echo number_format($customers['customers_shopping_points'],POINTS_DECIMAL_PLACES); ?></td>
			<td class="dataTableContent" align="right"><?php if ($customers['customers_shopping_points'] > 0) echo $currencies->format($customers['customers_shopping_points'] * REDEEM_POINT_VALUE); ?></td>
			<td class="dataTableContent" align="right"><?php if ($customers['customers_points_expires'] > 0) echo tep_date_short($customers['customers_points_expires']); ?></td>
			<td class="dataTableContent" align="right"><?php if (isset($cInfo) && is_object($cInfo) && ($customers['customers_id'] == $cInfo->customers_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_CUSTOMERS_POINTS, tep_get_all_get_params(array('cID')) . 'cID=' . $customers['customers_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
		  </tr>
<?php
}
?>
		  <tr>
			<td colspan="7"><table border="0" width="100%" cellspacing="0" cellpadding="2">
			  <tr>
				<td class="smallText" valign="top"><?php echo $customers_split->display_count($customers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_CUSTOMERS); ?></td>
				<td class="smallText" align="right"><?php echo $customers_split->display_links($customers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y', 'cID'))); ?></td>
			  </tr>
<!-- Yes, you may remove this advertising clause. //-->
			  <tr>
				<td class="smallText" align="center"><br><br><?php echo TEXT_LINK_CREDIT . '<br><br>POINTS AND REWARDS MODULE V' . MOD_VER; ?>  <a href="http://www.deep-silver.com" target="_blank">Copyright © Deep Silver Accessory</a></td>
			  </tr>
<!-- advertising_eof //-->
<?php
if (isset($HTTP_GET_VARS['search']) && tep_not_null($HTTP_GET_VARS['search'])) {
?>
			  <tr>
				<td align="right" colspan="2"><?php echo '<a href="' . tep_href_link(FILENAME_CUSTOMERS_POINTS) . '">' . tep_image_button('button_reset.gif', IMAGE_RESET) . '</a>'; ?></td>
			  </tr>
<?php
}
?>
			</table></td>
		  </tr>
		</table></td>
<?php
 $heading = array();
 $contents = array();

 switch ($action) {
case 'addpoints':
  $heading[] = array('text' => '<b>' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . '</b>');

  $contents = array('form' => tep_draw_form('customers', FILENAME_CUSTOMERS_POINTS, tep_get_all_get_params() . 'cID=' . $cInfo->customers_id . '&action=addconfirm'));
  $value_field = '<b>'. TEXT_ADD_POINTS . '</b><br>'. TEXT_ADD_POINTS_LONG . '<br><br>' . TEXT_POINTS_TO_ADD . '<br>'. tep_draw_input_field('points_to_add', '' , 'onBlur="validate(this)"');
  $contents[] = array('text' => $value_field);	  
  $value_field = TEXT_COMMENT. '<br>'. tep_draw_input_field('comment', 0);
  $contents[] = array('text' => $value_field);
  $contents[] = array('text' => tep_draw_checkbox_field('notify', '', true) . ' ' . TEXT_NOTIFY_CUSTOMER);
  if (tep_not_null(POINTS_AUTO_EXPIRES)){
	$contents[] = array('text' => tep_draw_checkbox_field('set_exp', '', true) . ' ' . TEXT_SET_EXPIRE);
  }
  $contents[] = array('text' => tep_draw_checkbox_field('queue_add') . ' ' . TEXT_QUEUE_POINTS_TABLE);
  $contents[] = array('text' => tep_draw_hidden_field('customers_firstname', $cInfo->customers_firstname) . tep_draw_hidden_field('customers_lastname', $cInfo->customers_lastname) . tep_draw_hidden_field('customers_gender', $cInfo->customers_gender) . tep_draw_hidden_field('customers_email_address', $cInfo->customers_email_address) . tep_draw_hidden_field('customers_shopping_points', $cInfo->customers_shopping_points) . tep_draw_hidden_field('customers_points_expires', $cInfo->customers_points_expires));

  $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_add_points.gif', BUTTON_TEXT_ADD_POINTS) . ' <a href="' . tep_href_link(FILENAME_CUSTOMERS_POINTS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  break;
case 'adjust':
  $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_ADJUST_POINTS . '</b>');

  $contents = array('form' => tep_draw_form('points', FILENAME_CUSTOMERS_POINTS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=adjustpoints'));
  $contents[] = array('text' => '<b>'. TEXT_INFO_HEADING_ADJUST_POINTS . '</b><br>');
  $value_field = TEXT_ADJUST_INTRO . '<br><br>' . TEXT_POINTS_TO_ADJUST . '<br>'. tep_draw_input_field('points_to_aj', '' , 'onBlur="validate(this)"');
  $contents[] = array('text' => $value_field); 
  if (tep_not_null(POINTS_AUTO_EXPIRES)){
	$contents[] = array('text' => tep_draw_checkbox_field('set_exp', '', false) . ' ' . TEXT_SET_EXPIRE);
  }

  $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_adjust_points.gif', BUTTON_TEXT_ADJUST_POINTS) . ' <a href="' . tep_href_link(FILENAME_CUSTOMERS_POINTS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  break;
case 'deletepoints':
  $heading[] = array('text' => '<b>' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . '</b>');

  $contents = array('form' => tep_draw_form('customers', FILENAME_CUSTOMERS_POINTS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=delconfirm'));
  $value_field = '<b>'. TEXT_DELETE_POINTS . '</b><br>'. TEXT_DELETE_POINTS_LONG . '<br><br>' . TEXT_POINTS_TO_DELETE . '<br>'. tep_draw_input_field('points_to_delete', '' , 'onBlur="validate(this)"');
  $contents[] = array('text' => $value_field);
  $value_field = TEXT_COMMENT. '<br>'. tep_draw_input_field('comment', 0);
  $contents[] = array('text' => $value_field);
  $contents[] = array('text' => tep_draw_checkbox_field('queue_delete') . ' ' . TEXT_QUEUE_POINTS_TABLE);
  $contents[] = array('text' => tep_draw_checkbox_field('notify', '', true) . ' ' . TEXT_NOTIFY_CUSTOMER);
  if (tep_not_null(POINTS_AUTO_EXPIRES)){
	$contents[] = array('text' => tep_draw_checkbox_field('set_exp', '', true) . ' ' . TEXT_SET_EXPIRE);
  }
  $contents[] = array('text' => tep_draw_hidden_field('customers_firstname', $cInfo->customers_firstname) . tep_draw_hidden_field('customers_lastname', $cInfo->customers_lastname) . tep_draw_hidden_field('customers_gender', $cInfo->customers_gender) . tep_draw_hidden_field('customers_email_address', $cInfo->customers_email_address) . tep_draw_hidden_field('customers_shopping_points', $cInfo->customers_shopping_points) . tep_draw_hidden_field('customers_points_expires', $cInfo->customers_points_expires));	  

  $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete_points.gif', BUTTON_TEXT_DELETE_POINTS) . ' <a href="' . tep_href_link(FILENAME_CUSTOMERS_POINTS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  break;
default:
  if (isset($cInfo) && is_object($cInfo)) {
	$heading[] = array('text' => '<b>' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . '</b>');

if ($cInfo->customers_shopping_points > 0) {
	$contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CUSTOMERS_POINTS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=addpoints') . '">' . tep_image_button('button_add_points.gif', BUTTON_TEXT_ADD_POINTS) . '</a> <a href="' . tep_href_link(FILENAME_CUSTOMERS_POINTS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=deletepoints') . '">' . tep_image_button('button_delete_points.gif', BUTTON_TEXT_DELETE_POINTS) . '</a> <a href="' . tep_href_link(FILENAME_CUSTOMERS_POINTS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=adjust') . '">' . tep_image_button('button_adjust_points.gif', BUTTON_TEXT_ADJUST_POINTS) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS, 'cID=' . $cInfo->customers_id) . '">' . tep_image_button('button_orders.gif', IMAGE_ORDERS) . '</a> <a href="' . tep_href_link(FILENAME_MAIL, 'selected_box=tools&customer=' . $cInfo->customers_email_address) . '">' . tep_image_button('button_email.gif', IMAGE_EMAIL) . '</a>');
 } else {
	$contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_CUSTOMERS_POINTS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=addpoints') . '">' . tep_image_button('button_add_points.gif', BUTTON_TEXT_ADD_POINTS) . '</a> <a href="' . tep_href_link(FILENAME_CUSTOMERS_POINTS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=adjust') . '">' . tep_image_button('button_adjust_points.gif', BUTTON_TEXT_ADJUST_POINTS) . '</a> <a href="' . tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS, 'cID=' . $cInfo->customers_id) . '">' . tep_image_button('button_orders.gif', IMAGE_ORDERS) . '</a> <a href="' . tep_href_link(FILENAME_MAIL, 'selected_box=tools&customer=' . $cInfo->customers_email_address) . '">' . tep_image_button('button_email.gif', IMAGE_EMAIL) . '</a>');
   }
	$contents[] = array('text' => '<br>' . TEXT_INFO_NUMBER_OF_ORDERS . ' ' . $currencies->format($cInfo->ordersum));
	$contents[] = array('text' => TEXT_INFO_NUMBER_OF_PENDING . ' ' . number_format($cInfo->pending_total,POINTS_DECIMAL_PLACES));
  }
  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 //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

I have installed this wonderful :D contribution and it works seamlessly with all of the many other contributions I have installed (too many to list here) I am also using CCGV (Trad) and Customer Testimonials 3 http://addons.oscommerce.com/info/5477. My question, or actually request, is: what steps do I need to take to integrate this into customer testimonials 3. Although giving points for referrals and reviews helps .... I feel points for testimonials would help me even more .... if a new customer comes to the site, and sees a testimonial ranting and raving about us, they are more likely to be impressed than if they look at a review and see a previous customer gave it 5 stars. I am totally new to php, and just launched my new site today. Any help with this would be greatly appreciated.

Link to comment
Share on other sites

  • 2 weeks later...
I have looked in this whole forum 75 pages long. There are a lot people who got problems with globals on/off, and with the same problem you descriped above. Me too!

 

Do you or somebody else in this forum got a solution for this problem?

 

Hi everyone,

 

I too am having the problem where the points are not being deducted from the user's account once they are used to pay for the order.

 

Also, although I see the confirmation screen showing that the points have been applied, I do not see anything regarding the points on the order area of the admin or on the email that gets sent to the customer. I have not put in any payment modules other than the standrd payment modules included in osCommerce.

 

Has anyone been able to solve these issues?

 

Thanks in advance!

Link to comment
Share on other sites

The problem I have is the points value are deduct from the store BUT they are not deducted from the amount of the PayPal payment. In other words, if the order is for $10.00 minus $1.00 points redemption the PayPay payment is for $10.00 and not $9.00 as it should be. Loses a lot of business with this problem. Anyone else have this problem or know how to fix it?

 

 

I had the exact same error. To FIX I did the following: Go to Modules -> Order Total. Set the Sort Order to the following: Total = 5, Points Redemptions = 4, Tax = 3, Shipping = 2, Subtotal = 1. Make sure Total is the last (highest) number. May need to experiment a little with the sort order but this is the basic structure you need.

 

Cheers

Link to comment
Share on other sites

Is their anyway I can just show the total points in my accounts because when I copy everything their it's just breaking up the accounts.php any information?

i use this to post the balance in the cart, should work globally:

echo $currencies->format(tep_calc_shopping_pvalue($shopping_points));

 

it displays the points in dollar value

Link to comment
Share on other sites

how does this work:

 		if (tep_not_null(RESTRICTION_PATH))   
	  for ($i=0; $i<sizeof($order->products); $i++) {
		 $cat_ids = split("[,]", RESTRICTION_PATH);
		 $sub_cat_ids = split("[_]", tep_get_product_path($order->products[$i]['id']));
		   for ($iii = 0; $iii < count($sub_cat_ids); $iii++) {
			  for ($ii = 0; $ii < count($cat_ids); $ii++) {
				 if ($sub_cat_ids[$iii] == $cat_ids[$ii]) {

				   return true;
			  }
		   }
		}
		}
	return false;

  }

 

 

i would like to STOP customers from getting the points taken off of items in a certain category (but this category has HUNDREDS of sub-categories).

 

can i do it with this code?

 

i pasted the cat. # in the restriction table in admin, but it's still giving me a discount for items in this category.

Link to comment
Share on other sites

hello I just installed this contribution.

and I get this error.

 

I went over the install directions and can't find an answer..

can anyone help. I uploaded the lastest version

 

Fatal error: Call to undefined function: calculate_price() in /home/hera/public_html/shop/includes/classes/shopping_cart.php on line 272

 

thank you

noppie

Link to comment
Share on other sites

anyone using paypal ipn v2.3 & getting errors or miscalculation, here's why:

There were shipping & tax problems in "per item" mode before v2.3, so the new version is developed to solve the problem. Prior to v2.3, the order amounts are acquired from $order->info['total'], which doesn't have all details needed for "per item" mode.

 

...it's developed for "per item" mode, not aggregate. which this contribution needs to process the deductions properly.

 

posted by alexstudio: http://www.oscommerce.com/forums/index.php?sho...&start=3520 (who authored this version of ipn)

 

the newest version of ipn that seems to work with points & rewards is v2.2 by terra. i've been using it on my shop for a few days, without any problems. (you still need to do the patch from v1.3 that's included in the install package if you upgrade from v1.3)

Edited by eww
Link to comment
Share on other sites

  • 3 weeks later...

I have 2.0d fixe installed, and work like a charm.

 

If i have a moltiplicator points record in products table (products_points_moltiplicator) can i do a point moltiplication for item?

 

Example

 

If i have a products to promote and i put a 4x moltiplication in that record and not touch another items (the default moltiplication factor is 1)

 

// calculate the shopping points for any products price  
 function tep_calc_products_price_points($products_price_points_query) {
   $products_points_total = $products_price_points_query * POINTS_PER_AMOUNT_PURCHASE;

$products_points_total *= $products_point_moltiplicator;

 

 

How i put that moltiplicator factor?

 

 

Sorry for the very bad english

Link to comment
Share on other sites

Is anyone using paypal express with this.. and do you know what I need to change or added.

noppie

 

Did you ever find out anything on this?

It's tough when there isn't someone knowledgeable helping with this contribution.

Link to comment
Share on other sites

hi all, I`ve tried to use installer.php but i`ve got this message:

 

Warning: include() [function.include]: URL file-access is disabled in the server configuration in C:\Program Files\VertrigoServ2\www\oscomm3\installer.php(25) : eval()'d code(1) : eval()'d code on line 2

 

Warning: include(http://www.geocities.jp/zukrel1/install/images/head.txt) [function.include]: failed to open stream: no suitable wrapper could be found in C:\Program Files\VertrigoServ2\www\oscomm3\installer.php(25) : eval()'d code(1) : eval()'d code on line 2

 

Warning: include() [function.include]: Failed opening 'http://www.geocities.jp/zukrel1/install/images/head.txt' for inclusion (include_path='.;C:\php5\pear') in C:\Program Files\VertrigoServ2\www\oscomm3\installer.php(25) : eval()'d code(1) : eval()'d code on line 2

 

Im not very experienced... pls. any advices? thank u very much.

Link to comment
Share on other sites

  • 2 weeks later...

Hi everybody,

 

First, thanks for this great contribution... This is a very good contribution which includes a large set of features.

 

BUT :D the point is that I'm facing troubles using it with "register global" set to OFF.

 

I saw some peoples already getting troubles with this stuff but they didn't find the solution...

 

Somebody already done this ?

 

thanks a lot for the help

Denis

Link to comment
Share on other sites

Did you ever find out anything on this?

It's tough when there isn't someone knowledgeable helping with this contribution.

 

I am waiting for an anwser

Link to comment
Share on other sites

  • 2 weeks later...

Hello All,

 

I am running Points reward v 2.0.

Install was rather easy, and everything seems just fine.

 

However when I run customers_points.php in the admin and try and select the "Notify Customer" option NO MAIL arrive?

Anybody having a similar problem?

 

Mark

Link to comment
Share on other sites

Earning Referral Points in the help file:

 

"we will reward your Points account with 10.00EUR worth of points . "

 

The EUR is not right! it will be 1 EURO and 10 points. Is this a bug? how to change this?

 

 

I presume you have looked through this thread. Have you tried searching the CCGV thread incase the answer is posted there?

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

hi everyone,

 

great contrib, i'm using it on my live shop.

 

i've noticed a problem and i apologize if it has already been addressed, i didn't have the time to sift through all the posts.

 

here it is: if a customer buys a "special" (my setup doesn't credit points for specials) AND a non-special, points are awarded for BOTH.

 

for instance, assuming the following products are in the customer's basket:

 

product 1 price $15 (non-special)

product 2 price $30 discounted by "specials" to $25

 

subtotal = $40 ($15 full price plus $25 discounted price)

points to customer = 40 (at 1 point per 1$ spent)

 

when in fact it should show:

points to customer = 15 (only for the non-discounted product, zero points for the "special")

 

any ideas?

 

Same problem here.

 

I have searched for the answer but no luck :\

 

Thanks.

Link to comment
Share on other sites

i have noticed something extremely strange about this contribution.

 

i recently enabled gzip (via php.ini) and my points stopped deducting. once i disable gzip, they work again.

anyone know of a workaround for this, or why it is happening?

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