Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Catalog Anywhere.. sorting product order

Recommended Posts

Am trying to use this contribution to show, on a forum side bar, the latest three products added to the shop. I have altered the SQL statement so where before it selected product-model, it now select products_date_added.


That bit is fine, the only problem is its showing the first 3 products added rather than the last three. I assumed I needed to put DESC in there somewhere but have tried putting before the close quotes (e.g. three different places) and all the permutations of this and its just not happening. Below is the code which shows the "wrong" order, any help with how to change would be appreciated.


// create SQL statement
$sqlcount = "SELECT * FROM `products` ORDER BY 'products_date_added'";
$sql = "SELECT * FROM `products` ORDER BY 'products_date_added' LIMIT $pl, $num_products";


I have assumed that this is the part which needs altering but I could easily be wrong :-)

Link to comment
Share on other sites

  • 9 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...