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 == '3.80'){
$HoraServico = date('H:i:s', strtotime('+30 minute', strtotime($Agora)));
}
else if ( $entrega == '7.0'){
$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!...
Just for the knowledge of you, it follows part of the code that calculates the value of the freight, this excerpt is in a JS file.
}if(cep == "20010-020" || cep == "20011-020" || cep == "20011-030" || cep == "20011-040" || cep == "20011-901" || cep == "20020-000" || cep == "20010-170" || cep == "20011-000" || cep == "20021-260" || cep == "20031-040" || cep == "20031-050" || cep == "20031-130" || cep == "20031-204" || cep == "20021-245" || cep == "20040-002" || cep == "21335-253" || cep == "20040-031" || cep == "20030-041" || cep == "20040-000" || cep == "20004-002" || cep == "20040-003" || cep == "20040-007" || cep == "20030-042" || cep == "20011-010"){
//se for um dos ceps acima, incrementa 1.7 no valor final
taxa = 2.00;
}if(cep == "20010-090" || cep == "20020-100" || cep == "20021-130" || cep == "20021-315" || cep == "20030-001" || cep == "20031-000" || cep == "20031-003" || cep == "20031-010" || cep == "20031-050" || cep == "20031-141" || cep == "20031-143" || cep == "20031-005" || cep == "20031-001" || cep == "20020-903" || cep == "20031-144" || cep == "20030-080" || cep == "20031-142" || cep == "20031-120" || cep == "20031-007" || cep == "20010-009" || cep == "20031-913" || cep == "20021-370" || cep == "20200-100" || cep == "20030-901" || cep == "20030-021" || cep == "20210-030" || cep == "24220-280"){
//se for um dos ceps acima, incrementa 1.2 no valor final
taxa = 1.50;
}if(cep == "20020-010"|| cep == "22050-032" || cep == "20020-040" || cep == "20020-080" || cep == "20021-060" || cep == "20021-120" || cep == "20021-900" || cep == "20021-903" || cep == "20030-002" || cep == "20030-015" || cep == "20030-013" || cep == "20030-020" || cep == "20030-021" || cep == "20030-060" || cep == "20030-070" || cep == "20030-120" || cep == "20002-080" || cep == "20002-008" || cep == "20003-021" || cep == "20030-905" || cep == "24220-031" || cep == "20002-010" || cep == "20030-015"){
//se for um dos ceps acima, incrementa 0.7 no valor final
taxa = 1.00;
}
total += taxa;
if(taxa != 0){
//caso a taxa seja diferente de 0, mostra ao usuário
document.getElementById("idTaxa").innerHTML = "Additional charge R$ " + taxa;
}
==
because=
is an assignment. 4. Oneelse
seems to be missing.