"cart.tpl", "debug"=>0); $template =& new Template($options); ////////////////////////////////////////////////////////////////////////////// ////////////////// Page content ////////////////////////////////////////////// $keys = array_keys($_SESSION["hermes_cart"]["id"]); foreach ($keys as $i) { $discount = 0; $query = "SELECT * FROM Spares WHERE TRIM(code)='".$_SESSION["hermes_cart"]["id"][$i]."'"; $result = mysql_query($query) or (error_handling(basename($_SERVER["PHP_SELF"])." - ".mysql_error()." - ".$query)); $line = mysql_fetch_assoc($result); $ItemName = $line["name"]; $ItemCode = $line["code"]; $ItemPrice = number_format($line["price"],2,'.',''); $PriceTotalItem = number_format($_SESSION["hermes_cart"]["quantity"][$i] * $ItemPrice,2,'.',''); $total_price = $total_price + $PriceTotalItem; $ItemQuantity = $_SESSION["hermes_cart"]["quantity"][$i]; $PricePerItem = sprintf("%01.2f", $ItemPrice); $PricePerItemPDV= sprintf("%01.2f", ($ItemPrice * 1.20)); $PriceTotalItem = sprintf("%01.2f", ($PriceTotalItem * 1.20)); $items[] = array("ItemCode"=>$ItemCode,"ItemName"=>$ItemName,"cart_id"=>$i,"ItemQuantity"=>$ItemQuantity,"PricePerItem"=>$PricePerItem,"PricePerItemPDV"=>$PricePerItemPDV,"PriceTotalItemPDV"=>$PriceTotalItem); } $template->AddParam('ISEMPTY', false); $template->AddParam('ISCART', true); if (count($_SESSION["hermes_cart"]["id"]) == 0) { $template->AddParam('ISEMPTY', true); $template->AddParam('ISCART', false); } $template->AddParam('items', $items); $total_pdv = $total_price * 0.20; $total_price_pdv = $total_price + $total_pdv; $MainContent = $template->Output(); $MainContent = str_replace("%total_price%", sprintf("%01.2f", $total_price), $MainContent); $MainContent = str_replace("%total_pdv%", sprintf("%01.2f", $total_pdv), $MainContent); $MainContent = str_replace("%total_price_pdv%", sprintf("%01.2f", $total_price_pdv), $MainContent); $MainContent = str_replace("%notice%", '', $MainContent); //////////////// Page output ///////////////////////////////////////////////// echo $MainContent; ////////////////////////////////////////////////////////////////////////////// /* Developed by ing. Janos Sabo */ ?>