4
I’m having a problem finding the highest value of the box width of the products for shipping a site I’m doing.
I put the data of the products with the size of the boxes in the database and I am now doing the calculations. I needed to add the weight and heights as the customer requested and now I need to take the largest length and width of a set of products, but I’m not able to do it...
If anyone can help would be great, follow the code below:
$total = 0;
$alturaTotal = 0;
$pesoTotal = 0;
$larguraTotal = 0;
foreach($_SESSION['carrinho'] as $id => $quantidade)
{
$sql = "SELECT * FROM produtos WHERE id = '$id'";
$query = mysql_query($sql);
while($row = mysql_fetch_assoc($query))
{
$produto = $row['nome'];
$preco = $row['preco'];
$id = $row['id'];
$altura = $row['altura'];
$largura = $row['largura'];
$comprimento = $row['comprimento'];
$peso = $row['peso'];
$cepOrigem = $row['cepOrigem'];
$sub = $preco * $quantidade;
$total = $total + $sub;
$alturaTotal = $alturaTotal + $altura;
$pesoTotal = $pesoTotal + $peso;
foreach($_SESSION['carrinho'] as $id => $largura)
{
$larguraTotal = $largura;
}
Dude Big Brother really helped the/
– Leonardo Silva