PDA

View Full Version : Linking Order Results to Order Details??


jefferis
06-03-2009, 08:08 AM
Hi Ray et al,
I have created a shopping cart (with Excellent help from Dani and support!!!! thanks guys )

Using the eCart Sample databases as my template I have created the Orders and OrderDetails mysql tables which are populated automatically by the cart...

I created an Admin ability using Data Wizard to search the Orders but I don't want to duplicate all these pages (results, details, updates, etc) in order to link the Orders (which has info on the customer but NO info on the items ordered) to the Order Details (which has the details of the item cart but no details on the customer).

In other words, OrderRefernceID and the DetailsReferenceID are the same number but what is the strategy for linking these results? I expect that when the admin wants to look up an order for a client, e.g., she will want to have the results of the cart contents and the info on the customer on the same page... I don't even see a way of taking the reference id and linking them in DA...

In a similar vein, I think I want customers to be able to view a subset of the information if they type in a reference ID and their email...

So is there a tutorial for this solution? I could use the wizard to create details pages, and although I tried just using the search wizard, it is kicking back mysql errors if I try to add the behavior to the existing Orders pages...

Thanks,
Jeff

Ray Borduin
06-03-2009, 08:34 AM
I don't know of a direct tutorial.

You can just add a recordset to the current orders details page to return the details for that order. Then use a repeated table on that page to show the order details information.

You could add an INNER Join to the current orders table to join in the users information that you want displayed on that page as well. I don't think you would use DA at this point... the rest can be done with native DW functionality at this point.

jefferis
06-03-2009, 11:25 AM
Would you have to create the sql Join Recordset before you run DA Wizard? I created a joined recordset on the results page, but it is creating a no data...

Well this may not be the most elegant way to work it but it works:

Details Order ID:
<?php $row_join['DetailOrderID'] = $row_WADAorders['OrderReferenceID'];
$newID = $row_join['DetailOrderID'];
echo $newID; ?><?php $query = "Select * From orderdetails where orderdetails.DetailOrderID = '$newID'";
$result = mysql_query($query) or die(mysql_error()); ?>

I can then call all the details from the orderdetails table and not need a repeating table on this page...

geordie728
06-04-2009, 08:17 AM
jefferis,
on the order detail page, create an orderdetails rs.

select *
from orderdetails
where detailorderid = colname

I've got colname set to $_GET['OrderID']

then as ray suggests, pull your data onto the page (tables are best here) and then run a repeat region behaviour for all records in the rs.

jefferis
06-04-2009, 08:49 AM
jefferis,
on the order detail page, create an orderdetails rs.

select *
from orderdetails
where detailorderid = colname

I've got colname set to $_GET['OrderID']

then as ray suggests, pull your data onto the page (tables are best here) and then run a repeat region behaviour for all records in the rs.

Did you set the variable for colname before or after the query?
I'm not sure if colname here is a variable or how you actually set it...

But, since this is a detail page, there is only one record going to show, the exact record for the order id and I don't need repeating regions on this page...

Thanks
JEff