Page 1 of 1

[OC2.3.1] reward points possible bug or new feature??

Posted: Mon Jun 29, 2015 6:52 am
by beipink
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.

Re: [OC2.3.1] reward points possible bug or new feature??

Posted: Tue Aug 11, 2015 11:17 pm
by zekin
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?

Re: [OC2.3.1] reward points possible bug or new feature??

Posted: Wed Aug 12, 2015 3:34 am
by straightlight
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()");

Re: [OC2.3.1] reward points possible bug or new feature??

Posted: Wed Aug 12, 2015 2:08 pm
by zekin
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()");

Re: [OC2.3.1] reward points possible bug or new feature??

Posted: Wed Aug 12, 2015 2:10 pm
by zekin
I have just found the solution for this, and it worked for me:

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