Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


Recommended Posts

URGENTLY NEED HELP to get my modification of this module working...

 

I need to give some selected products unique points values. So product A has 2points, product B has 3 points, etc. These points are SET BY ME in admin for these 'selected' products. ALL OTHER PRODUCTS WILL CONTINUE TO GET AUTO CALCULATED POINT VALUES calculated by the standard product price x POINTS_PER_AMOUNT_PURCHASE which already exists within the points rewards contribution.

 

Method I am using:

 

I created a new cloumn in the products table called 'products_setpoints' . I added a new entry box on the product description page in admin, so that for each new product I can give a SET POINTS VALUE. Now every product can have whatever points value i want.

 

The DEFAULT value for the 'products_setpoints' is 0 in the database.

 

I think that the points values are calculated in the catalog/includes/functions/redemptions.php file.

 

The 2 functions I am looking at are

// calculate the shopping points value for the customer
 function tep_calc_shopping_pvalue($points) {

return((float)$points * (float)REDEEM_POINT_VALUE);
 }

function tep_display_points($products_price, $products_tax, $quantity = 1) {
if ((DISPLAY_PRICE_WITH_TAX == 'true') && (USE_POINTS_FOR_TAX == 'true')) {
  $products_price_points_query = tep_add_tax($products_price, $products_tax) * $quantity;
  } else {
  $products_price_points_query = $products_price * $quantity;  

  }
  return $products_price_points_query;  
}

// 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;  

return $products_points_total;   

 }

 

 

What i need to do is change these functions so that IF i have added a 'products_setpoints' value for a product then this value should be used in the first instance, and if the value is 0 then the normal points calcualtions are applied.

 

I just need to change the function to say:

 

Do an additional query to find values in 'products_setpoints' field of the products table

and IF $products_setpoints > 0 (i.e. products have a set points value)

THEN DO this $products_points_total = $products_price_points_query * $products_setpoints ;

ELSE DO this $products_points_total = $products_price_points_query * POINTS_PER_AMOUNT_PURCHASE;

 

THEN obviously return the value return($products_points_value);

 

But I am not sure how to write this query.

 

PLEASE CAN ANYONE HELP. I am sure this mod would help everyone. It gives the best of both worlds. Automatically calculated points AND individually set points. If I can get it working I will post the complete files for everyone else.

Edited by maz
Link to comment
Share on other sites

Hi

 

I have the problem, that this error appears, when i click on "My Profile":

 

1146 - Table 'usr_web269_6.TABLE_CUSTOMERS_POINTS_PENDING' doesn't exist

select count(*) as count from TABLE_CUSTOMERS_POINTS_PENDING where customer_id = '2'

[TEP STOP]

 

Who can help me?

 

Thanks! L?o

 

(Sorry for my bad english, I'm swiss... :blush: )

you didn't run the sql query to install the database tables

Link to comment
Share on other sites

Hi

 

I have the problem, that this error appears, when i click on "My Profile":

 

1146 - Table 'usr_web269_6.TABLE_CUSTOMERS_POINTS_PENDING' doesn't exist

select count(*) as count from TABLE_CUSTOMERS_POINTS_PENDING where customer_id = '2'

[TEP STOP]

 

Who can help me?

 

Thanks! L?o

 

(Sorry for my bad english, I'm swiss... :blush: )

did you miss this step?

------------------------------------------------------------------------------------------

CATALOG STEP = 11.   open catalog/includes/database_tables.php
This will define the table used for shopping points.

Find... (aprox. line 29)

 define('TABLE_CUSTOMERS_INFO', 'customers_info');

... and add after.....

 define('TABLE_CUSTOMERS_POINTS_PENDING', 'customers_points_pending');//Points/Rewards Module V1.60

------------------------------------------------------------------------------------------

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

Link to comment
Share on other sites

I need some help please.

 

 

URGENTLY NEED HELP to get my modification of this module working...

 

I need to give some selected products unique points values. So product A has 2points, product B has 3 points, etc. These points are SET BY ME in admin for these 'selected' products. ALL OTHER PRODUCTS WILL CONTINUE TO GET AUTO CALCULATED POINT VALUES calculated by the standard product price x POINTS_PER_AMOUNT_PURCHASE which already exists within the points rewards contribution.

 

Method I am using:

 

I created a new cloumn in the products table called 'products_setpoints' . I added a new entry box on the product description page in admin, so that for each new product I can give a SET POINTS VALUE. Now every product can have whatever points value i want.

 

The DEFAULT value for the 'products_setpoints' is 0 in the database.

 

I think that the points values are calculated in the catalog/includes/functions/redemptions.php file.

 

The 2 functions I am looking at are

// calculate the shopping points value for the customer
 function tep_calc_shopping_pvalue($points) {

return((float)$points * (float)REDEEM_POINT_VALUE);
 }

function tep_display_points($products_price, $products_tax, $quantity = 1) {
if ((DISPLAY_PRICE_WITH_TAX == 'true') && (USE_POINTS_FOR_TAX == 'true')) {
  $products_price_points_query = tep_add_tax($products_price, $products_tax) * $quantity;
  } else {
  $products_price_points_query = $products_price * $quantity;  

  }
  return $products_price_points_query;  
}

// 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;  

return $products_points_total;   

 }

What i need to do is change these functions so that IF i have added a 'products_setpoints' value for a product then this value should be used in the first instance, and if the value is 0 then the normal points calcualtions are applied.

 

I just need to change the function to say:

 

Do an additional query to find values in 'products_setpoints' field of the products table

and IF $products_setpoints > 0 (i.e. products have a set points value)

THEN DO this $products_points_total = $products_price_points_query * $products_setpoints ;

ELSE DO this $products_points_total = $products_price_points_query * POINTS_PER_AMOUNT_PURCHASE;

 

THEN obviously return the value return($products_points_value);

 

But I am not sure how to write this query.

 

PLEASE CAN ANYONE HELP. I am sure this mod would help everyone. It gives the best of both worlds. Automatically calculated points AND individually set points. If I can get it working I will post the complete files for everyone else.

Link to comment
Share on other sites

Ok, thanks! Thas was it!

 

But now I have another error at the "checkout", also when a customer wants to pay the itams; this errors appears:

 

Warning: printf(): Too few arguments in /home/www/web269/html/minis/shop/catalog/checkout_payment.php on line 393

 

Can someone help me?

 

Thanks! L?o

Link to comment
Share on other sites

Ok, I have risove that problem, but I have another question:

 

How can I delete the "Value=", in the notification-mail when i add points to a client?

 

In the Mail now it's written: Your points: 50.00 Points Value = 50EUR

 

Thanks! L?o

Link to comment
Share on other sites

One more thing:

 

I would like that the customer can't enter how much points he want's to spend, but automaticaly all products are paid with points. I have done this so:

 

<td class="main" ><?php echo TEXT_REDEEM_SYSTEM_SPENDING . '  ' .tep_draw_input_field('customer_shopping_points_spending', ($order->info['total']), 'onBlur="validate(this)" maxlength="7" style="width:70px"'); ?></td>

 

But now I would like to do this input-field invisibel. How can I do that?

 

Thanks! L?o

Link to comment
Share on other sites

Hello Deep-Silver,

 

I have found tax is always charged according to the total before the discount/points, Is this because tax is calculated whenever you buy something and is included in the price (if using display prices with tax), so it is not calculated at the final checkout pages. How do I fix this so that tax is charged after the discount please?

Link to comment
Share on other sites

In redemptions.php the $points_toadd are calculated on the total order amount . Does any body know if the 'totals' in the function below are taken from orders.php file in classes folder ?

else $points_toadd = $order->info['total'];

Link to comment
Share on other sites

i'm not positive but i'm pretty sure you could deduct tax, shipping, etc from the total using points if you re-ordered the listings on:

admin -> Modules -> Order Total

 

edit the "Sort Order" and number everything you want deducted BEFORE Points Redemptions

Link to comment
Share on other sites

i'm not positive but i'm pretty sure you could deduct tax, shipping, etc from the total using points if you re-ordered the listings on:

admin -> Modules -> Order Total

 

edit the "Sort Order" and number everything you want deducted BEFORE Points Redemptions

 

Changing the order makes no difference, the tax is still calculated on the total before any points or discounts come into effect....

Link to comment
Share on other sites

I've a question here.How do i put a warning that the current product customer view is not awarded points if he/she purchase.

 

For better understanding:--Please see below

 

Points Credit : No points awarded for discounted products. (this one if the item is discounted)

 

Let me explain.Let say i've 3 categories and 2 of them are awarded points.The other is not,therefore the points credit notice is still there meanwhile the category is not awarded.How do I make a notice that this category is not awarded points if he/she purchase it?

 

____Let say the customer did not read FAQ____

Link to comment
Share on other sites

One more thing:

 

I would like that the customer can't enter how much points he want's to spend, but automaticaly all products are paid with points. I have done this so:

 

<td class="main" ><?php echo TEXT_REDEEM_SYSTEM_SPENDING . '  ' .tep_draw_input_field('customer_shopping_points_spending', ($order->info['total']), 'onBlur="validate(this)" maxlength="7" style="width:70px"'); ?></td>

 

But now I would like to do this input-field invisibel. How can I do that?

 

Thanks! L?o

 

Nobody can helb me?

 

L?o

Link to comment
Share on other sites

How do i restrict some of my items is not giving points if they purchase it.

 

Please...URGENT

At the moment you can only restrict points given for items witch thier prices are other then the full frice.

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

Link to comment
Share on other sites

At the moment you can only restrict points given for items witch thier prices are other then the full frice.

 

hurrm...can you build a system that can restrict if any items over 500 will not receive point.....I think this is usefull.

Link to comment
Share on other sites

Hi there!

 

I have used this contributions several times but This time I'm using it in a template oscommerce site purchased in a store site.

 

I found a problem and I don't know how to solve.

 

When a customer links at "View my Points Balance and Points received" and "Reward Point Program FAQ" in the My Account menu the problem appears. This message appears: "Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/XXXXXXX/public_html/shop/includes/header.php:195) in /home/XXXXXXX/public_html/shop/includes/boxes/categories.php on line 13".

 

Anyone can help me?

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