I have a condition in my form that calculates the delivery time of the orders, follows the rule below:
date_default_timezone_set('America/Sao_Paulo');
$Agora = date('H:i:s');
$HoraServico = date('H:i:s', strtotime('+69 minute', strtotime($Agora)));
if ( $Agora < '11:00:00'){
$HoraServico = '12:00:00';
}
else if ( $Agora > '11:00:00' ){
$HoraServico == $HoraServico;
};
Today all orders placed before 11am arrive at 12am on the client, and orders placed after 11am arrive 69 minutes later. That is, current time ($ Now) + 69 minutes.
What I need to do is create a rule where $ HourService is based on the delivery value $ delivery
Example: If the delivery fee is $ 7.00 then the delivery time will be the sum of the current time ($ Now) + 120 minutes.
If the delivery fee is $ 2.00 then the delivery time will be the sum of the current time ($ Now) + 30 minutes. And so on.
The idea is, the more expensive the delivery rate (because it is far) the more time it will cost to deliver.
I do not know if it would be like this:
date_default_timezone_set('America/Sao_Paulo');
$Agora = date('H:i:s');
$HoraServico = date('H:i:s', strtotime('+69 minute', strtotime($Agora)));
if ( $entrega = '5.00'){
$HoraServico = date('H:i:s', strtotime('+120 minute', strtotime($Agora)));
}
if ( $entrega = '2.00'){
$HoraServico = date('H:i:s', strtotime('+30 minute', strtotime($Agora)));
}
else if ( $entrega = '7.00'){
$HoraServico = date('H:i:s', strtotime('+20 minute', strtotime($Agora)));
};
I tested like this, but it's not going! It is always adding the middle option, where $entrega
is equal to $ 2.00 - being in the case 30 minutes to add with current time.
As I understand it, it is not computing the delivery rate correctly ( $entrega = $_POST["taxadeentrega"];
)
In short, $entrega
read the form field:
Thecodeforthisfieldintheformis:
<tr><td>TaxadeEntrega:</td><td><spanid="idTaxa"></span></td>
</tr>