I have a condition on 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 ( $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)));
};
What I need is to create a rule where $HoraServico is based on the delivery value $entrega
Example: If the delivery fee costs $ 7.00 then the delivery time will be the sum of the current time ($Agora) + 120 minutes.
If the delivery fee costs $ 2.00 then the delivery time will be the sum of the current time ($Agora) + 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 tested like this, but it's not going! He is adding only the line:
$HoraServico = date('H:i:s', strtotime('+69 minute', strtotime($Agora)));
That is, always adding 69 minutes
As I understand it, he is not computing correctly the delivery rate that actually takes information from this line:
$entrega = $_POST["taxadeentrega"];
Sorry for the English, I'm Brazilian and I'm using a translator, in the community in Portuguese, nobody has answer!...
Aucun commentaire:
Enregistrer un commentaire