[OC2.3.1] reward points not added to returning customer #3161

Closed
beifloyd opened this Issue Jul 4, 2015 · 4 comments

Projects

None yet

3 participants

@beifloyd
beifloyd commented Jul 4, 2015

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 applied to the order.
  • when I go to process the order in the back end, the reward points button is ALREADY red (showing remove reward points)
  • Looking at the points history for the specific customer, no new points have been added. Correct points have been deducted and used for the order but new points not added.
  • This can be confirmed by checking the points in the DB, (with phpmyadmin)
  • In addition, clicking on the red button has no effect, it will change the button to green and clicking on it again will switch it back to red. No changes in the DB.

no other issues detected so far.

@danijelGombac
Contributor

The error is in public function getTotalCustomerRewardsByOrderId query in customer.php model where is checking for all rewards points. Add to the end AND points > 0.

@beifloyd
beifloyd commented Jul 4, 2015

Do you mean the line 503 in admin\model\sale\customer.php should be like this

public function getTotalCustomerRewardsByOrderId($order_id) {
$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "customer_reward WHERE order_id = '" . (int)$order_id . "' AND points > 0");

@danijelGombac
Contributor

Yes

@beifloyd
beifloyd commented Jul 4, 2015

alright, I'll add a pull request linked to this.

@beifloyd beifloyd added a commit to beifloyd/opencart that referenced this issue Jul 4, 2015
@beifloyd beifloyd Update customer.php 9166b86
@danielkerr danielkerr added a commit that referenced this issue Aug 14, 2015
@danielkerr danielkerr #3161 351ef83
@danielkerr danielkerr closed this Aug 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment