Post by beipink » Mon Jun 29, 2015 6:52 am

Hello everyone,
Before opening a bug in the bug tracker.
Has anyone experienced any issue with the reward points system in OC 2.0.3.1.
this is what's happening:
- returning customer buys a product and uses it's reward points to partially pay for it.
- reward points are deducted=discount
- when I go to process the order in the backedn, the reward points button is ALREADY red (showing remove reward points)
- after checking the points in the DB, it looks like no new points have been added. Correct points have been deducted and used for the order but new points not added.

- clicking on the red button has no effect, it will change to green and clicking again will switch it back to red. No changes in the DB.

Is this a bug or it's meant to work this way?

no other issues detected so far.

Active Member

Posts

Joined
Tue Mar 20, 2012 7:43 pm

Post by zekin » Tue Aug 11, 2015 11:17 pm

Hi beipink, I experience the exact same thing.

I am using OC 2.0.3.1

Have you figured out how to fix it yet?

My OC sites:
Top Choice Variety
Tiny World


New member

Posts

Joined
Wed Nov 21, 2012 8:13 pm

Post by straightlight » Wed Aug 12, 2015 3:34 am

According to admin/controller/sale/order.php file and admin/model/sale/customer.php file - > addReward method, the reward will be adjusted towards registered customers account only. Not as guests.

However, in admin/model/sale/customer.php file, to ensure not to hit a reserved function term from database queries, under addReward,

replace:

Code: Select all

$this->db->query("INSERT INTO " . DB_PREFIX . "customer_reward SET customer_id = '" . (int)$customer_id . "', order_id = '" . (int)$order_id . "', points = '" . (int)$points . "', description = '" . $this->db->escape($description) . "', date_added = NOW()");
with:

Code: Select all

$this->db->query("INSERT INTO " . DB_PREFIX . "customer_reward SET customer_id = '" . (int)$customer_id . "', order_id = '" . (int)$order_id . "', points = '" . (int)$points . "', `description` = '" . $this->db->escape($description) . "', date_added = NOW()");

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by zekin » Wed Aug 12, 2015 2:08 pm

Hello, pardon me , I do not quite follow this, what is the difference between these two codes?
straightlight wrote:According to admin/controller/sale/order.php file and admin/model/sale/customer.php file - > addReward method, the reward will be adjusted towards registered customers account only. Not as guests.

However, in admin/model/sale/customer.php file, to ensure not to hit a reserved function term from database queries, under addReward,

replace:

Code: Select all

$this->db->query("INSERT INTO " . DB_PREFIX . "customer_reward SET customer_id = '" . (int)$customer_id . "', order_id = '" . (int)$order_id . "', points = '" . (int)$points . "', description = '" . $this->db->escape($description) . "', date_added = NOW()");
with:

Code: Select all

$this->db->query("INSERT INTO " . DB_PREFIX . "customer_reward SET customer_id = '" . (int)$customer_id . "', order_id = '" . (int)$order_id . "', points = '" . (int)$points . "', `description` = '" . $this->db->escape($description) . "', date_added = NOW()");

My OC sites:
Top Choice Variety
Tiny World


New member

Posts

Joined
Wed Nov 21, 2012 8:13 pm

Post by zekin » Wed Aug 12, 2015 2:10 pm

I have just found the solution for this, and it worked for me:

https://github.com/opencart/opencart/issues/3161

My OC sites:
Top Choice Variety
Tiny World


New member

Posts

Joined
Wed Nov 21, 2012 8:13 pm
Who is online

Users browsing this forum: No registered users and 83 guests