ProductCart E-Commerce Solutions Homepage
Forum Home Forum Home > ProductCart > Customizing ProductCart
  New Posts New Posts RSS Feed - sort by sku
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

sort by sku

 Post Reply Post Reply
Author
Message
ym View Drop Down
Newbie
Newbie


Joined: 22-January-2009
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote ym Quote  Post ReplyReply Direct Link To This Post Topic: sort by sku
    Posted: 07-March-2014 at 9:23am
I'd like to display all featured products by sku, newly added products first and older products in the last row. It looks like by default, it's opposite. Does anybody know the solutions? Thank you.
Back to Top
Guests View Drop Down
Guest
Guest
Post Options Post Options   Thanks (0) Thanks(0)   Quote Guests Quote  Post ReplyReply Direct Link To This Post Posted: 07-March-2014 at 9:33pm
Are you referring to this display on the home page, the featured products page, or both? And do you really mean "sort by" (a user interface option) or just "order by" (a database query option)?

Just looking for a some clarification to be able to assist you with what you really want here.
Back to Top
ym View Drop Down
Newbie
Newbie


Joined: 22-January-2009
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote ym Quote  Post ReplyReply Direct Link To This Post Posted: 07-March-2014 at 10:37pm
Thank you for the reply. I'm reffering to the featured products page. (showfeatured.asp)
And I meant "order by".
 
I'm adding new products frequently and when this page (showfeatured.asp) is loaded, I'd like to show new products first.
Back to Top
Guests View Drop Down
Guest
Guest
Post Options Post Options   Thanks (0) Thanks(0)   Quote Guests Quote  Post ReplyReply Direct Link To This Post Posted: 07-March-2014 at 11:43pm
Thanks for the clarification.

This is easy to tweak.

In /pc/showfeatured.asp, find:
Case "0": querySort = " ORDER BY pcprod_OrdInHome asc"
replace that with the following:
'Modified to sort by date entered by default:
'Case "0": querySort = " ORDER BY pcprod_OrdInHome asc"
Case "0": querySort = " ORDER BY pcprod_OrdInHome ASC, products.pcprod_EnteredOn DESC"

Then find:
query="SELECT distinct products.idProduct, products.sku, products.description, products.price, products.listHidden, products.listPrice, products.serviceSpec, products.bToBPrice, products.smallImageUrl, products.noprices, products.stock, products.noStock, products.pcprod_HideBTOPrice, products.pcprod_OrdInHome, products.formQuantity, products.pcProd_BackOrder FROM products, categories_products, categories WHERE products.active=-1 AND products.showInHome=-1 AND products.configOnly=0 AND products.removed=0 " & queryNFS & " AND categories_products.idProduct=products.idProduct AND categories.idCategory=categories_products.idCategory AND categories.iBTOhide=0 " & query1 & querySort
Replace that with the following:
'Modified to include to include products.pcprod_EnteredOn:
'query="SELECT distinct products.idProduct, products.sku, products.description, products.price, products.listHidden, products.listPrice, products.serviceSpec, products.bToBPrice, products.smallImageUrl, products.noprices, products.stock, products.noStock, products.pcprod_HideBTOPrice, products.pcprod_OrdInHome, products.formQuantity, products.pcProd_BackOrder FROM products, categories_products, categories WHERE products.active=-1 AND products.showInHome=-1 AND products.configOnly=0 AND products.removed=0 " & queryNFS & " AND categories_products.idProduct=products.idProduct AND categories.idCategory=categories_products.idCategory AND categories.iBTOhide=0 " & query1 & querySort
query="SELECT distinct products.idProduct, products.sku, products.description, products.price, products.listHidden, products.listPrice, products.serviceSpec, products.bToBPrice, products.smallImageUrl, products.noprices, products.stock, products.noStock, products.pcprod_HideBTOPrice, products.pcprod_OrdInHome, products.formQuantity, products.pcProd_BackOrder, products.pcprod_EnteredOn FROM products, categories_products, categories WHERE products.active=-1 AND products.showInHome=-1 AND products.configOnly=0 AND products.removed=0 " & queryNFS & " AND categories_products.idProduct=products.idProduct AND categories.idCategory=categories_products.idCategory AND categories.iBTOhide=0 " & query1 & querySort

If you actually assign sort order values to your featured products in the Control Panel, those will trump with this query. If you don't, then everything will be ordered by the date added to the database.

You can therefore have the best of both by using the ordering option in the CP if you want to pop certain products to the top, else everything will be ordered by date entered from most recent to oldest.


Back to Top
ym View Drop Down
Newbie
Newbie


Joined: 22-January-2009
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote ym Quote  Post ReplyReply Direct Link To This Post Posted: 08-March-2014 at 11:06pm
It worked!!! Thank you so much.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.066 seconds.