General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 5th, 2003, 08:45 PM
warhammer warhammer is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 1 warhammer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Shopping Cart Checkout Tutorial

Hi folks, I really got a lot out of the Cart tutorial.

There also seems to be quite a few people who need help with a check out section and im one of them.

Is there anyone who could make us a demo script that would spit all the contents of the cart form the example at URL into a new table called "orders" that holds all the cart info (itemID and qty) and some user details like name, address, email from a form. Then we'd have all the pieces of the jigsaw together to go our own ways with it.

Thanks

David

Reply With Quote
  #2  
Old June 26th, 2003, 01:33 PM
jaggedaz jaggedaz is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 1 jaggedaz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I would definately appreciate some help with this as well. The shopping cart script works great, but I'm not familiar enough with PHP to figure out how to have it e-mail the contents of the cart and the results of a simple form (purchase info).

Reply With Quote
  #3  
Old July 21st, 2003, 01:19 AM
naughtymutt naughtymutt is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 4 naughtymutt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i have done this.

first i created two tables called order and order_details. i also have a table for users

first, when the user "checks out" i create an order which contains the ordernumber (primary key) and the users id (primary key on the users table).

then i read from the cart table and put each itemID, qty into the table, but before i do this i run the mysql command mysql_insert_id(), this gets the ordernumber from the order table and i can then write this as the ordernum into the order_details table.

so what you end up with (which does look messy, but works) is

function SubmitOrder($billinguser, $deliveryuser, $amount, $gift) {
//submit order into order_detail, retrieve its id and then submit order_contents with a parentid that equals the id of the matching data in order_detail

$query_order="Insert into order (billuser, deluser, ordertime, gift) values ($billinguser, $deliveryuser, now(), $gift)";


mysql_query($query_order);
$lastid=mysql_insert_id();


$select_cart="Select * from cart where cart.cookieId='" . GetCartId(). "'";

$result_select_cart=mysql_query($select_cart);

while($row = mysql_fetch_array($result_select_cart))
{
$book=$row["book"];
$cover=$row["cover"];
$qty=$row["qty"];

$insert_order="Insert into order_details(book, cover, qty, order_details_id) values ($book, $cover, $qty, $lastid)";


mysql_query($insert_order);
}

$query = "Delete from cart where cart.cookieId = '" . GetCartId() . "'";
mysql_query($query);
setcookie ("cartId", "", time() - 3600);


if anybody can improve this code to be better then please help

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Shopping Cart Checkout Tutorial


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT