close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Change product order

Thread began 11/17/2009 1:11 am by mousework50137 | Last modified 8/01/2010 10:19 pm by downloads336743 | 3173 views | 11 replies |

mousework50137

Change product order

Hi,
How do I modify the recordset on my product page so the most recently added product is displayed first.
Currently the SQL in the recordset reads

SELECT *, (ProductStock - (SELECT Coalesce(Sum(DetailQuantity),0)
FROM orderdetails INNER JOIN orders ON OrderID = DetailOrderID
WHERE DetailProductID = ProductID AND OrderDate > ProductUpdateDate)) AS NumLeft FROM products LEFT OUTER JOIN productcategories ON ProductCategoryID = CategoryID WHERE ProductLive <> 0

Cheers

Sign in to reply to this post

Jason ByrnesWebAssist

Add:
ORDER BY ProductUpdateDate DESC


to the end of the query:

SELECT *, (ProductStock - (SELECT Coalesce(Sum(DetailQuantity),0)
FROM orderdetails INNER JOIN orders ON OrderID = DetailOrderID
WHERE DetailProductID = ProductID AND OrderDate > ProductUpdateDate)) AS NumLeft FROM products LEFT OUTER JOIN productcategories ON ProductCategoryID = CategoryID WHERE ProductLive <> 0
ORDER BY ProductUpdateDate DESC

Sign in to reply to this post

larsentim278054

Is there a way to order it by Product price? (most expensive on top)

Sign in to reply to this post

Jason ByrnesWebAssist

change the order by clause to use the product price column:
ORDER BY ProductPrice DESC

Sign in to reply to this post

larsentim278054

Thank you for the quick support! I'll give that a try.

Sign in to reply to this post

larsentim278054

That worked perfectly. Thanks!

I don't suppose there's a way to add some buttons on the top of the product results page, letting the user sort it themselves? Like a "alphabetical, or newest, or by price" type thing?

Sign in to reply to this post

Jason ByrnesWebAssist

see the DataAssist "Sorting by column links" tutorial in the solution recipe section of the DataAssist support page:
dataassist/

Sign in to reply to this post

larsentim278054

Ah - okay I'll check it out. Thanks Jason.

You wouldn't be able to check my thread over here, would you? showthread.php?t=7503&page=2

Sign in to reply to this post

Jason ByrnesWebAssist

I've already responded to your other thread.

Sign in to reply to this post

downloads336743

Hi,
I've read through the above and looked at the DA guide, however, i have a client who had a site built a while ago and it's now a little bit difficult to redo the database info to update the order of how the information is sorted (they want it done Music Name alphabetically). I was wondering therefore, if there is a way to just update the code rather than go through the recordset panels etc...I noticed a way to do it for PowerStore but not for DA
Currently the code for the layout is

<table class="WADAResultsTable" border="0" cellpadding="0" cellspacing="0">
<tr>
<th class="WADAResultsTableHeader">Item ID:</th>
<th class="WADAResultsTableHeader">Music Name:</th>
<th class="WADAResultsTableHeader">Music Description:</th>
<th class="WADAResultsTableHeader">Music Type:</th>
<th>&nbsp;</th>
</tr>
<?php do { ?>
<tr class="<?php echo $WARRT_AltClass1->getClass(true); ?>">
<td class="WADAResultsTableCell" style="width:60px;"><?php echo($row_WADAmusicuploads['ItemID']); ?></td>
<td class="WADAResultsTableCell" style="width:155px;"><a href="musicuploads_Detail.php?ItemID=<?php echo(rawurlencode($row_WADAmusicuploads['ItemID'])); ?>" ><?php echo($row_WADAmusicuploads['ItemName']); ?></a></td>
<td class="WADAResultsTableCell" style="width:150px;"><?php echo($row_WADAmusicuploads['ItemDescription']); ?></td>
<td class="WADAResultsTableCell" style="width:150px;"><?php echo($row_WADAmusicuploads['ItemType']); ?></td>
<td class="WADAResultsEditButtons" nowrap="nowrap"><table class="WADAEditButton_Table">
<tr>
<td><a href="musicuploads_Detail.php?ItemID=<?php echo(rawurlencode($row_WADAmusicuploads['ItemID'])); ?>" title="View"><img border="0" name="View<?php echo(rawurlencode($row_WADAmusicuploads['ItemID'])); ?>" id="View<?php echo(rawurlencode($row_WADAmusicuploads['ItemID'])); ?>" alt="View" src="../../WA_DataAssist/images/Slate/Traditional_zoom.gif" /></a></td>
<td><a href="musicuploads_Update.php?ItemID=<?php echo(rawurlencode($row_WADAmusicuploads['ItemID'])); ?>" title="Update"><img border="0" name="Update<?php echo(rawurlencode($row_WADAmusicuploads['ItemID'])); ?>" id="Update<?php echo(rawurlencode($row_WADAmusicuploads['ItemID'])); ?>" alt="Update" src="../../WA_DataAssist/images/Slate/Traditional_edit.gif" /></a></td>
<td><a href="musicuploads_Delete.php?ItemID=<?php echo(rawurlencode($row_WADAmusicuploads['ItemID'])); ?>" title="Delete"><img border="0" name="Delete<?php echo(rawurlencode($row_WADAmusicuploads['ItemID'])); ?>" id="Delete<?php echo(rawurlencode($row_WADAmusicuploads['ItemID'])); ?>" alt="Delete" src="../../WA_DataAssist/images/Slate/Traditional_trash.gif" /></a></td>
</tr>
</table></td>
</tr>
<?php } while ($row_WADAmusicuploads = mysql_fetch_assoc($WADAmusicuploads)); ?>
</table>

Thanks for any help!

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...