Post by kamalkpaleti » Mon Oct 31, 2016 3:41 am

When using the store credit to purchase an item, the total balance is deducting and showing balance zero even though the product price is less than the store credit we have.

Example : I have store credit $3000 and purchased a product for $500.

In real, $500 must be deducted from store credit and the balance should be $2500

But, it is deducting all the store credit and showing a balance Zero.

I have attached screen shots below. Please check. Thanks for looking into this.

Attachments

error2.JPG

error2.JPG (75.5 KiB) Viewed 4280 times

error1.JPG

error1.JPG (64.2 KiB) Viewed 4280 times


Newbie

Posts

Joined
Wed Sep 19, 2012 10:20 am

Post by cyclops12 » Mon Oct 31, 2016 4:03 am

Is this an extension you are using for store credit ?

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by kamalkpaleti » Mon Oct 31, 2016 4:09 am

No, This is default opencart feature.

Newbie

Posts

Joined
Wed Sep 19, 2012 10:20 am

Post by fido-x » Mon Oct 31, 2016 11:06 am

I can confirm this. The problem is due to an invalid comparison in the model (comparing a float with an array).

To fix: Change line 9 of catalog/model/extension/total/credit.php from:

Code: Select all

$credit = min($balance, $total);
to:

Code: Select all

$credit = min($balance, $total['total']);

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by kamalkpaleti » Mon Oct 31, 2016 3:53 pm

Thank you very much fido-x. It worked.

Newbie

Posts

Joined
Wed Sep 19, 2012 10:20 am

Post by nexxterra » Sat May 06, 2017 7:16 am

Why is the code in the current download version changed to reflect this? I downloaded V2.3.0.2 April 2017... this post is from October 2016...

New member

Posts

Joined
Tue Nov 29, 2011 10:48 am

Post by f1br3opt1c » Wed Jun 28, 2017 11:02 pm

fido-x wrote:
Mon Oct 31, 2016 11:06 am
I can confirm this. The problem is due to an invalid comparison in the model (comparing a float with an array).

To fix: Change line 9 of catalog/model/extension/total/credit.php from:

Code: Select all

$credit = min($balance, $total);
to:

Code: Select all

$credit = min($balance, $total['total']);
thank you so much for this fix man.. was doing my head in!

New member

Posts

Joined
Fri May 24, 2013 5:36 pm
Who is online

Users browsing this forum: No registered users and 37 guests