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

Write returned shipping quote vaules to order table

Views: 1,565

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:
524
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;
       }
            } 

marcopolo
Zen Cart 2.2.2 | PHP 8.5.12 | MariaDB 10.11.14

19 Mar 2016, 8:27 PM
#22
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

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

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

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

marcopolo

Totally Zenned

Join Date:
May 2008
Location:
United States
Posts:
524
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!

marcopolo
Zen Cart 2.2.2 | PHP 8.5.12 | MariaDB 10.11.14