Page 1 of 1
A mod to set maximum reward points per checkout
Posted: Sun Jun 10, 2012 3:07 pm
by yarac
I've searched around for an extension that allows me to set the maximum reward points usable for each purchase, but have not found any. My store is already using OC's default reward point system version 1.5.2.1.
Hopefully this is a small job for someone. I'm willing to pay, let me know if you are interested and PM me a quote. Or if anyone knows how I can get this done with just some code changes, I'd really appreciate your help.
Re: A mod to set maximum reward points per checkout
Posted: Sun Jun 10, 2012 3:32 pm
by WebEngage
Hey,
Happy to do this for you - you're looking at about $30USD - PM if you are interested. It would by having an option in the Settings where you can specify the max. reward points that can be used per order.
I'm happy to develop the extension and install it on a server of mine for you to view and test before making payment.
Regards
Re: A mod to set maximum reward points per checkout
Posted: Sun Jun 10, 2012 8:22 pm
by MarketInSG
yarac wrote:I've searched around for an extension that allows me to set the maximum reward points usable for each purchase, but have not found any. My store is already using OC's default reward point system version 1.5.2.1.
Hopefully this is a small job for someone. I'm willing to pay, let me know if you are interested and PM me a quote. Or if anyone knows how I can get this done with just some code changes, I'd really appreciate your help.
Open up catalog/controller/cart.php
find
Code: Select all
if ($this->request->post['reward'] > $points_total) {
$this->error['warning'] = sprintf($this->language->get('error_maximum'), $points_total);
}
below it add
Code: Select all
if ($this->request->post['reward'] > 10) {
$this->error['warning'] = $this->language->get('error_reward_points');
}
open up catalog/language/english/cart/cart.php
find
Code: Select all
$_['error_reward'] = 'Warning: Please enter the amount of reward points to use!';
below it add
Code: Select all
$_['error_reward_points'] = 'Warning: You cannot use more than 10 reward points!';
There you go. No need for $300. A coffee for me would be good enough

Re: A mod to set maximum reward points per checkout
Posted: Sun Jun 10, 2012 8:23 pm
by MarketInSG
change the '10' to a number you wish to set it as.
Re: A mod to set maximum reward points per checkout
Posted: Sun Jun 10, 2012 8:43 pm
by WebEngage
The above does the job, but the $30USD would make it a vqmod/extension, and allow the user to set the "Reward limit" in the admin section (as opposed to having to set it in code).
The above quick fix is sufficient if what I mentioned is not required.
Regards
Re: A mod to set maximum reward points per checkout
Posted: Tue Oct 13, 2015 5:38 pm
by abmra
As mentioned by MarketInSG changes are for OpenCart 1.5
Similarly, Which all code files need to be changed in OpenCart 2.0 ??
Thanks
Re: A mod to set maximum reward points per checkout
Posted: Sat Oct 17, 2015 9:19 am
by MarketInSG
it should be pretty similar in OC 2 too (not confirmed). Try searching the files for similar lines
Re: A mod to set maximum reward points per checkout
Posted: Sat Nov 07, 2015 5:17 pm
by mash0028
hi for version 2.0.2.0
Find this in catalog/controller/checkout/reward.php
Code: Select all
$points_total = 0;
foreach ($this->cart->getProducts() as $product) {
if ($product['points']) {
$points_total += $product['points'];
}
}
Change the points_total=0
then The Points_total <= $product['points'];
Like this
Code: Select all
$points_total = 200;
foreach ($this->cart->getProducts() as $product) {
if ($product['points']) {
$points_total <= $product['points'];
}
}
I use 200 as maximum usage of points every order.
you can set your own amount, just remember to change the + (plus) to < (lessthan sign).
You will see 2 set of codes in catalog/controller/checkout/reward.php
in public function reward() {
and public function index() {
change them Both
Re: How to change the max reward points in 3.0.2
Posted: Sun Jun 17, 2018 9:44 am
by ohmashoes
Set a max points allowed in opencart ver 3.0.2
I did some work but here it is...I hope I am able to help someone out.
To change the max reward points in ver 3.0.2:
1. Go to catalog/controller/extension/total/reward.php
2. Look for:
if ($this->request->post['reward'] > $points_total) {
$json['error'] = sprintf($this->language->get('error_maximum'), $points_total);
}
3. Add this right below it (I use 50 points as the max on my site but you can change to your choice of max points):
if ($this->request->post['reward'] > 50) {
$json['error'] = sprintf($this->language->get('error_maximum'));
}
4. Save the file.
5. Then go to catalog/language/en-gb/extension/total/reward.php
6. Add this in the (error section) below. Again remember to change the 50 to your choice of max points:
$_['error_maximum'] = 'Warning: The maximum number of points that can be applied is 50!';
7. Save it and upload.
8. Test it and voila!
I really hope this helps somebody out because it took me a looong while to figure this out, especially since I am not a developer pasae.