Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping through Cart

Status
Not open for further replies.

tshey

Technical User
Dec 28, 2005
78
AU
I have a cart that has hidden fields that I want to pass to paypal. It is passing one variable at a time only. How do I fix this? Can I use a for loop, if so can I please have an example? The code is as follows
Code:
		<form name="frmCart" method="get"  action="[URL unfurl="true"]https://www.paypal.com/cgi-bin/webscr">[/URL]
		<input type="hidden" name="cmd" value="_cart">
        <input type="hidden" name="upload" value="1">
        <input type="hidden" name="business" value="chris.n@vacuumshop.com.au">
		
		<table width="100%" cellspacing="0" cellpadding="0" border="0">
			<tr class="green">
				<td width="15%" height="25">
						&nbsp;&nbsp;Qty
				</td>
				<td width="55%" height="25">
						Product
				</td>
				<td width="15%" height="25" >
						Price Each
				</td>
				<td width="15%" height="25" >
					&nbsp;Remove Item </td>
			</tr>
			<?php
			while($row = mysql_fetch_array($result))
			{
				// Increment the total cost of all items
				$totalCost += ($row["qty"] * $row["itemPrice"]);
				?>
					<tr>
						<td width="15%" height="25">
								<select name="<?php echo $row["itemId"]; ?>" onChange="UpdateQty(this)">
								<?php
								
									for($i = 1; $i <= 20; $i++)
									{
										echo "<option ";
										if($row["qty"] == $i)
										{
											echo " SELECTED ";
										}
										echo ">" . $i . "</option>";
									}
								?>
								</select>
								<input type="hidden" name="quantity_1" value="<?php echo $row["qty"];?>">
						</td>
						<td width="55%" height="25">
								<?php echo $row["item_name"]; ?>
								<input type="hidden" name="item_name_1" value="<?php echo $row["item_name"]; ?>">
								
						</td>
						<td width="20%" height="25">
								$<?php echo number_format($row["itemPrice"], 2, ".", ","); ?>
								<input type="hidden" name="amount_1" value="<?php echo number_format($row["itemPrice"], 2, ".", ","); ?>">
						</td>
						<td width="10%" height="25">
								<a href="cart.php?action=remove_item&id=<?php echo $row["itemId"]; ?>">Remove</a>
							
						</td>
					</tr>
				<?php
			}
			
			// Display the total
			?>
					<tr>
						<td width="100%" colspan="4">
							<hr />
						</td>
					</tr>
					<tr>
						<td width="70%" colspan="2">
						</td>
						<td width="30%" colspan="2">
								<b>Total: $<?php echo number_format($totalCost, 2, ".", ","); ?></b>
						</td>
					</tr>
		  </table>
		
		
		<table width="100%"  border="0" cellpadding="2">
  <tr>
    <td>&nbsp;</td>
    <td>




<input type="hidden" name="currency_code" value="AUD">

<input type="image" src="[URL unfurl="true"]https://www.paypal.com/en_US/i/btn/x-click-but23.gif"[/URL] border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="[URL unfurl="true"]https://www.paypal.com/en_AU/i/scr/pixel.gif"[/URL] width="1" height="1">


</form>
 
instead of naming a field element
Code:
name="amount_1"
name it
Code:
name="amount_$cnt"
then before your while loop add the following line
Code:
$cnt =0;
and as the first line of your while loop add
Code:
$cnt++;
 
It doesn't work in the while loop as it erases every thing in my cart, could I add a for loop with every hidden field. So when it is sent to paypal it sends all items in the cart?
Code:
<input type="text" name="item_name_$cnt" value="<?php echo $row["item_name"]; ?>"
	<?php
		$cnt =0;
		for($cnt = 1; $cnt <= 20; $cnt++)
			{
				echo 
				($row["item_name"] == $cnt);
										
			}
	?>>
But this doesn't work, so what am I doing wrong?
 
can you be a bit clearer? i don't understand how your while loop erases your shopping cart. i can't see the code in the snip you provided that could do this.

to continue, can we go back to some very simple examples of your code containing just:

1. a description (sql or array shape) of how you hold you cart data
2. a single field in a form outputted "n" times depending on the cart quantity.

it is much easier to diagnose coding issues if we go back to these initial principles. everything else i think that you need to do (formatting, other fields, etc) scales from these two basic premises.

i'm around all morning and am happy to help.
 
Hi, thankyou for your persistance with me! On the items page it passes the item id with
Code:
<a href="cart.php?action=add_item&id=<?php echo $row_items["itemId"]; ?>&qty=1">Add Item</a>
the cart page code:
Code:
<?php

	include("db.php");
		//switch statement like the if statement except it allows the condition to take more than two values. In an if statement the condition can be either true or false unless using curvy brackets, within a switch can take any number of different values.
	switch($_GET["action"])
	{
	//You need case statement to handle each value to react to, and default case to handle any that you do not provide a specific case statement for. So instead of multiple entries of elseif to find item, e.g if($find== '2') echo'vacuum1' elseif ($find=='3') etc you simply add the functions. 
		case "add_item":
		{
			AddItem($_GET["id"], $_GET["qty"]);
			ShowCart();
			break;
		}
		//When a case statement in a switch  is activated, php executes statements until it reaches a break statement. Without these a switch would execute all the code as true.
		case "update_item":
		{
			UpdateItem($_GET["id"], $_GET["qty"]);
			ShowCart();
			break;
		}
		case "remove_item":
		{
			RemoveItem($_GET["id"]);
			ShowCart();
			break;
		}
		default:
		{
			ShowCart();
		}
	}

	function AddItem($itemId, $qty)
	{
		// Will check whether or not this item
		// already exists in the cart table.
		// If it does, the UpdateItem function
		// will be called instead
		
		global $dbServer, $dbUser, $dbPass, $dbName;

		// Get a connection to the database
		$cxn = @ConnectToDb($dbServer, $dbUser, $dbPass, $dbName);
		
		// Check if this item already exists in the users cart table
		$result = mysql_query("select count(*) from cart where cookieId = '" . GetCartId() . "' and itemId = $itemId");
		$row = mysql_fetch_row($result);
		$numRows = $row[0];
		
		if($numRows == 0)
		{
			// This item doesn't exist in the users cart,
			// we will add it with an insert query

			@mysql_query("insert into cart(cookieId, itemId, qty) values('" . GetCartId() . "', $itemId, $qty)");
		}
		else
		{
			// This item already exists in the users cart,
			// we will update it instead
			
			UpdateItem($itemId, $qty);
		}
	}
	
	function UpdateItem($itemId, $qty)
	{
		// Updates the quantity of an item in the users cart.
		// If the qutnaity is zero, then RemoveItem will be
		// called instead

		global $dbServer, $dbUser, $dbPass, $dbName;

		// Get a connection to the database
		$cxn = @ConnectToDb($dbServer, $dbUser, $dbPass, $dbName);
		
		if($qty == 0)
		{
			// Remove the item from the users cart
			RemoveItem($itemId);
		}
		else
		{
			mysql_query("update cart set qty = $qty where cookieId = '" . GetCartId() . "' and itemId = $itemId");
		}
	}
	
	function RemoveItem($itemId)
	{
		// Uses an SQL delete statement to remove an item from
		// the users cart

		global $dbServer, $dbUser, $dbPass, $dbName;

		// Get a connection to the database
		$cxn = @ConnectToDb($dbServer, $dbUser, $dbPass, $dbName);
		
		mysql_query("delete from cart where cookieId = '" . GetCartId() . "' and itemId = $itemId");
	}
	
	function ShowCart()
	{
		// Gets each item from the cart table and display them in
		// a tabulated format, as well as a final total for the cart
		
		global $dbServer, $dbUser, $dbPass, $dbName;

		// Get a connection to the database
		$cxn = @ConnectToDb($dbServer, $dbUser, $dbPass, $dbName);
		
		$totalCost = 0;
		$result = mysql_query("select * from cart inner join items on cart.itemId = items.itemId where cart.cookieId = '" . GetCartId() . "' order by items.item_name asc");
		?>
		<html>
		<head>
		<title> Your Shopping Cart </title>
		<script language="JavaScript">
		
			function UpdateQty(item)
			{
				itemId = item.name;
				newQty = item.options[item.selectedIndex].text;
				
				document.location.href = 'cart.php?action=update_item&id='+itemId+'&qty='+newQty;
			}
		
		</script>
		<link href="vac.css" rel="stylesheet" type="text/css">
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body,td,th {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #000000;
}
-->
</style>
</head>
		<body bgcolor="#ffffff">
		<div id="head">Your Shopping Cart</div>
		<div id="cleanercontent">
		<form name="frmCart" method="get"  action="[URL unfurl="true"]https://www.paypal.com/cgi-bin/webscr">[/URL]
		<input type="hidden" name="cmd" value="_cart">
        <input type="hidden" name="upload" value="1">
        <input type="hidden" name="business" value="chris.n@vacuumshop.com.au">
		
		<table width="100%" cellspacing="0" cellpadding="0" border="0">
			<tr class="green">
				<td width="15%" height="25">
						&nbsp;&nbsp;Qty
				</td>
				<td width="55%" height="25">
						Product
				</td>
				<td width="15%" height="25" >
						Price Each
				</td>
				<td width="15%" height="25" >
					&nbsp;Remove Item </td>
			</tr>
			<?php
			while($row = mysql_fetch_array($result))
			{
				// Increment the total cost of all items
				$totalCost += ($row["qty"] * $row["itemPrice"]);
				?>
					<tr>
						<td width="15%" height="25">
								<select name="<?php echo $row["itemId"]; ?>" onChange="UpdateQty(this)">
								<?php
								
									for($i = 1; $i <= 20; $i++)
									{
										echo "<option ";
										if($row["qty"] == $i)
										{
											echo " SELECTED ";
										}
										echo ">" . $i . "</option>";
									}
								?>
								</select>

								<input type="hidden" name="quantity_1" value="<?php echo $row["qty"];?>"
								>
						</td>
						<td width="55%" height="25">
								<?php echo $row["item_name"]; ?>
								[b]<input type="hidden" name="item_name_$cnt" value="<?php echo $row["item_name"]; ?>"
								<?php
								$cnt =0;
			           while($row = mysql_fetch_array($item_name))
					   $cnt++;
			             {
						 $row["item_name"];
						 }
						 ?>>[/b]
								
								
						</td>
						<td width="20%" height="25">
								$<?php echo number_format($row["itemPrice"], 2, ".", ","); ?>
								<input type="hidden" name="amount_1" value="<?php echo number_format($row["itemPrice"], 2, ".", ","); ?>">
						</td>
						<td width="10%" height="25">
								<a href="cart.php?action=remove_item&id=<?php echo $row["itemId"]; ?>">Remove</a>
							
						</td>
					</tr>
				<?php
			}
			
			// Display the total
			?>
					<tr>
						<td width="100%" colspan="4">
							<hr />
						</td>
					</tr>
					<tr>
						<td width="70%" colspan="2">
						</td>
						<td width="30%" colspan="2">
								<b>Total: $<?php echo number_format($totalCost, 2, ".", ","); ?></b>
						</td>
					</tr>
		  </table>
		
		
		
  <tr>
  <td></td>
    <td>
     <a href = "javascript:history.back()"> <input type="button" name="Button" value="Keep Shopping"></a></td>
    <td>
<input type="hidden" name="currency_code" value="AUD">

<input name="submit" type="submit" value="Checkout" alt="Make payments with PayPal - it's fast, free and secure!"  border="0">
<img alt="" border="0" src="[URL unfurl="true"]https://www.paypal.com/en_AU/i/scr/pixel.gif"[/URL] width="1" height="1">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHFgYJKoZIhvcNAQcEoIIHBzCCBwMCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQK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SrFMM75wnPLMiM+hZ0wMJc2hhB4yiWh1/O4DWKPTefk39cPKsRQaoDuFpeeINiP+eBmVKeMtuLNgmfSnxap1bN8EAneJaedy7mcqNdfV33poRPHU5MthAq7l7N/KLcWu0GRz8ZGi-----END PKCS7-----
">

</form></td>
  </tr>
</div>
		</body>
</html>
			<?php
	}

?>

I need it to when the submit checkout button is clicked it passes all items, quantity and amounts to paypal. It has to be received to paypal listed like item_name_1, item_name_2 etc. Would it be better if I set up a separate form for the hidden fields? I hope this helps
 
that paypal cert really messes up this site's css.

have you considered what to do if the price of the item changes between being added to the cart and being checkedout? for that reason i tend to include the item price in the cart (as at the time of selection). you can always script an override into your price update script (which will iterate through carts and change the values.

anyway - your code was a bit of a hotch potch in the showcart function. you were looping the db rows inside the original loop, for one problem. I have (I hope) simplified the showcart function. I've also included another function which assembles the paypal code for you, row by row. lastly i have added the item code to the information you submit to paypal to make stock and customer query reconciliations easier to handle.

note that your script currently does not deal with shipping costs.

to make this code snip work, replace the current showcart function with the entirety of this code. ie so you get the $paypalitems in the global scope and the new function all inserted in the right place (i think it is possible to have functions within functions but i'm sure it's not great practice).

Note: i do not have your database schema nor any test data so I have not been able to test this script (but i am not getting any parse errors).

Code:
<?
$paypalitems = "";
function addpaypalitem ($data) {
	global $paypalitems;
	$i = count ($paypalitems) + 1;
	$price = number_format($row["itemPrice"], 2, ".", ",");
	$paypalitems .= <<<STR
	<input type="hidden" name="quantity_$i" value="{$data['qty']}"/>
	<input type="hidden" name="item_name_$i" value="{$data['item_name']}" />
	<input type="hidden" name="amount_$i" value="$price" />
	<input type="hidden" name="item_number_$i" value="{$data['itemID']}"/>

STR;
}

function ShowCart() {
        // Gets each item from the cart table and display them in
        // a tabulated format, as well as a final total for the cart
        
        global $dbServer, $dbUser, $dbPass, $dbName;
		global $paypalitems;
        // Get a connection to the database
        $cxn = @ConnectToDb($dbServer, $dbUser, $dbPass, $dbName);
        
        $totalCost = 0;
        $result = mysql_query("select * from cart inner join items on cart.itemId = items.itemId where cart.cookieId = '" . GetCartId() . "' order by items.item_name asc");
        ?>
<html>
<head>
<title> Your Shopping Cart </title>
<script language="JavaScript" type="text/javascript">
        
            function UpdateQty(item)
            {
                itemId = item.name;
                newQty = item.options[item.selectedIndex].text;
                
                document.location.href = 'cart.php?action=update_item&id='+itemId+'&qty='+newQty;
            }
        
</script>
<link href="vac.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,th {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #000000;
}
-->
</style>
</head>
        <body bgcolor="#ffffff">
        <div id="head">Your Shopping Cart</div>
        <div id="cleanercontent">

<?
while($row = mysql_fetch_assoc($result)){

	// Increment the total cost of all items
    $totalCost += ($row["qty"] * $row["itemPrice"]);
	addpaypalitem ($row);
?>
<tr>
	<td width="15%" height="25">
		<select name="<?=$row["itemId"]?>" onChange="UpdateQty(this)">
		<? for ($i=1; $i<=20;$i++): ?>
		<option value=<? echo "\"$i\""; echo ($row['qty'] == $i)?"selected":""; ?>><?=$i?></option>
		<? endfor; ?>
		</select>
		<? addpaypalfield("quantity", "item_name", "amount"); ?>
	</td>
	<td width="55%" height="25">
		<?=$row["item_name"]?>
	</td>
	<td width="20%" height="25">
		<? echo number_format($row["itemPrice"], 2, ".", ","); ?>
	</td>
	<td width="10%" height="25">
			<a href="cart.php?action=remove_item&id=<?=$row["itemId"]?>">Remove</a>
	</td>
</tr>
<? } ?>
<tr>
	<td width="100%" colspan="4">
		<hr />
	</td>
</tr>
<tr>
	<td width="70%" colspan="2">
	&nbsp;
	</td>
	<td width="30%" colspan="2">
			<b>Total: $<?php echo number_format($totalCost, 2, ".", ","); ?></b>
	</td>
</tr>
<tr>
	<td>
  &nbsp;
	</td>
	<td>
	<a href = "javascript:history.back()"> <input type="button" name="Button" value="Keep Shopping"></a>
	</td>
</tr>
</table>
<form name="frmCart" method="get"  action="[URL unfurl="true"]https://www.paypal.com/cgi-bin/webscr"[/URL] style="display:inline;">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="chris.n@vacuumshop.com.au">array();
<input type="hidden" name="currency_code" value="AUD">
<? echo $paypalitems; //now insert the hidden elements ?>
<input name="submit" type="submit" value="Checkout" alt="Make payments with PayPal - it's fast, free and secure!"  border="0">
<img alt="" border="0" src="[URL unfurl="true"]https://www.paypal.com/en_AU/i/scr/pixel.gif"[/URL] width="1" height="1">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHFgYJKoZIhvcNAQcEoIIHBzCCBwMCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYCsRKZm5zmRuT1MO7U5LsM8Xk8pD38exxRXPH6bdcgbl1wkjMWsGGlM94ZsRW3Ahz+VvWvT+x3uxH30Fge5b61en12ODaG2gJxYHLtYv6RJ35JY/SVxOhVBowc003zX71aoQRyWbL46JvIy2jRWF09Acq0SofDremaKG4NmCe7JPTELMAkGBSsOAwIaBQAwgZMGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIEsu/YzqYxBSAcIlfMbUAdw8VS3OXdau9w2NswcT9SbTVDVpEn2U4ic06UyXPsNikejJGBM7Uue02HQRWQF7Stjowj9fn3pp1n1HGOJQlrLMKXYHLKWikTjFSW2ViLuCLOq+rzosAhztd0MK5JhpXKp2Uv0fM0bF62JagggOHMIIDgzCCAuygAwIBAgIBADANBgkqhkiG9w0BAQUFADCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBW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qectsMAXpVHnD9wIyfmHMYIBmjCCAZYCAQEwgZQwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tAgEAMAkGBSsOAwIaBQCgXTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wNjA1MzEyMjU2MDhaMCMGCSqGSIb3DQEJBDEWBBTqtEL4q+jo/F6jl549atsbQtfu1DANBgkqhkiG9w0BAQEFAASBgJVIMczfjcebA3TkGPlq1uP2Q2xNPuyvZEQ4SrFMM75wnPLMiM+hZ0wMJc2hhB4yiWh1/O4DWKPTefk39cPKsRQaoDuFpeeINiP+eBmVKeMtuLNgmfSnxap1bN8EAneJaedy7mcqNdfV33poRPHU5MthAq7l7N/KLcWu0GRz8ZGi-----END PKCS7-----
">
</form>
	</div>
</body>
</html>
<? } //end the function braces ?>
 
Thankyou for your posts, I will play with it a bit, it does not seem to be showing at all in the browser. Any ideas?
 
I forgot to start the table with <table> put this before the while loop.
 
You are a legend, and I envy your php ability to the max. but it still does not show in a browser. I have put it in dreamweaver and the <? tag at the paypal function doesn't seem to be active. does that make sense? I will continue to play, keep the ideas coming.
 
there may be an error message in the source code.

i suspect that the code is failing at one of these two lines
Code:
      $cxn = @ConnectToDb($dbServer, $dbUser, $dbPass, $dbName);
//or
        $result = mysql_query("select * from cart inner join items on cart.itemId = items.itemId where cart.cookieId = '" . GetCartId() . "' order by items.item_name asc");
it will fail with a fatal error if either the ConnectToDb functino of the getCartId function are not available to the code. try commenting out these lines and retest. you will get some mysql errors but they won't be fatal and you should get the table structure outputted. if my suspicion in correct you will have to diagnose why those functions are not available to you code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top