Jump to content

Recommended Posts

Hello...

 

I have the following.  But I want to change this.

 

- I need the script to check the $c_date field and if it's before June 1, 2007 then shipping will be the 7.95 + quantity, if not then it's going to be 8.95 + quantity.

 

I'm having a hard time with validating the date and creating the if/then.

 

How do I go about this?

 

Thanks!

<TD colspan="4"><div align="right"><B>Shipping & Handling</B></div></TD>

                            <TD><?

                            $shipping_handling = 7.95 + $total_quantity;

                            ?><?=$price_type_name?><?=format_price($shipping_handling)?></TD>

                        </TR>

                        <TR>

Link to comment
https://forums.phpfreaks.com/topic/53866-validating-dates/
Share on other sites

Hey again,

 

Okay.  Many thanks.  I tried both of those and tested it out.  ALL the orders are getting the 8.95 and it's making even records before June 1, 2007 get the 8.95 amount.  I think I'm messing up on the fields I'm using.

 

<?

$c_date = strtotime('06/01/2007');

if (time() < $c_date) {

    $shipping = 7.95;

}else {

  $shipping = 8.95;

}

$shipping_handling = $shipping + $total_quantity;

?>

 

Question - earlier in the code it pulls the date for the top of the report where this script is

 

$c_date = strtotime($order->create_date);

 

Should I be validating it against create_date instead of $c_date?

 

(do I hear laughing .... ? ha I think I'm getting the fields / rows mixed up)

Link to comment
https://forums.phpfreaks.com/topic/53866-validating-dates/#findComment-266315
Share on other sites

Many thanks.

 

I said screw it to using the date range.  I just used the report ID instead ... and it seems to work.  The last record of yesterday was 1078 so now .. all the records less then 1078 have the propert Amounts. *shrugs*

 

<?

 

if ($order->id < 1078) {

    $shipping_handling = 7.95 + $total_quantity;

}else {

  $shipping_handling = 8.95 + $total_quantity;

}

 

 

Thanks again....

Link to comment
https://forums.phpfreaks.com/topic/53866-validating-dates/#findComment-266325
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.