Zen Cart Logo
Forums / Bug Reports / [Done v1.3.9a] Addition to last Linkpoint Patch

[Done v1.3.9a] Addition to last Linkpoint Patch

Locked

Views: 3,120

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
3 Mar 2010, 9:00 PM
#1
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,682
Plugin Contributions:
56

[Done v1.3.9a] Addition to last Linkpoint Patch

The Linkpoint patch provided here:

http://www.zen-cart.com/forum/showpost.php?p=563490&postcount=22

was still not working for a client of mine when a gift certificate was used. The error message was, "subtotal does not match the amount being charged."

The associated LinkPoint error number is SGS-002301.

Fix and additional notes provided below.

3 Mar 2010, 10:27 PM
#2
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,682
Plugin Contributions:
56

Re: [Done v1.3.9a] Addition to last Linkpoint Patch

The situation is caused by the use of a GV, but the issue is that because of the gv, the shipping is greater than the total, so even excluding the subtotal doesn't fix the problem. I will post a patch asap.

3 Mar 2010, 11:01 PM
#3
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,682
Plugin Contributions:
56

Re: [Done v1.3.9a] Addition to last Linkpoint Patch

It's a small extension to the new logic to hide the subtotal when there are discounts.

    // if discounts apply, do not send subtotal, otherwise validation error occurs
    if ($credits_applied_so_skip_subtotal) {
      // Look for an anomaly in the total
      $tot = 0;  
      if (isset($myorder["shipping"])) $tot += (float)$myorder["shipping"];
      if (isset($myorder["tax"])) $tot += (float)$myorder["tax"];
      if (isset($myorder["subtotal"])) $tot += (float)$myorder["subtotal"];
      if ($tot > (float)$myorder["chargetotal"]) { 
          unset($myorder["shipping"]);
          unset($myorder["tax"]);
      }   
      unset($myorder["subtotal"]);
    } 
4 Mar 2010, 9:27 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: [Done v1.3.9a] Addition to last Linkpoint Patch

Are you suggesting to add that whole block of code? or to modify an existing block somewhere?

4 Mar 2010, 11:16 AM
#5
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,682
Plugin Contributions:
56

Re: [Done v1.3.9a] Addition to last Linkpoint Patch

Yes - add this block to includes/modules/payment/linkpoint_api.php in place of the existing l. 393-395. Lline numbers from the patch file in
http://www.zen-cart.com/forum/showthread.php?p=563490#post563490

    if ($credits_applied_so_skip_subtotal) {
      unset($myorder["subtotal"]);
    }
4 Mar 2010, 11:18 AM
#6
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,682
Plugin Contributions:
56

Re: [Done v1.3.9a] Addition to last Linkpoint Patch

To duplicate this problem, use enough GV to cover your products so the shipping cost is greater than the total. This will trigger it.

5 Mar 2010, 1:20 AM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: [Done v1.3.9a] Addition to last Linkpoint Patch

k - that should work fine for 138.

v1.3.9 and newer will be using a different method of preparing subtotal data, which avoids the need to re-do the math as you've done.