Jump to content

Problem with my Cart page


Dominee

Recommended Posts

 

Hi people,

 

I got a problem with my Cart page.

 

My Cart page was working well when I tested it, till I added a product into my cart.

I get this error now:

Fatal error: Call to undefined function money_format() in E:\HostingSpaces\Poets\poetsproduct.nl\wwwroot\cart.php on line 122

 

I hope you can help me.

 

Here is the code of my cart page.

<?php
session_start(); // Must start session first thing
// Here we run a login check
if (!isset($_SESSION['id'])) { 
   echo '<a href="login.php">log in</a> om toegang te krijgen tot je account.';
   exit(); 
}
// Script Error Reporting
error_reporting(E_ALL);
ini_set('display_errors', '1');
// Connect to the MySQL database  
include "storescripts/connect_to_mysql.php"; 
?>
<?php 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//       Section 1 (if user attempts to add something to the cart from the product page)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (isset($_POST['pid'])) {
    $pid = $_POST['pid'];
$wasFound = false;
$i = 0;
// If the cart session variable is not set or cart array is empty
if (!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) < 1) { 
    // RUN IF THE CART IS EMPTY OR NOT SET
	$_SESSION["cart_array"] = array(0 => array("item_id" => $pid, "quantity" => 1));
} else {
	// RUN IF THE CART HAS AT LEAST ONE ITEM IN IT
	foreach ($_SESSION["cart_array"] as $each_item) { 
	      $i++;
	      while (list($key, $value) = each($each_item)) {
			  if ($key == "item_id" && $value == $pid) {
				  // That item is in cart already so let's adjust its quantity using array_splice()
				  array_splice($_SESSION["cart_array"], $i-1, 1, array(array("item_id" => $pid, "quantity" => $each_item['quantity'] + 1)));
				  $wasFound = true;
			  } // close if condition
	      } // close while loop
       } // close foreach loop
	   if ($wasFound == false) {
		   array_push($_SESSION["cart_array"], array("item_id" => $pid, "quantity" => 1));
	   }
}
header("location: cart.php"); 
    exit();
}
?>
<?php 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//       Section 2 (if user chooses to empty their shopping cart)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (isset($_GET['cmd']) && $_GET['cmd'] == "emptycart") {
    unset($_SESSION["cart_array"]);
}
?>
<?php 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//       Section 3 (if user chooses to adjust item quantity)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (isset($_POST['item_to_adjust']) && $_POST['item_to_adjust'] != "") {
    // execute some code
$item_to_adjust = $_POST['item_to_adjust'];
$quantity = $_POST['quantity'];
$quantity = preg_replace('#[^0-9]#i', '', $quantity); // filter everything but numbers
if ($quantity >= 100) { $quantity = 99; }
if ($quantity < 1) { $quantity = 1; }
if ($quantity == "") { $quantity = 1; }
$i = 0;
foreach ($_SESSION["cart_array"] as $each_item) { 
	      $i++;
	      while (list($key, $value) = each($each_item)) {
			  if ($key == "item_id" && $value == $item_to_adjust) {
				  // That item is in cart already so let's adjust its quantity using array_splice()
				  array_splice($_SESSION["cart_array"], $i-1, 1, array(array("item_id" => $item_to_adjust, "quantity" => $quantity)));
			  } // close if condition
	      } // close while loop
} // close foreach loop
}
?>
<?php 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//       Section 4 (if user wants to remove an item from cart)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (isset($_POST['index_to_remove']) && $_POST['index_to_remove'] != "") {
    // Access the array and run code to remove that array index
	$key_to_remove = $_POST['index_to_remove'];
if (count($_SESSION["cart_array"]) <= 1) {
	unset($_SESSION["cart_array"]);
} else {
	unset($_SESSION["cart_array"]["$key_to_remove"]);
	sort($_SESSION["cart_array"]);
}
}
?>
<?php 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//       Section 5  (render the cart for the user to view on the page)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$cartOutput = "";
$cartTotal = "";
$pp_checkout_btn = '';
$product_id_array = '';
if (!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) < 1) {
    $cartOutput = "<h2 align='center'>Uw winkelwagen is leeg</h2>";
} else {
// Start PayPal Checkout Button
$pp_checkout_btn .= '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_cart">
    <input type="hidden" name="upload" value="1">
    <input type="hidden" name="business" value="Sunrise_20@live.nl">';
// Start the For Each loop
$i = 0; 
    foreach ($_SESSION["cart_array"] as $each_item) { 
	$item_id = $each_item['item_id'];
	$sql = mysql_query("SELECT * FROM products WHERE id='$item_id' LIMIT 1");
	while ($row = mysql_fetch_array($sql)) {
		$product_name = $row["product_name"];
		$price = $row["price"];
		$details = $row["details"];
	}
	$pricetotal = $price * $each_item['quantity'];
	$cartTotal = $pricetotal + $cartTotal;
	setlocale(LC_MONETARY, "en_US");
        $pricetotal = money_format("%10.2n", $pricetotal);
	// Dynamic Checkout Btn Assembly
	$x = $i + 1;
	$pp_checkout_btn .= '<input type="hidden" name="item_name_' . $x . '" value="' . $product_name . '">
        <input type="hidden" name="amount_' . $x . '" value="' . $price . '">
        <input type="hidden" name="quantity_' . $x . '" value="' . $each_item['quantity'] . '">  ';
	// Create the product array variable
	$product_id_array .= "$item_id-".$each_item['quantity'].","; 
	// Dynamic table row assembly
	$cartOutput .= "<tr>";
	$cartOutput .= '<td><a href="product.php?id=' . $item_id . '">' . $product_name . '</a><br /><img src="inventory_images/' . $item_id . '.jpg" alt="' . $product_name. '" width="40" height="52" border="1" /></td>';
	$cartOutput .= '<td>' . $details . '</td>';
	$cartOutput .= '<td>$' . $price . '</td>';
	$cartOutput .= '<td><form action="cart.php" method="post">
	<input name="quantity" type="text" value="' . $each_item['quantity'] . '" size="1" maxlength="2" />
	<input name="adjustBtn' . $item_id . '" type="submit" value="change" />
	<input name="item_to_adjust" type="hidden" value="' . $item_id . '" />
	</form></td>';
	//$cartOutput .= '<td>' . $each_item['quantity'] . '</td>';
	$cartOutput .= '<td>' . $pricetotal . '</td>';
	$cartOutput .= '<td><form action="cart.php" method="post"><input name="deleteBtn' . $item_id . '" type="submit" value="X" /><input name="index_to_remove" type="hidden" value="' . $i . '" /></form></td>';
	$cartOutput .= '</tr>';
	$i++; 
    } 
setlocale(LC_MONETARY, "en_US");
    $cartTotal = money_format("%10.2n", $cartTotal);
$cartTotal = "<div style='font-size:18px; margin-top:12px;' align='right'>Cart Total : ".$cartTotal." USD</div>";
    // Finish the Paypal Checkout Btn
$pp_checkout_btn .= '<input type="hidden" name="custom" value="' . $product_id_array . '">
<input type="hidden" name="notify_url" value="https://www.poetsproduct.nl/storescripts/my_ipn.php">
<input type="hidden" name="return" value="https://www.poetsproduct.nl/index.php">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="cbt" value="Return to The Store">
<input type="hidden" name="cancel_return" value="https://www.poetsproduct.nl/index.php">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - its fast, free and secure!">
</form>';
}
?>
<?php
session_start(); // Must start session first thing
$toplinks = "";
if (isset($_SESSION['id'])) {
// Put stored session variables into local php variable
    $userid = $_SESSION['id'];
    $username = $_SESSION['username'];
$toplinks = '<a href="member_profile.php?id=' . $userid . '">Welkom ' . $username . '</a> 
 • <a href="cart.php">Winkelwagen</a> • 
<a href="logout.php">Log uit</a>';
} else {
$toplinks = '<a href="join_form.php">Registreren</a> • <a href="login.php">Login</a>';
}
?>
<html>
<head>
<title>PoetsProduct | Winkelwagen</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<style type="text/css">
<!--
#Table_01 tr td p {
font-family: Arial, Helvetica, sans-serif;
}
#Table_01 tr td p a {
font-size: 12px;
}
#Table_01 tr td p a {
font-size: 10px;
}
body {
background-image: url(images/Stroke.png);
background-repeat: repeat-x;
}
-->
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('Rollover/images/New-15-07_28.png','Rollover/images/New-15-07_30-31.png','Rollover/images/New-15-07_31.png','Rollover/images/New-15-07_32.png','Rollover/images/New-15-07_34-35.png','Rollover/images/New-15-07_35.png','Rollover/images/New-15-07_12.png','Rollover/images/New-15-07_14.png','Rollover/images/New-15-07_16.png')">
<table align="center" id="Table_01" width="1201" height="951" border="0" cellpadding="0" cellspacing="0">
<tr>
	<td colspan="18">
		<img src="images/New-15-07_01.png" width="1200" height="11" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="11" alt=""></td>
</tr>
<tr>
	<td colspan="2" rowspan="15">
		<img src="images/New-15-07_02.png" width="57" height="355" alt=""></td>
	<td colspan="4" rowspan="5">
		<img src="images/New-15-07_03.png" width="271" height="70" alt=""></td>
	<td colspan="12">
		<img src="images/New-15-07_04.png" width="872" height="21" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="21" alt=""></td>
</tr>
<tr>
	<td colspan="7" rowspan="2">
		<img src="images/New-15-07_05.png" width="89" height="21" alt=""></td>
	<td width="307" height="49" rowspan="4" align="left" valign="middle" background="images/New-15-07_06.png" alt=""><?php echo $toplinks; ?>
		</td>
	<td colspan="4">
  <img src="images/New-15-07_07.png" width="476" height="8" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="8" alt=""></td>
</tr>
<tr>
	<td rowspan="4">
		<img src="images/New-15-07_08.png" width="135" height="69" alt=""></td>
	<td background="images/New-15-07_08-10.png" width="227" height="33" alt="" rowspan="2"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=229946050359156&xfbml=1"></script><fb:like href="http://www.facebook.com/pages/PoetsProduct/236503569702627" send="true" layout="button_count" width="75" show_faces="false" font="arial"></fb:like>
		</td>
	<td colspan="2" rowspan="4">
		<img src="images/New-15-07_10.png" width="114" height="69" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="13" alt=""></td>
</tr>
<tr>
	<td rowspan="3">
		<img src="images/New-15-07_11.png" width="2" height="56" alt=""></td>
	<td>
		<a href="http://www.facebook.com/pages/PoetsProduct/236503569702627">
      <img src="images/New-15-07_12.png" alt="" width="20" height="20" border="0" id="Image7" onMouseOver="MM_swapImage('Image7','','Rollover/images/New-15-07_12.png',1)" onMouseOut="MM_swapImgRestore()"></a></td>
	<td rowspan="3">
		<img src="images/New-15-07_13.png" width="3" height="56" alt=""></td>
	<td>
		<a href="https://twitter.com/#!/PoetsProduct">
      <img src="images/New-15-07_14.png" alt="" width="20" height="20" border="0" id="Image8" onMouseOver="MM_swapImage('Image8','','Rollover/images/New-15-07_14.png',1)" onMouseOut="MM_swapImgRestore()"></a></td>
	<td rowspan="3">
		<img src="images/New-15-07_15.png" width="3" height="56" alt=""></td>
	<td>
		<a href="http://hyves.nl/?pageid=AAXGFZMH1OG0O0C4K    ">
      <img src="images/New-15-07_16.png" alt="" width="20" height="20" border="0" id="Image9" onMouseOver="MM_swapImage('Image9','','Rollover/images/New-15-07_16.png',1)" onMouseOut="MM_swapImgRestore()"></a></td>
	<td rowspan="3">
		<img src="images/New-15-07_17.png" width="21" height="56" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="20" alt=""></td>
</tr>
<tr>
	<td rowspan="2">
		<img src="images/New-15-07_18.png" width="20" height="36" alt=""></td>
	<td rowspan="2">
		<img src="images/New-15-07_19.png" width="20" height="36" alt=""></td>
	<td rowspan="2">
		<img src="images/New-15-07_20.png" width="20" height="36" alt=""></td>
	<td rowspan="2">
		<img src="images/New-15-07_21.png" width="227" height="36" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="8" alt=""></td>
</tr>
<tr>
	<td colspan="4">
		<img src="images/New-15-07_22.png" width="271" height="28" alt=""></td>
	<td>
		<img src="images/New-15-07_23.png" width="307" height="28" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="28" alt=""></td>
</tr>
<tr>
	<td rowspan="2">
		<img src="images/New-15-07_24.png" width="1" height="82" alt=""></td>
	<td background="images/New-15-07_25.png" width="1038" height="62" alt="" colspan="14"><img src="images/Banner.png" width="1037" height="62" alt="Banner"></td>
	<td rowspan="15">
		<img src="images/New-15-07_26.png" width="104" height="841" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="62" alt=""></td>
</tr>
<tr>
	<td colspan="14">
		<img src="images/New-15-07_27.png" width="1038" height="20" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="20" alt=""></td>
</tr>
<tr>
	<td colspan="2">
		<a href="http://www.Poetsproduct.nl/index.php">
      <img src="images/New-15-07_28.png" alt="" width="157" height="28" border="0" id="Image1" onMouseOver="MM_swapImage('Image1','','Rollover/images/New-15-07_28.png',1)" onMouseOut="MM_swapImgRestore()"></a></td>
	<td rowspan="13">
		<img src="images/New-15-07_29.png" width="10" height="759" alt=""></td>
	<td width="872" height="759" colspan="12" rowspan="13" align="left" valign="top" background="images/New-15-07_30.png" alt=""><p><img src="images/Blanko.png" width="270" height="61" alt="Blank"><img src="images/Logo-PP-Winkelwagen.png" width="300" height="90" alt="Logo-Winkelwagen"></p><div style="margin:24px; text-align:left;">

    <br />
    <table width="100%" border="1" cellspacing="0" cellpadding="6">
      <tr>
        <td width="18%" bgcolor="#444c89"><strong id="Product">Product</strong></td>
        <td width="45%" bgcolor="#444c89"><strong id="Product_Description">Product beschrijving</strong></td>
        <td width="10%" bgcolor="#444c89"><strong id="Unit_Price">Prijs per</strong></td>
        <td width="9%" bgcolor="#444c89"><strong>Aantal</strong></td>
        <td width="9%" bgcolor="#444c89"><strong id="Total">Totaal</strong></td>
        <td width="9%" bgcolor="#444c89"><strong>Verwijder</strong></td>
      </tr>
     <?php echo $cartOutput; ?>
     <!-- <tr>
        <td> </td>
        <td> </td>
        <td> </td>
        <td> </td>
        <td> </td>
        <td> </td>
      </tr> -->
    </table>
    <?php echo $cartTotal; ?>
    <br />
<br />
<?php echo $pp_checkout_btn; ?>
    <br />
    <br />
    <a href="cart.php?cmd=emptycart">Klik hier om uw winkelwagen te legen</a>
</div>
	  </p>
      </p></td>
	<td>
		<img src="images/spacer.gif" width="1" height="28" alt=""></td>
</tr>
<tr>
	<td colspan="2">
		<a href="http://www.Poetsproduct.nl/Assortiment.php">
      <img src="images/New-15-07_30-32.png" alt="" width="157" height="29" border="0" id="Image2" onMouseOver="MM_swapImage('Image2','','Rollover/images/New-15-07_30-31.png',1)" onMouseOut="MM_swapImgRestore()"></a></td>
	<td>
		<img src="images/spacer.gif" width="1" height="29" alt=""></td>
</tr>
<tr>
	<td colspan="2">
		<a href="http://www.Poetsproduct.nl/Over_ons.php">
      <img src="images/New-15-07_31.png" alt="" width="157" height="27" border="0" id="Image3" onMouseOver="MM_swapImage('Image3','','Rollover/images/New-15-07_31.png',1)" onMouseOut="MM_swapImgRestore()"></a></td>
	<td>
		<img src="images/spacer.gif" width="1" height="27" alt=""></td>
</tr>
<tr>
	<td colspan="2">
		<a href="http://www.Poetsproduct.nl/Verzenden.php">
      <img src="images/New-15-07_32.png" alt="" width="157" height="28" border="0" id="Image4" onMouseOver="MM_swapImage('Image4','','Rollover/images/New-15-07_32.png',1)" onMouseOut="MM_swapImgRestore()"></a></td>
	<td>
		<img src="images/spacer.gif" width="1" height="28" alt=""></td>
</tr>
<tr>
	<td rowspan="3">
		<img src="images/New-15-07_34.png" width="1" height="63" alt=""></td>
	<td>
		<a href="http://www.Poetsproduct.nl/Betalen.php">
      <img src="images/New-15-07_34-36.png" alt="" width="156" height="26" border="0" id="Image5" onMouseOver="MM_swapImage('Image5','','Rollover/images/New-15-07_34-35.png',1)" onMouseOut="MM_swapImgRestore()"></a></td>
	<td>
		<img src="images/spacer.gif" width="1" height="26" alt=""></td>
</tr>
<tr>
	<td>
		<a href="http://www.Poetsproduct.nl/Contact.php">
      <img src="images/New-15-07_35.png" alt="" width="156" height="24" border="0" id="Image6" onMouseOver="MM_swapImage('Image6','','Rollover/images/New-15-07_35.png',1)" onMouseOut="MM_swapImgRestore()"></a></td>
	<td>
		<img src="images/spacer.gif" width="1" height="24" alt=""></td>
</tr>
<tr>
	<td>
		<img src="images/New-15-07_37.png" width="156" height="13" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="13" alt=""></td>
</tr>
<tr>
	<td rowspan="6">
		<img src="images/New-15-07_38.png" width="56" height="584" alt=""></td>
	<td colspan="3">
		<img src="images/New-15-07_39.png" width="158" height="29" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="29" alt=""></td>
</tr>
<tr>
	<td width="158" height="134" colspan="3" align="left" valign="top" background="images/New-15-07_40.png" alt=""><p><a href="#" onClick="javascript:window.open('https://www.paypal.com/nl/cgi-bin/webscr?cmd=xpt/Marketing/popup/OLCWhatIsPayPal-outside','olcwhatispaypal','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=400, height=350');"> <img src="images/Paypal.png" alt="Paypal" width="158" height="70" border="0"></a><span style="font-size: 12px"> U kunt ook uw bankrekening koppelen aan uw Paypal account.</span></p></td>
	<td>
		<img src="images/spacer.gif" width="1" height="134" alt=""></td>
</tr>
<tr>
	<td colspan="3">
		<img src="images/New-15-07_41.png" width="158" height="8" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="8" alt=""></td>
</tr>
<tr>
	<td rowspan="3">
		<img src="images/New-15-07_42.png" width="1" height="413" alt=""></td>
	<td colspan="2">
		<img src="images/New-15-07_43.png" width="157" height="30" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="30" alt=""></td>
</tr>
<tr>
	<td rowspan="2">
		<img src="images/New-15-07_44.png" width="1" height="383" alt=""></td>
	<td width="156" height="154" align="left" valign="top" background="images/New-15-07_45.png" style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;" alt="">Wij staan ingeschreven in het handelsregister bij de Kamer van Koophandel onder nummer: 53150074.</td>
	<td>
		<img src="images/spacer.gif" width="1" height="154" alt=""></td>
</tr>
<tr>
	<td>
		<img src="images/New-15-07_46.png" width="156" height="229" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="229" alt=""></td>
</tr>
<tr>
	<td>
		<img src="images/spacer.gif" width="56" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="156" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="10" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="104" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="2" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="20" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="3" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="20" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="3" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="20" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="21" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="307" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="135" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="227" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="10" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="104" height="1" alt=""></td>
	<td></td>
</tr>
</table>
</body>
</html>

 

Here is the code of my product page, for if you need it :)

<?php 
// Script Error Reporting
error_reporting(E_ALL);
ini_set('display_errors', '1');
?>
<?php 
// Check to see the URL variable is set and that it exists in the database
if (isset($_GET['id'])) {
// Connect to the MySQL database  
    include "storescripts/connect_to_mysql.php"; 
$id = preg_replace('#[^0-9]#i', '', $_GET['id']); 
// Use this var to check to see if this ID exists, if yes then get the product 
// details, if no then exit this script and give message why
$sql = mysql_query("SELECT * FROM products WHERE id='$id' LIMIT 1");
$productCount = mysql_num_rows($sql); // count the output amount
    if ($productCount > 0) {
	// get all the product details
	while($row = mysql_fetch_array($sql)){ 
		 $product_name = $row["product_name"];
		 $price = $row["price"];
		 $details = $row["details"];
		 $category = $row["category"];
		 $subcategory = $row["subcategory"];
		 $date_added = strftime("%b %d, %Y", strtotime($row["date_added"]));
         }

} else {
	echo "That item does not exist.";
    exit();
}

} else {
echo "Data to render this page is missing.";
exit();
}
mysql_close();
?>
<?php
session_start(); // Must start session first thing
$toplinks = "";
if (isset($_SESSION['id'])) {
// Put stored session variables into local php variable
    $userid = $_SESSION['id'];
    $username = $_SESSION['username'];
$toplinks = '<a href="member_profile.php?id=' . $userid . '">Welkom ' . $username . '</a> 
 • <a href="cart.php">Winkelwagen</a> • 
<a href="logout.php">Log uit</a>';
} else {
$toplinks = '<a href="join_form.php">Registreren</a> • <a href="login.php">Login</a>';
}
?>
<html>
<head>
<title>PoetsProduct | Webshop</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<style type="text/css">
<!--
#Table_01 tr td p {
font-family: Arial, Helvetica, sans-serif;
}
#Table_01 tr td p a {
font-size: 12px;
}
#Table_01 tr td p a {
font-size: 10px;
}
body {
background-image: url(images/Stroke.png);
background-repeat: repeat-x;
}
-->
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('Rollover/images/New-15-07_28.png','Rollover/images/New-15-07_30-31.png','Rollover/images/New-15-07_31.png','Rollover/images/New-15-07_32.png','Rollover/images/New-15-07_34-35.png','Rollover/images/New-15-07_35.png','Rollover/images/New-15-07_12.png','Rollover/images/New-15-07_14.png','Rollover/images/New-15-07_16.png')">
<table align="center" id="Table_01" width="1201" height="951" border="0" cellpadding="0" cellspacing="0">
<tr>
	<td colspan="18">
		<img src="images/New-15-07_01.png" width="1200" height="11" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="11" alt=""></td>
</tr>
<tr>
	<td colspan="2" rowspan="15">
		<img src="images/New-15-07_02.png" width="57" height="355" alt=""></td>
	<td colspan="4" rowspan="5">
		<img src="images/New-15-07_03.png" width="271" height="70" alt=""></td>
	<td colspan="12">
		<img src="images/New-15-07_04.png" width="872" height="21" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="21" alt=""></td>
</tr>
<tr>
	<td colspan="7" rowspan="2">
		<img src="images/New-15-07_05.png" width="89" height="21" alt=""></td>
	<td width="307" height="49" rowspan="4" align="left" valign="middle" background="images/New-15-07_06.png" alt=""><?php echo $toplinks; ?>
		</td>
	<td colspan="4">
  <img src="images/New-15-07_07.png" width="476" height="8" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="8" alt=""></td>
</tr>
<tr>
	<td rowspan="4">
		<img src="images/New-15-07_08.png" width="135" height="69" alt=""></td>
	<td background="images/New-15-07_08-10.png" width="227" height="33" alt="" rowspan="2"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=229946050359156&xfbml=1"></script><fb:like href="http://www.facebook.com/pages/PoetsProduct/236503569702627" send="true" layout="button_count" width="75" show_faces="false" font="arial"></fb:like>
		</td>
	<td colspan="2" rowspan="4">
		<img src="images/New-15-07_10.png" width="114" height="69" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="13" alt=""></td>
</tr>
<tr>
	<td rowspan="3">
		<img src="images/New-15-07_11.png" width="2" height="56" alt=""></td>
	<td>
		<a href="http://www.facebook.com/pages/PoetsProduct/236503569702627">
      <img src="images/New-15-07_12.png" alt="" width="20" height="20" border="0" id="Image7" onMouseOver="MM_swapImage('Image7','','Rollover/images/New-15-07_12.png',1)" onMouseOut="MM_swapImgRestore()"></a></td>
	<td rowspan="3">
		<img src="images/New-15-07_13.png" width="3" height="56" alt=""></td>
	<td>
		<a href="https://twitter.com/#!/PoetsProduct">
      <img src="images/New-15-07_14.png" alt="" width="20" height="20" border="0" id="Image8" onMouseOver="MM_swapImage('Image8','','Rollover/images/New-15-07_14.png',1)" onMouseOut="MM_swapImgRestore()"></a></td>
	<td rowspan="3">
		<img src="images/New-15-07_15.png" width="3" height="56" alt=""></td>
	<td>
		<a href="http://hyves.nl/?pageid=AAXGFZMH1OG0O0C4K    ">
      <img src="images/New-15-07_16.png" alt="" width="20" height="20" border="0" id="Image9" onMouseOver="MM_swapImage('Image9','','Rollover/images/New-15-07_16.png',1)" onMouseOut="MM_swapImgRestore()"></a></td>
	<td rowspan="3">
		<img src="images/New-15-07_17.png" width="21" height="56" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="20" alt=""></td>
</tr>
<tr>
	<td rowspan="2">
		<img src="images/New-15-07_18.png" width="20" height="36" alt=""></td>
	<td rowspan="2">
		<img src="images/New-15-07_19.png" width="20" height="36" alt=""></td>
	<td rowspan="2">
		<img src="images/New-15-07_20.png" width="20" height="36" alt=""></td>
	<td rowspan="2">
		<img src="images/New-15-07_21.png" width="227" height="36" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="8" alt=""></td>
</tr>
<tr>
	<td colspan="4">
		<img src="images/New-15-07_22.png" width="271" height="28" alt=""></td>
	<td>
		<img src="images/New-15-07_23.png" width="307" height="28" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="28" alt=""></td>
</tr>
<tr>
	<td rowspan="2">
		<img src="images/New-15-07_24.png" width="1" height="82" alt=""></td>
	<td background="images/New-15-07_25.png" width="1038" height="62" alt="" colspan="14"><img src="images/Banner.png" width="1037" height="62" alt="Banner"></td>
	<td rowspan="15">
		<img src="images/New-15-07_26.png" width="104" height="841" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="62" alt=""></td>
</tr>
<tr>
	<td colspan="14">
		<img src="images/New-15-07_27.png" width="1038" height="20" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="20" alt=""></td>
</tr>
<tr>
	<td colspan="2">
		<a href="http://www.Poetsproduct.nl/index.php">
      <img src="images/New-15-07_28.png" alt="" width="157" height="28" border="0" id="Image1" onMouseOver="MM_swapImage('Image1','','Rollover/images/New-15-07_28.png',1)" onMouseOut="MM_swapImgRestore()"></a></td>
	<td rowspan="13">
		<img src="images/New-15-07_29.png" width="10" height="759" alt=""></td>
	<td width="872" height="759" colspan="12" rowspan="13" align="left" valign="top" background="images/New-15-07_30.png" alt=""><p><img src="images/Blanko.png" width="270" height="61" alt="Blank">
	  <img src="images/Logo-PP-Product_pagina.png" width="300" height="90" alt="Product pagina"></p><div id="pageContent">
  <table width="100%" border="0" cellspacing="0" cellpadding="15">
  <tr>
    <td width="19%" valign="top"><img src="inventory_images/<?php echo $id; ?>.jpg" width="142" height="188" alt="<?php echo $product_name; ?>" /><br />
      <a href="inventory_images/<?php echo $id; ?>.jpg">View Full Size Image</a></td>
    <td width="81%" valign="top"><h3><?php echo $product_name; ?></h3>
      <p><?php echo "$".$price; ?><br />
        <br />
        <?php echo "$subcategory $category"; ?> <br />
<br />
        <?php echo $details; ?>
<br />
        </p>
      <form id="form1" name="form1" method="post" action="cart.php">
        <input type="hidden" name="pid" id="pid" value="<?php echo $id; ?>" />
        <input type="submit" name="button" id="button" value="Add to Shopping Cart" />
      </form>
      </td>
    </tr>
</table>
  </div>
	    <br>
  </p></td>
	<td>
		<img src="images/spacer.gif" width="1" height="28" alt=""></td>
</tr>
<tr>
	<td colspan="2">
		<a href="http://www.Poetsproduct.nl/Assortiment.php">
      <img src="images/New-15-07_30-32.png" alt="" width="157" height="29" border="0" id="Image2" onMouseOver="MM_swapImage('Image2','','Rollover/images/New-15-07_30-31.png',1)" onMouseOut="MM_swapImgRestore()"></a></td>
	<td>
		<img src="images/spacer.gif" width="1" height="29" alt=""></td>
</tr>
<tr>
	<td colspan="2">
		<a href="http://www.Poetsproduct.nl/Over_ons.php">
      <img src="images/New-15-07_31.png" alt="" width="157" height="27" border="0" id="Image3" onMouseOver="MM_swapImage('Image3','','Rollover/images/New-15-07_31.png',1)" onMouseOut="MM_swapImgRestore()"></a></td>
	<td>
		<img src="images/spacer.gif" width="1" height="27" alt=""></td>
</tr>
<tr>
	<td colspan="2">
		<a href="http://www.Poetsproduct.nl/Verzenden.php">
      <img src="images/New-15-07_32.png" alt="" width="157" height="28" border="0" id="Image4" onMouseOver="MM_swapImage('Image4','','Rollover/images/New-15-07_32.png',1)" onMouseOut="MM_swapImgRestore()"></a></td>
	<td>
		<img src="images/spacer.gif" width="1" height="28" alt=""></td>
</tr>
<tr>
	<td rowspan="3">
		<img src="images/New-15-07_34.png" width="1" height="63" alt=""></td>
	<td>
		<a href="http://www.Poetsproduct.nl/Betalen.php">
      <img src="images/New-15-07_34-36.png" alt="" width="156" height="26" border="0" id="Image5" onMouseOver="MM_swapImage('Image5','','Rollover/images/New-15-07_34-35.png',1)" onMouseOut="MM_swapImgRestore()"></a></td>
	<td>
		<img src="images/spacer.gif" width="1" height="26" alt=""></td>
</tr>
<tr>
	<td>
		<a href="http://www.Poetsproduct.nl/Contact.php">
      <img src="images/New-15-07_35.png" alt="" width="156" height="24" border="0" id="Image6" onMouseOver="MM_swapImage('Image6','','Rollover/images/New-15-07_35.png',1)" onMouseOut="MM_swapImgRestore()"></a></td>
	<td>
		<img src="images/spacer.gif" width="1" height="24" alt=""></td>
</tr>
<tr>
	<td>
		<img src="images/New-15-07_37.png" width="156" height="13" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="13" alt=""></td>
</tr>
<tr>
	<td rowspan="6">
		<img src="images/New-15-07_38.png" width="56" height="584" alt=""></td>
	<td colspan="3">
		<img src="images/New-15-07_39.png" width="158" height="29" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="29" alt=""></td>
</tr>
<tr>
	<td width="158" height="134" colspan="3" align="left" valign="top" background="images/New-15-07_40.png" alt=""><p><a href="#" onClick="javascript:window.open('https://www.paypal.com/nl/cgi-bin/webscr?cmd=xpt/Marketing/popup/OLCWhatIsPayPal-outside','olcwhatispaypal','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=400, height=350');"> <img src="images/Paypal.png" alt="Paypal" width="158" height="70" border="0"></a><span style="font-size: 12px"> U kunt ook uw bankrekening koppelen aan uw Paypal account.</span></p></td>
	<td>
		<img src="images/spacer.gif" width="1" height="134" alt=""></td>
</tr>
<tr>
	<td colspan="3">
		<img src="images/New-15-07_41.png" width="158" height="8" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="8" alt=""></td>
</tr>
<tr>
	<td rowspan="3">
		<img src="images/New-15-07_42.png" width="1" height="413" alt=""></td>
	<td colspan="2">
		<img src="images/New-15-07_43.png" width="157" height="30" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="30" alt=""></td>
</tr>
<tr>
	<td rowspan="2">
		<img src="images/New-15-07_44.png" width="1" height="383" alt=""></td>
	<td width="156" height="154" align="left" valign="top" background="images/New-15-07_45.png" style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;" alt="">Wij staan ingeschreven in het handelsregister bij de Kamer van Koophandel onder nummer: 53150074.</td>
	<td>
		<img src="images/spacer.gif" width="1" height="154" alt=""></td>
</tr>
<tr>
	<td>
		<img src="images/New-15-07_46.png" width="156" height="229" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="229" alt=""></td>
</tr>
<tr>
	<td>
		<img src="images/spacer.gif" width="56" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="1" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="156" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="10" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="104" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="2" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="20" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="3" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="20" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="3" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="20" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="21" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="307" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="135" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="227" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="10" height="1" alt=""></td>
	<td>
		<img src="images/spacer.gif" width="104" height="1" alt=""></td>
	<td></td>
</tr>
</table>
</body>
</html>

 

Thanks,

 

Mitch

Link to comment
Share on other sites

I changed money_format()  to number_format()

It works, but now I get this error.

 

Warning: number_format() expects parameter 1 to be double, string given in E:\HostingSpaces\Poets\poetsproduct.nl\wwwroot\cart.php on line 122 Warning: number_format() expects parameter 1 to be double, string given in E:\HostingSpaces\Poets\poetsproduct.nl\wwwroot\cart.php on line 147

 

Link to comment
Share on other sites

My problem isnt solved yet,

 

What I know now is that my host runs on a version 5.2.14 of php on Windows.

 

money_format cant be used on Windows so I changed it to number_format.

 

Now I cant change the quantity of my product in my shopping cart, and I wont see the total price.

 

Can someone help me out ?  :shrug:

 

Thanks,

 

Mitch

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.