Reputation: 287
not sure where to start on this one so looking to the community to point me in the correct direction.
I need to create a report/view for ALL orders in our database.
I can write the sql easily enough to fetch the line item details (Product, QTY,Price). I can also write the sql to return the summary details(Customer, Address, total Price)
I can use a PHP loop to display the line item OR the summary items for each order but I dont know how to use one loop that shows both?
so example, the below shows my orders with summary:
I want to show my page with orders collapsed like below with the ability to expand them:
So how do I do this when my sql data array does not have the summary info and line level info? can this be combined into a single array and if so how do I call it in a loop.
if I had to use DIVs with jquery to collapse and expand the divs, I can do that but no idea how to show the orders ummary above the order details?
any advice, pointer are welcome if not a code sample. is there a library for this?
Thanks as always.
Upvotes: 1
Views: 399
Reputation: 2622
You have many options
1.Get the main orders array and then loop accordingly and fire query to get details inside the loop to get the order details for the respective order id in the loop and assign that detail in an associative array and finally you will get a associate array with the orders and respective order detail.
2.You can do all the above process at the view only where you want to show the listing.
3.You want to hide/show the order details you can create divs just below each order row and fill the details of order in it by default the div style will be display:none just make it block when clicked on order to show details.
4.You can add an AJAX call to bring the order detail when clicked on the order and replace the html of the order detail div and make its style display:block
5.You can do the above process on the mouseover also to show a floating div on the tooltip of the mouse pointer and show details with both option preloaded hidden details or load details with ajax
Hope You can use any of the one logic for your question
Upvotes: 1