Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


Recommended Posts

I was not able to use it

I do not know why, but I used installer.php to upgarde from 1.6 to 2.0 to preserve my database info, and now I do not see use points module

Do you see the points of customer in my_points.php?
Link to comment
Share on other sites

Hi texmaxx, thanks a lot for your help, but unfortunaly I was not able to use it

I do not know why, but I used installer.php to upgarde from 1.6 to 2.0 to preserve my database info, and now I do not see use points module on checkout_payment.php, however if use referal system is on, its box is visible, but still customer is not able to to use points. I am sure the code is correct(re-checked 3 times).

 

I tried SQL clean install, it works, but I lose all data, and insert it manually is almost impossible.

any ideas what to do with database or code to see it on payment page?

1.

If you updating from V1.60 you must leave product rectiction empty (model,products id, category path) unless you want to use it.

 

2.

If you have made a test orders with V1.60 and you had product in cart saved in cookie or database.

you must empty it before.

Remember - - - "STRESSED" spelled backwards "DESSERTS"

Link to comment
Share on other sites

To all of you, please be aware.

Points system is made in order to give customers points, if you dont want to give points then dont use this mod.

2. This mod is NOT a replacment for a payment module. its made in away to serve as a part of payment and not as afull payment.(only in a rear cases). the main idea is that the customers will use the points as a discount method.

Therefore if your store is set to have only one payment method. that method is auto selected by default(osCommerce core code).

CCGV is set to look like a payment method so its overwrite most of payment default ruls.

this is not the case with my mod.

if you have only one payment method at your store and you belive that your most of customers will have enough points to cover thier whole order. dont use this mod.

Remember - - - "STRESSED" spelled backwards "DESSERTS"

Link to comment
Share on other sites

To all of you, please be aware.

Points system is made in order to give customers points, if you dont want to give points then dont use this mod.

2. This mod is NOT a replacment for a payment module. its made in away to serve as a part of payment and not as afull payment.(only in a rear cases). the main idea is that the customers will use the points as a discount method.

Therefore if your store is set to have only one payment method. that method is auto selected by default(osCommerce core code).

CCGV is set to look like a payment method so its overwrite most of payment default ruls.

this is not the case with my mod.

if you have only one payment method at your store and you belive that your most of customers will have enough points to cover thier whole order. dont use this mod.

 

I understand that, I was just wondering if I could get a little help with a tweak. How about this then, if on checkout_confirmation the order total is $0. Is there a way from there to just skip the payment to your perfrerred payment method i.e.(PayPal, Merchant Account) and just process the order and go to checkout_success? Of course the Points balance would also have to reflect as well!

Link to comment
Share on other sites

The below 2files are ment to be used as cron job files thats way there is nothing on it.

admin/customers_points_credit.php (cron script)

admin/customers_points_expire.php (cron script)

i just added a link to those files from admin just for those users without the cron job options in thier server.

 

When u see a blank page its good(not good is when you see errors)

 

admin/customers_points_credit.php (cron script) will also show a blank page when there are no rows to update.

i don't want to use the cron option so i'm trying to get this to manually run... but it appears blank each time (for auto expire)

 

i opened the file and there was no closing ?>

so i added it.... still doesn't run.

 

i set my test account to expire on july 25 and then august 25... neither received an email notice about expired points.

 

i searched the install & support topic for more info about using the auto expire option / cron, but i didn't find anything

 

 

 

 

however, when i go through checkout or view my balance in my account - it tells me i have no points (if expiry date is today), so that portion is certainly working fine

Link to comment
Share on other sites

When I just tried to install Points and Rewards Verion 2 d I may have found an error in the install.txt file.

 

It says for step 3 for users of CCGV replace

 

if ( (is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$payment)) && (!$credit_covers) ) {

 

with

 

##### Points/Rewards Module V2.00 check for error BOF #######

if (isset($HTTP_POST_VARS['customer_shopping_points_spending']) && USE_REDEEM_SYSTEM == 'true') {

if (isset($HTTP_POST_VARS['customer_shopping_points_spending'])&&tep_calc_shopping_pvalue($customer_shopping_points_spending) < $order->info['total'] && !is_object($$payment)) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(REDEEM_SYSTEM_ERROR_POINTS_NOT), 'SSL'));

} else {

if (!tep_session_is_registered('customer_shopping_points_spending'))

tep_session_register('customer_shopping_points_spending');

}

}

if (isset($HTTP_POST_VARS['customer_referred']) && tep_not_null($HTTP_POST_VARS['customer_referred'])) {

$valid_referral_query = tep_db_query("SELECT customers_id FROM " . TABLE_CUSTOMERS . " WHERE customers_email_address = '" . $HTTP_POST_VARS['customer_referred'] . "'");

$valid_referral = tep_db_fetch_array($valid_referral_query);

if (!tep_db_num_rows($valid_referral_query)) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(REFERRAL_ERROR_NOT_FOUND), 'SSL'));

}

if ($HTTP_POST_VARS['customer_referred'] == $order->customer['email_address']) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(REFERRAL_ERROR_SELF), 'SSL'));

} else {

$customer_referral = $valid_referral['customers_id'];

if (!tep_session_is_registered('customer_referral')) tep_session_register('customer_referral');

}

}

// if ( (is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$payment)) && (!$credit_covers) ) {

if ( (is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$payment)) && (!$credit_covers) && (!$customer_shopping_points_spending) ) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));

}

######## Points/Rewards Module V2.00 EOF #################*/

 

When doing this I had to copies of

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));

}

 

which gave me an error on my line 97 because I had an extra " } ". Just delete the copy of tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));

}

 

that isn't in the Points/Rewards Module slashes to fix the problem.

Link to comment
Share on other sites

Hi,

 

I finally got this module to work with Gift vouchers and everything works perfect accept for one thing. In "Customers" > "Pending Points" I get 5 of the same thing instead of one. I also see the same thing under "My account" where the customer views there points history on the front end of the shop. I have tried the suggestions that were on this forum about emptying the sessions and customers basket etc but it still hasn't fixed the problem. I have tried running the installer file instead of manually dumping the SQL through php Myadmin but still no solution.

 

I would really appreciate any suggestions on this. I love this contrib and would be very grateful if someone could help me with it.

 

Regards

 

Kelly

 

 

screenshot.jpg

Link to comment
Share on other sites

BenIt does the trick eccept in my_points.php.

this select:

  $points_query = tep_db_query("SELECT customers_shopping_points, customers_points_expires FROM " . TABLE_CUSTOMERS . " WHERE customers_id = '" . (int)$customer_id . "' AND customers_points_expires > CURDATE()");

doesn't give a result as customers_points_expires is now set to 0000-00-00 which can't be > CURDATE().

I think, this query should help

  $points_query = tep_db_query("SELECT customers_shopping_points, customers_points_expires FROM " . TABLE_CUSTOMERS . " WHERE customers_id = '" . (int)$customer_id . "' AND (customers_points_expires > CURDATE() OR customers_points_expires = '0000-00-00')");

and we should ask than

  $points = tep_db_fetch_array($points_query);
//	$shopping_points = tep_get_shopping_points($customer_id);
 if (tep_db_num_rows($points_query)) {
?>
		  <td class="main"><?php echo sprintf(MY_POINTS_CURRENT_BALANCE, number_format($points['customers_shopping_points'],POINTS_DECIMAL_PLACES),$currencies->format(tep_calc_shopping_pvalue($points['customers_shopping_points']))); ?></td>
<?php
		if ($points['customers_points_expires'] == '0000-00-00') {
?>
		  <td class="main" align="right"><?php echo '<b>' . MY_POINTS_NEVER_EXPIRE . '</b>'; ?></td>
<?php
		} else {
?>
		  <td class="main" align="right"><?php echo '<b>' . MY_POINTS_EXPIRE . '</b> ' . tep_date_short($points['customers_points_expires']); ?></td>
<?php
		}
?>

and add the constant MY_POINTS_NEVER_EXPIRE to the languages files.

What do you think?

G?tz

 

Hi i have the same problem like yours and i would like to apply changes as u suggested but i'm not really undersand can u help me explaining in a simple explaination as i'm not very phph literate. thanks in advance :D

Link to comment
Share on other sites

i would like to apply changes as u suggested
catalog/my_points.php
***REPLACE***

<?php
 $points_query = tep_db_query("SELECT customers_shopping_points, customers_points_expires FROM " . TABLE_CUSTOMERS . " WHERE customers_id = '" . (int)$customer_id . "' AND customers_points_expires > CURDATE()");
 $points = tep_db_fetch_array($points_query);
if (tep_db_num_rows($points_query)) {
?>
		  <td class="main"><?php echo sprintf(MY_POINTS_CURRENT_BALANCE, number_format($points['customers_shopping_points'],POINTS_DECIMAL_PLACES),$currencies->format(tep_calc_shopping_pvalue($points['customers_shopping_points']))); ?></td>
		  <td class="main" align="right"><?php echo '<b>' . MY_POINTS_EXPIRE . '</b> ' . tep_date_short($points['customers_points_expires']); ?></td>
<?php
 } else {
	 echo'<td class="main"><b>' . TEXT_NO_POINTS . '</b></td>';
 }
?>


***WITH***


<?php
 $points_query = tep_db_query("SELECT customers_shopping_points, customers_points_expires FROM " . TABLE_CUSTOMERS . " WHERE customers_id = '" . (int)$customer_id . "' AND (customers_points_expires > CURDATE() OR customers_points_expires = '0000-00-00')");
 $points = tep_db_fetch_array($points_query);
 if (tep_db_num_rows($points_query)) {
?>
		  <td class="main"><?php echo sprintf(MY_POINTS_CURRENT_BALANCE, number_format($points['customers_shopping_points'],POINTS_DECIMAL_PLACES),$currencies->format(tep_calc_shopping_pvalue($points['customers_shopping_points']))); ?></td>
<?php
		if ($points['customers_points_expires'] == '0000-00-00') {
?>
		  <td class="main" align="right"><?php echo '<b>' . MY_POINTS_NEVER_EXPIRE . '</b>'; ?></td>
<?php
		} else {
?>
		  <td class="main" align="right"><?php echo '<b>' . MY_POINTS_EXPIRE . '</b> ' . tep_date_short($points['customers_points_expires']); ?></td>
<?php
		}
?>
<?php
 } else {
	 echo'<td class="main"><b>' . TEXT_NO_POINTS . '</b></td>';
 }
?>

############################
catalog/includes/languages/english/my_points.php

***ADD***

define('MY_POINTS_NEVER_EXPIRE', 'Points do not expire');

Link to comment
Share on other sites

Ben,

 

I have a question regarding the handling of specials.

 

Afaik when

REDEMPTION_DISCOUNTED is set to false, one should _not_ be able to _pay_ with points for items discounted.

USE_POINTS_FOR_SPECIALS is set to false, no points are given on discounted items.

 

Now, if I have a cart with only discounted items, no points are given. fine.

If I have a mixed cart, points are given on all items, even the discounted ones...

I can pay with points allways, the REDEMPTION_DISCOUNTED does not work.

 

Did I screw up something?

 

G?tz

Link to comment
Share on other sites

Greg

Points Redemtion after Discount Coupon and Enough Points to cover order:

screen1.gif

 

Points Redemtion before Discount Coupon and Enough Points to cover order:

screen2.gif

I do not know if this is the right way, or if there is a better one, but it works.

I just added function number_format() to $order->info['total'] = $order->info['total'] - (tep_calc_shopping_pvalue($customer_shopping_points_spending));

 

catalog/includes/modules/order_total/ot_redemptions.php

	function process() {
  global $order, $currencies, $customer_shopping_points_spending;

// if customer is using points to pay
  if ($customer_shopping_points_spending > 0){

/*
print_r($order->info['total'].'<br>');

	$temp_total = number_format($order->info['total'],4);
print_r($temp_total.'<br>');

	$temp_points = number_format(tep_calc_shopping_pvalue($customer_shopping_points_spending),4);
print_r($temp_points.'<br>');
print_r(tep_calc_shopping_pvalue($customer_shopping_points_spending).'<br>');
print_r($temp_total - $temp_points.'<br>');

	$order->info['total'] = ($temp_total - $temp_points);

print_r($order->info['total'].'<br>');
*/

	$order->info['total'] = number_format($order->info['total'],4) - number_format(tep_calc_shopping_pvalue($customer_shopping_points_spending),4);

I left the code in for checking the values, so you can just uncomment and try other solutions...

Link to comment
Share on other sites

I always get this

 

You have a credit balance of $104.14 ,would you like to use it to pay for this order?

The estimated total of your purchase is: $3,057.00

Total Purchase is greater than the maximum points allowed, you will also need to choose a payment method .

 

and never got a chance to enter the amount to use manually, not even once! where did i go wrong!?

 

also on checkout confirmation, the points use never show up, have tried all the method mentioned in this forum .. resort order, after shipping/subtotal and before total ... never show up!!

 

help!

Link to comment
Share on other sites

I just installed this contribution and I'm getting these errors on my_ponits.php and my_points_help.php.

 

The error is that:

 

Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/lab/public_html/test/includes/header.php:210) in /home/lab/public_html/test/includes/boxes/categories.php on line 13

 

 

Could someone tell me what is the problem?

Link to comment
Share on other sites

Hi Ben

 

I can see you have alot of needy questions to resolve, & hope you don't mind me asking a small one? :rolleyes: I have V1.60 installed. Working fine...I think, so I do not want to touch it. Also I do not see a need for most of the updates in V2.0 ie; expiry dated points, only use all points etc on my store. However :D there is one thing that I would like to add to your great contribution, & that is the points for referring a new paying customer. Is there any way I can do just this part please? You should know that I cannot code or understand fully how to rewrite a piece of code. :blush: If one or more of the steps were specifically for this bit, then I could follow the relevant instructions. If not, then hey nothing lost for asking, as I still like what I have. :thumbsup:

 

Thanks

Julie

Link to comment
Share on other sites

Hello all,

 

This issue doesn't pertain to Points/Rewards only but nontheless I am hoping to find some answers here, because I am at a complete dead-end. I have just installed LinkPoint API and am having a big problem with it.

 

 

I have both the CCGV(trad) and Points/Rewards 1.6 installed. They both seem to work fine so far, with the exception of P/R "enough points to cover total" inconvenience. So anyway when LP API passes the alleged grand total to the gateway it sends the ammount which is before the CCGV or P/R discounts were applied.

 

I think I found the lines in linkpoint_api.php that deal with the passing of total, but lack the savvy to know what to do with them.

 

$grantotal = number_format($order->info['total'], 2);
  $myorder["chargetotal"] = str_replace(",", "", $grantotal);

 

Do these modules use some variable for holding final total other then $order->info['total']? Or maybe the API grabs the total from $order->info['total'] before it should.

 

Please help debug, I am under a lot of pressure. :(

 

Thank you for your time.

Edited by Voland

People dont change, people realize.

Link to comment
Share on other sites

Dear Sir/Madam,

I've installed this forum on my shopping store and I was very excited to see its result but I think there is some mistake may be in my installation process.

Please help me out I'm getting following errors when I click on:-"View my Points Balance and Points received." in My Account

Error:-

Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/shopping/public_html/includes/header.php:476) in /home/shopping/public_html/includes/boxes/categories.php on line 13

 

And I'm getting Another Error when i click on :- Reward Point Program FAQ.

 

Error:- "Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/shopping/public_html/includes/header.php:476) in /home/shopping/public_html/includes/boxes/categories.php on line 13"

 

Please help me in this as I'm very excited to see this module working on my site. The URL of my site is :- www.shoppingmantra.com

 

Thanks

Link to comment
Share on other sites

Cannot redeclare tep_show_category() (previously declared in /home/shopping/public_html/includes/header.php:476) in /home/shopping/public_html/includes/boxes/categories.php on line 13
The error says everything. Look into this files at the linenumbers includes/header.php:476 and includes/boxes/categories.php on line 13 and you will find out.
Link to comment
Share on other sites

Does this contribution allow the next?

 

1) customer tell friend about my site

2) friend buy a product

3) customer gets gift (or points for that)?

 

Becouse I have free stuff from manufactures and would like to give them as a reward for people who spread word about my site. If this contribution does not allow this, is there one which does?

Link to comment
Share on other sites

aapinen, the most recent version of this contribution does that. the new user must enter their friends' email as their referrer in order for their friend to get the points amount (which is set in the points configuration)

Link to comment
Share on other sites

aapinen, the most recent version of this contribution does that. the new user must enter their friends' email as their referrer in order for their friend to get the points amount (which is set in the points configuration)

Hi eww

Any chance you know if it is possible just to take this bit from the new contribution? I have a working v1.6 & do not want to change anything else, but would like to add the referral points to V1.6.

 

Thanks

Julie

Link to comment
Share on other sites

GregI do not know if this is the right way, or if there is a better one, but it works.

I just added function number_format() to $order->info['total'] = $order->info['total'] - (tep_calc_shopping_pvalue($customer_shopping_points_spending));

 

catalog/includes/modules/order_total/ot_redemptions.php

	function process() {
  global $order, $currencies, $customer_shopping_points_spending;

// if customer is using points to pay
  if ($customer_shopping_points_spending > 0){

/*
print_r($order->info['total'].'<br>');

	$temp_total = number_format($order->info['total'],4);
print_r($temp_total.'<br>');

	$temp_points = number_format(tep_calc_shopping_pvalue($customer_shopping_points_spending),4);
print_r($temp_points.'<br>');
print_r(tep_calc_shopping_pvalue($customer_shopping_points_spending).'<br>');
print_r($temp_total - $temp_points.'<br>');

	$order->info['total'] = ($temp_total - $temp_points);

print_r($order->info['total'].'<br>');
*/

	$order->info['total'] = number_format($order->info['total'],4) - number_format(tep_calc_shopping_pvalue($customer_shopping_points_spending),4);

I left the code in for checking the values, so you can just uncomment and try other solutions...

 

Thanks TexMaxx .. this put me on the right track to finally fix this. Your solution was only part complete and worked if you did not have a discount coupon of any sort .

However if you have CCGV installed or any other order_total module installed, the points are not calculated properly.

What is basically happening is that the points required are estimated at checkout_payment. if any order total module add or substract amount, we then need to recalculate the number of points required.

 

To do this the following changed are needed:

in includes/functions/redemptions.php in the method function points_selection() change:

 

			 $max_points = $order->info['total']/REDEEM_POINT_VALUE > POINTS_MAX_VALUE ? POINTS_MAX_VALUE : $order->info['total']/REDEEM_POINT_VALUE;
		 $max_points = $customer_shopping_points > $max_points ? $max_points : $customer_shopping_points;

with

			 $max_points = calculate_required_points($order->info['total'], $customer_shopping_points);
		 //$max_points = $order->info['total']/REDEEM_POINT_VALUE > POINTS_MAX_VALUE ? POINTS_MAX_VALUE : $order->info['total']/REDEEM_POINT_VALUE;
		 //$max_points = $customer_shopping_points > $max_points ? $max_points : $customer_shopping_points;

 

then in the same file, just before:

 

function referral_input() {

add

 

// Calculate the number of points needed to cover an amount
function calculate_required_points($amount, $cust_shop_points) {
	$max_allowed = $amount/REDEEM_POINT_VALUE > POINTS_MAX_VALUE ? POINTS_MAX_VALUE : $amount/REDEEM_POINT_VALUE;
	$max_allowed = $cust_shop_points > $max_allowed ? $max_allowed : $cust_shop_points;

	return $max_allowed;
}

 

Finally in the file includes/modules/order_total/ot_redemptions.php

 

just before:

 

$order->info['total'] = $order->info['total'] - (tep_calc_shopping_pvalue($customer_shopping_points_spending));

 

add:

$customer_shopping_points_spending = calculate_required_points($order->info['total'], $customer_shopping_points_spending);

 

 

I tested this and the beauty of it is that we can now put the ot_redemptions module anywhere we want in the order total sequence depending on what we want to achieve.

With CCGV, I personnaly put it after the coupon deduction but before the gift voucher one...

Link to comment
Share on other sites

Hi eww

Any chance you know if it is possible just to take this bit from the new contribution? I have a working v1.6 & do not want to change anything else, but would like to add the referral points to V1.6.

 

Thanks

Julie

if you're familiar with php it's certainly a possibility, but it is my understanding the bulk of the contribution has been entirely rewritten... so it may not even be compatible with 1.6

Link to comment
Share on other sites

Mea Culpa, the correct code for the ot_redemptions file code change is as follow:

 

Finally in the file includes/modules/order_total/ot_redemptions.php

 

change:

 

$order->info['total'] = $order->info['total'] - (tep_calc_shopping_pvalue($customer_shopping_points_spending));

 

 

with

 

$customer_shopping_points_spending = calculate_required_points($order->info['total'], $customer_shopping_points_spending);
$order->info['total'] = number_format($order->info['total'] - (tep_calc_shopping_pvalue($customer_shopping_points_spending)), 4);

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