Jump to content

malnomany

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

malnomany's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you all for your replies. I really appreciate it. I did add a remove button to each item that any customer would choose from the list. but I still have a problem with the code itself. I didn't wirte the code as I am not an expert with php, this is why I am seeking help. when I click remove , it does remove the entry but when I add another item it gives me an empty entry and it miss the calculation. I am going to post the code so you will have a look at it, and if someone can edit it to get it work correctly, I will be really gratefull to him. and if not, is it possible for someone to write another code from the begining to make an order form like the one on the website ? a better code I mean that allow customers to remove any item they choose from the list. will be waiting for answers with patience. thanks in advance for everyone. here's the current 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 = ( $Quantity * $ProductPrice) ; $OrderPrice = ( $_SESSION['OrderPrice'] + $Totalprice); $_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']) // this is the code of the remove button which doesn't work $OrderPrice = ( $_SESSION['OrderPrice'] -$toRemove);s $toRemove = ($_REQUEST['productPrice'])*($_REQUEST['quantity']); $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){ ?>
  2. Hello all, thought I am not expert with PHP but I could create a simple shopping cart for my website but I need help developping it. hope someone will help me out. I need to add a remove button to each item in the table when a user select an item from the list and have the calculation work as well. here is the website: www.clothesmanufacture.com anyone can help ?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.