05-28-2009, 09:33 PM
|
#7 (permalink)
|
|
The Wanderer
Join Date: May 2009
Posts: 6
Thanks: 0
|
here is the code the does the calculation
PHP Code:
<?
if($_POST['AddToCart'] && $_POST["ProductName"] || $_SESSION['CustomerOrder']){
if( $_POST["ProductName"] ){
$Order = array();
$ShoppingSession = array();
$IdProduct = $_POST['IdProduct'];
$ProductName = $_POST['ProductName'];
$Size = $_POST['Size'];
$Quantity = $_POST['Quantity'];
$ProductPrice = ($_POST['ProductPrice']) ;
$Totalprice = number_format( $Quantity * $ProductPrice,02) ;
$OrderPrice = number_format( $_SESSION['OrderPrice'] + $Totalprice,02 );
$_SESSION['OrderPrice'] = $OrderPrice;
$CustomerOrder = $_SESSION['CustomerOrder'].'--'.$IdProduct.'|'.$ProductName.'|'.$Size.'|'.$Quantity.'|'.$ProductPrice.'|'.$Totalprice.'|'.$OrderPrice;
$CustomerOrder = trim($CustomerOrder,'--');
$_SESSION['CustomerOrder'] = $CustomerOrder;
// echo $CustomerOrder;
$CustomerOrderArray = split('--',$CustomerOrder);
}else{
$CustomerOrder = $_SESSION['CustomerOrder'] ;
$CustomerOrder = trim($CustomerOrder,'--');
$CustomerOrderArray = split('--',$CustomerOrder);
}
if($_REQUEST['r']){
$CustomerOrderArray = split('--',$CustomerOrder);
$CustomerOrderArray[$_REQUEST['IdShopping']]='';
$CustomerOrder = '';
foreach($CustomerOrderArray as $ke=>$val){
$CustomerOrder .= '--'.$val;
}
$_SESSION['CustomerOrder']=$CustomerOrder ;
$CustomerOrder = str_replace('----','',$CustomerOrder);
$CustomerOrder = trim($CustomerOrder,'--');
$CustomerOrderArray = split('--',$CustomerOrder);
}
if ( $CustomerOrder){
?>
malnomany
View Public Profile
Find More Posts by malnomany
Add malnomany to Your Contacts
|
|
|
|