Post by yarac » Sun Jun 10, 2012 3:07 pm

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.

New member

Posts

Joined
Thu Apr 12, 2012 12:24 pm

Post by WebEngage » Sun Jun 10, 2012 3:32 pm

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

Newbie

Posts

Joined
Mon Jun 04, 2012 9:18 pm

Post by MarketInSG » Sun Jun 10, 2012 8:22 pm

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 8)


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by WebEngage » Sun Jun 10, 2012 8:43 pm

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

Newbie

Posts

Joined
Mon Jun 04, 2012 9:18 pm

Post by abmra » Tue Oct 13, 2015 5:38 pm

As mentioned by MarketInSG changes are for OpenCart 1.5

Similarly, Which all code files need to be changed in OpenCart 2.0 ??

Thanks

Newbie

Posts

Joined
Tue Oct 13, 2015 5:19 pm

Post by MarketInSG » Sat Oct 17, 2015 9:19 am

it should be pretty similar in OC 2 too (not confirmed). Try searching the files for similar lines


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by mash0028 » Sat Nov 07, 2015 5:17 pm

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

New member

Posts

Joined
Fri Jul 24, 2015 3:36 pm

Post by ohmashoes » Sun Jun 17, 2018 9:44 am

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.

Newbie

Posts

Joined
Mon Jul 09, 2012 12:43 am
Who is online

Users browsing this forum: No registered users and 14 guests