
colinch
New Members-
Posts
7 -
Joined
-
Last visited
colinch's Achievements

Newbie (1/5)
0
Reputation
-
i've figured out I can just echo checked="on" but how should I save information in the array?
-
Ah sorry, you should go to diensten.php and/or http://www.colinch.c...site/hapjes.php On both pages, when you've clicked on the button, it will be added to the cart. The system is already there, but I don't know how to post/print/show the results (selected products) on a checkout page. Best would be to have checkboxes for each product on the checkout page, and when one is selected the box is "checked" on the checkout page
-
Hello, I've made a simple shopping cart system where people can select items and it will appear in a small shopping cart which is in the corner of each page. Now I want when people go to the "checkout" page, there will be a list of products they have selected (as checkboxes being checked) (thats because it will be sent as a mail to me). My website is in dutch but it's not hard to understand the system. Here's my page: http://www.colinch.com/11eventswebsite The only pages working are -> (from the menu) diensten.php and when diensten.php is selected -> hapjes.php from the dropdown menu. Those two pages are currently working and can be added to the little cart. So, as you can see, there's a button on each page saying: "toevoegen aan offerte" which means add to cart. What I want is, when they have selected their things which are now in the cart, they should click on a button to send their choices to a page where they are automatically selected or printed. It doesnt have to be very complicated, so it doesnt really have to be checkboxes if thats hard (im just a beginner), the only thing I want is that: -people can see their choices printed on the "checkout" page -i can see those choices in the mail they send me (I thought checkboxes are easy because they appear in the mail) the checkout is actually them sending a mail to me with their information + the selected products from the cart. Hopefully there is a function for it and if any codes are required, I will post them. I hope there is someone that can help me. Sorry for my english by the way.
-
@50r Yeah that's kind of what I need, but I think i'm almost done @AyKay47 Thanks, that did the trick! So, at www.colinch.com/11events/products2.php I can add products, and modify the cart. But, when someone adds products, it will take them to the shoppingcart.php And what I want to do, is remove the shoppingcart.php completely and make the cart only available at the product pages. My (hopefully) last question is, how could I make it so when I add a product to the cart it won't take me to another page but when clicked on the add button it will either: -refresh the page -adds a new row to the shopping cart without refreshing (like it does when you remove a product). Thanks in advance for the replies so far! -Colin
-
Ok thanks, I have tried something now. This is the normal system i downloaded: http://www.colinch.com/11events When I add a product, it takes me to the shoppingcart page. What I want to do, is display the shoppingcart on the product page (because I want to make more than 1 product pages). I did it like this: http://www.colinch.com/11events/products2.php But, for some reason I can't remove or add when the shopping cart is there (I just copied the code of shoppingcart.php in products.php which results in products2.php) Here is the code: <?php include("includes/db.php"); include("includes/functions.php"); if($_REQUEST['command']=='add' && $_REQUEST['productid']>0){ $pid=$_REQUEST['productid']; addtocart($pid,1); header("location:shoppingcart.php"); exit(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Products</title> <script language="javascript"> function addtocart(pid){ document.form1.productid.value=pid; document.form1.command.value='add'; document.form1.submit(); } </script> </head> <body> <? if($_REQUEST['command']=='delete' && $_REQUEST['pid']>0){ remove_product($_REQUEST['pid']); } else if($_REQUEST['command']=='clear'){ unset($_SESSION['cart']); } else if($_REQUEST['command']=='update'){ $max=count($_SESSION['cart']); for($i=0;$i<$max;$i++){ $pid=$_SESSION['cart'][$i]['productid']; $q=intval($_REQUEST['product'.$pid]); if($q>0 && $q<=999){ $_SESSION['cart'][$i]['qty']=$q; } else{ $msg='Some products not updated!, quantity must be a number between 1 and 999'; } } } ?> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script language="javascript"> function del(pid){ if(confirm('Do you really mean to delete this item')){ document.form1.pid.value=pid; document.form1.command.value='delete'; document.form1.submit(); } } function clear_cart(){ if(confirm('This will empty your shopping cart, continue?')){ document.form1.command.value='clear'; document.form1.submit(); } } function update_cart(){ document.form1.command.value='update'; document.form1.submit(); } </script> <form name="form1" method="post"> <input type="hidden" name="pid" /> <input type="hidden" name="command" /> <div style="margin:0px auto; width:600px;" > <div style="padding-bottom:10px"> <h1 align="center">Your Shopping Cart</h1> <input type="button" value="Continue Shopping" onclick="window.location='products.php'" /> </div> <div style="color:#F00"><?=$msg?></div> <table border="0" cellpadding="5px" cellspacing="1px" style="font-family:Verdana, Geneva, sans-serif; font-size:11px; background-color:#E1E1E1" width="100%"> <?php if(is_array($_SESSION['cart'])){ echo '<tr bgcolor="#FFFFFF" style="font-weight:bold"><td>Serial</td><td>Name</td><td>Price</td><td>Qty</td><td>Amount</td><td>Options</td></tr>'; $max=count($_SESSION['cart']); for($i=0;$i<$max;$i++){ $pid=$_SESSION['cart'][$i]['productid']; $q=$_SESSION['cart'][$i]['qty']; $pname=get_product_name($pid); if($q==0) continue; ?> <tr bgcolor="#FFFFFF"><td><?=$i+1?></td><td><?=$pname?></td> <td>$ <?=get_price($pid)?></td> <td><input type="text" name="product<?=$pid?>" value="<?=$q?>" maxlength="3" size="2" /></td> <td>$ <?=get_price($pid)*$q?></td> <td><a href="javascript:del(<?=$pid?>)">Remove</a></td></tr> <? } ?> <tr><td><b>Order Total: $<?=get_order_total()?></b></td><td colspan="5" align="right"><input type="button" value="Clear Cart" onclick="clear_cart()"><input type="button" value="Update Cart" onclick="update_cart()"><input type="button" value="Place Order" onclick="window.location='billing.php'"></td></tr> <? } else{ echo "<tr bgColor='#FFFFFF'><td>There are no items in your shopping cart!</td>"; } ?> </table> </div> </form> <form name="form1"> <input type="hidden" name="productid" /> <input type="hidden" name="command" /> </form> <div align="center"> <h1 align="center">Products</h1> <table border="0" cellpadding="2px" width="600px"> <?php $result=mysql_query("select * from products"); while($row=mysql_fetch_array($result)){ ?> <tr> <td><img src="<?php echo $row['picture']?>" /></td> <td> <b><?php echo $row['name']?></b><br /> <?php echo $row['description']?><br /> Price:<big style="color:green"> $<?php echo $row['price']?></big><br /><br /> <input type="button" value="Add to Cart" onclick="addtocart(<?php echo $row['serial']?>)" /> </td> </tr> <tr><td colspan="2"><hr size="1" /></td> <?php } ?> </table> </div> </body> </html> I hope this can be solved because I think a lot of people could use this when it works properly!
-
Thanks for the reply! I've found some codes for a the system I need. But to make it work the way I need it to work, I need the page: shoppingcart.php to actually be visible on my product pages, so people will be able to see what they've selected on the page they are currently on. From what I now, you can only include a php file in a html file, so not php in php or the html of a php in another php? I'm having this problem for a long time and also googled it, but I can't find a solution for it, hopefully someone here can help me!
-
Hello. First of all, this is my first post here so I'm not sure if this is the right place, hopefully it is And my english is not perfect, so I hope you will understand everything. I'm kind of new to php, but I do have experience with php and webprogramming. So the problem is that I'm not sure what exactly I need. The closest comparison I could make is with a shopping cart. I have a website were people can select a package to make a offer/tender. For example, there are 2 pages, one with drinks and one with food and on each page they can select a couple of options. With the list of items they have selected in the top right of the page (that would be the shopping cart) so they can see what they have selected. And at the end, they can click on "send" so I can make a price list, instead of checkout (what they would do in a webshop). I'm not very experienced so maybe a pre-made solution would do the thing, or a site which has some scripts I could use. What I thought of was to use a database but I guess that would be really messy afterall.. I've looked in w3schools and I found a couple of things like cookies and sessions but the explanation they provided was not enough for me to do something with it. I hope someone here could help me or has the same problem! Thanks alot, -Colin