close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

How to create 5 most recent orders

Thread began 2/13/2010 6:47 am by nenad391153 | Last modified 2/13/2010 6:24 pm by nenad391153 | 2525 views | 9 replies |

nenad391153

How to create 5 most recent orders

Hello,

We do not have Powerstore but rather a custom store created through Data-Assist. We would like to replicate the "5 most recent orders" section that is on the admin dashboard of the Powerstore 3. What are the necessary steps to take in order for us to create a list of 5 of the most recent orders?

We need this to be a simple list of no more than 5 orders that are dynamically updated.

Thank you in advance for anyone's help!
Nenad

Sign in to reply to this post

CraigRBeta Tester

one way of doing this is simply to sort the recordset by an appropriate field , (order_id or order_date for example) and return only 5 rows.

eg "SELECT * FROM `tblorders` ORDER BY order_id DESC LIMIT 5"

will return the last 5 orders

Sign in to reply to this post

nenad391153

Craig thank you for your help. Excuse my learning of databases, but how would I go about adding these records to a page once that recordset is created?

Thanks!

Sign in to reply to this post

CraigRBeta Tester

not sure about your coding / database knowledge.

i use dataassist to help create pages for admin sections as it can help speed up the development process

personally, where i need to query more than 1 table, or need more complex select statements, i just stick with dreamweaver.

if you are familiar with dreamweaver basics, i can walk you through it.

essentially, once you have created your recordset, add the fields you need to your page.
you can then add a 'repeat region server behavior' to display all of the rows returned in your recordset.


please let me know the structure of your order table, i will create a select statement and php page for you.

(i assume you are using php/mysql, my asp is a bit rusty and coldfusion pretty much non existent)

regards

Sign in to reply to this post

nenad391153

Thank you for your help! You are very kind!

My orders table is the default ecommerce database structure here from webassist.

I only need to pull OrderDate and OrderShipName for this simple table that only shows the 5 most recent orders. The order id is: OrderID

I hope this is enough information. Please let me know if you need anything else. This little table is going to be placed inside of a sidebar with a width of about 155.

Thanks Craig!

Sign in to reply to this post

CraigRBeta Tester

ok, this has no formatting as such, but the code works.

check the code, you will need to change the connection string.

all i have done for this example is created a query to choose the last 5 orders, by sorting the contents of the orders table in descending order of orderID and limiting the number of rows returned to 5.

i put the result fields in a table and added the repeat region server behavior to the table.

its not pretty, but should show you what you need to do.

good luck

Sign in to reply to this post

nenad391153

Craig you rock! Thank you so much!!! It's perfect!

Sign in to reply to this post

nenad391153

Hey Craig, real quick.....everything works great. I added OrderAmount. Is there a way to format the OrderAmount field to include commas and decimal places? So from: 50000 to 50,000.

Thanks!

Sign in to reply to this post

CraigRBeta Tester

no problem.

take a look here..

function.number-format.php

Sign in to reply to this post

nenad391153

Perfect, thanks!

For anyone who wants to know:
$<?php echo(number_format($row_WADAorders['OrderAmount'],2)); ?>

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...