Zen Cart Logo
Forums / General Questions / Write returned shipping quote vaules to order table

Write returned shipping quote vaules to order table

Views: 1,553

Results 21 to 23 of 23
19 Mar 2016, 6:56 PM
#21
marcopolo avatar

marcopolo

Totally Zenned

Join Date:
May 2008
Location:
United States
Posts:
516
Plugin Contributions:
2

Write returned shipping quote vaules to order table

mc12345678:

Point of clarification/terminology. The assignment above is not related to a "define" in the sense of PHP. A define is a constant... Constants are intended NOT to be modifiable. (That's a variable. :) )

Got it thanks :)

But, to unset a variable well, unset($_SESSION['shipping_rate_ups']);

As to where in the code, there is a section I thought in the checkout_process header area but it might be as far in programming as the checkout_success section where other cart related session variables are reset/unset after the data has been captured for storage and technically I thought after that data has been captured in the database.

Solve this issue!

OLD code:

 if ($rateReply->Service->Code == 03) {
        if ($_SESSION['shipping_rate_ups'] == 0 || $_SESSION['shipping_rate_ups'] > $cost) {
            $_SESSION['shipping_rate_ups'] = $cost;
       }
            }
            if ($rateReply->Service->Code == 92 || $rateReply->Service->Code ==  93) {
        if ($_SESSION['shipping_rate_ups_surepost'] == 0 || $_SESSION['shipping_rate_ups_surepost'] > $cost) {
            $_SESSION['shipping_rate_ups_surepost'] = $cost;
       }
            }  

NEW code:

 if ($rateReply->Service->Code == 03) {
        if ($_SESSION['shipping_rate_ups'] == 0 || $_SESSION['shipping_rate_ups'] <> $cost) {
            $_SESSION['shipping_rate_ups'] = $cost;
       }
            }
            if ($rateReply->Service->Code == 92 || $rateReply->Service->Code ==  93) {
        if ($_SESSION['shipping_rate_ups_surepost'] == 0 || $_SESSION['shipping_rate_ups_surepost'] <> $cost) {
            $_SESSION['shipping_rate_ups_surepost'] = $cost;
       }
            } 
19 Mar 2016, 8:27 PM
#22
drbyte avatar

drbyte

Sensei

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

Re: Write returned shipping quote vaules to order table

In PHP, generally "not equal to" is represented by: != (instead of <> )

As for "where to reset" the variable, ideally you'd do it with an observer which monitors notifications sent to the NOTIFY_HEADER_END_CHECKOUT_PROCESS event hook.
But, if that's too programmer-esque for you, you could simply add the unset() statement to the list of existing unset() calls in the /includes/modules/pages/checkout_process/header_php.php

19 Mar 2016, 11:12 PM
#23
marcopolo avatar

marcopolo

Totally Zenned

Join Date:
May 2008
Location:
United States
Posts:
516
Plugin Contributions:
2

Re: Write returned shipping quote vaules to order table

DrByte:

In PHP, generally "not equal to" is represented by: != (instead of <> )

OK I changed it, thanks!

As for "where to reset" the variable, ideally you'd do it with an observer which monitors notifications sent to the NOTIFY_HEADER_END_CHECKOUT_PROCESS event hook.
But, if that's too programmer-esque for you, you could simply add the unset() statement to the list of existing unset() calls in the /includes/modules/pages/checkout_process/header_php.php

Got it, thanks!

Thank you DrByte and mc12345678 for both your help on this, everything is working perfect now!