ShoppingCart ??????

Results 1 to 3 of 3

Thread: ShoppingCart ??????

  1. #1
    Join Date
    Dec 1969

    Default ShoppingCart ??????

    Hi there <BR><BR>Ok I have a shoppig cart the user lets say has 5 items which corresponds to 5 records in the shopping table ,now I create an invoice number. what I want to do now is transfer that invoice number to a completed order table but I want to transfer also the 5 records under the same invoice number so that in the order completed table I would have 5 records with the same invoice number but diferent items.<BR>can anybody give some pointers on how to do this?<BR>thanx <BR>unreal

  2. #2
    Join Date
    Dec 1969

    Default First of all I would suggest

    to redesign your db, this might seem a bit rude but that&#039;s not intended ;-)<BR><BR>You have to make 2 tables for the completed orders:<BR><BR>tblOrders<BR>-------<BR>InvoiceID<BR>CustomerID<BR>Orderdate<BR>.....< BR><BR>tblOrderDetails<BR>---------------<BR>InvoiceID<BR>ProductID<BR>Quantity<BR>......<B R><BR>If you&#039;ve already something like this, just ignore this!<BR><BR>Now on to your problem, can you give some more info on how you have your code? <BR><BR>(If you know some SQL: it&#039;s a quite basic INSERT INTO statement, if you use SQL server I would suggest to make a nice stored proc to do this for you, but if you want me to help I need a little more code and db-design)<BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default Listen to Dutch...

    And I think you should have *FOUR* tables:<BR><BR>Table: OrderInProgress<BR>-- OrderID -- Primary Key, number<BR>-- CustomerID -- Foreign Key to customer table [0 if customer not registered yet?]<BR>-- WhenStarted -- Date/Time<BR>-- .. other ..<BR><BR>Table: OrderLineItems<BR>-- OrderID -- Foreign Key to OrderInProgress table<BR>-- Qty -- Number<BR>-- ItemID -- Foreign Key to Inventory table<BR>-- ... etc ...<BR><BR>*NOW* when you transfer an order to the invoice table, all you have to do is:<BR><BR>INSERT INTO InvoiceLineItems (InvoiceID, Qty, ItemID, ... )<BR>SELECT 13627, Qty, ItemID, ... FROM OrderLineItems WHERE OrderID = 3737<BR><BR>Where, of course, 13627 is replaced by the InvoiceID you just assigned to the new Invoice and 3737 is the OrderID of the line items to be transferred.<BR><BR>I might note that, in a simpler system, you *could* simply use the same tables for Orders and Invoices and the same tables for OrderLineItems and InvoiceLineItems. You then adopt some simple convention--say using a negative number for the InvoiceID?--to mean order in progress.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts