0
I have a condition in my form that calculates the delivery time of orders, follows below the rule:
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 made before 11am arrive at 12pm at the customer, and orders made after 11am arrive 69 minutes later. That is, current time ($Now) + 69 minutes.
What I need is to create a rule where $Horaservico is based on the delivery amount $delivery
Example: If the delivery fee costs R$ 7,00 then the delivery time will be the sum of the current time ($Now) + 120 minutes.
If the delivery fee costs R$ 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 fee (pq is far) the more time it will cost to deliver.
I don’t 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 so, but it’s not going! It’s always adding with the middle option, where the $entrega
is equal to R $ 2,00 - staying in the case 30 minutes to add with current time.
From what I understand, he’s not correctly computing the delivery rate ($entrega = $_POST["taxadeentrega"];
)
In short, $entrega
read the form field:
The code for this field in the form is:
<tr>
<td>Taxa de Entrega:</td>
<td><span id="idTaxa"></span></td>
</tr>
Okay, what’s your problem? It’s not clear.
– Renato Junior
And in the case of
$Agora
be exactly11:00:00
?– Victor Stafusa
You know if the value of the field
idTaxa
of the form appears in the$_POST["taxadeentrega"]
? What is attributed to$entrega
after all?– Victor Stafusa