Popular Products are showing random order?
Popular Products are showing random order?
Ok, so I am trying to get my products to display in order from best selling to lowest selling (best being first, and lowest selling on bottom of page)
I have used : ProductList.DataSource = ProductDataSource.GetPopularProducts(_MaxItems,_CategoryId); - Everything is working great, except each time I load the page, the products are showing in random order?!?
It is pulling from the right category and only showing what I have defined my max items to be, just doesn't appear to be working the way I need it to. Any suggestions?
The way I call the script is:[[ConLib:custom/bestsell CategoryId="120" Caption="Best Sellers" MaxItems="360"]]
I have used : ProductList.DataSource = ProductDataSource.GetPopularProducts(_MaxItems,_CategoryId); - Everything is working great, except each time I load the page, the products are showing in random order?!?
It is pulling from the right category and only showing what I have defined my max items to be, just doesn't appear to be working the way I need it to. Any suggestions?
The way I call the script is:[[ConLib:custom/bestsell CategoryId="120" Caption="Best Sellers" MaxItems="360"]]
Re: Popular Products are showing random order?
I also was trying to figure something out maybe using this method: //ProductList.DataSource = ProductDataSource.LoadForCriteria(_CatrgoryID,_MaxItems,0,"OrderCount DESC"); no luck though...
Possibly I believe I could somehow pull the order count from the database and just put it inline with my code...
("SELECT P.ProductId AS ProductId, COUNT(OI.ProductId) AS OrderCount FROM ac_OrderItems AS OI RIGHT OUTER JOIN ac_Products AS P ON OI.ProductId = P.ProductId WHERE P.ProductId IN ({0}) GROUP BY OI.ProductId, P.ProductId ORDER BY OrderCount DESC",productIds)
Possibly I believe I could somehow pull the order count from the database and just put it inline with my code...
("SELECT P.ProductId AS ProductId, COUNT(OI.ProductId) AS OrderCount FROM ac_OrderItems AS OI RIGHT OUTER JOIN ac_Products AS P ON OI.ProductId = P.ProductId WHERE P.ProductId IN ({0}) GROUP BY OI.ProductId, P.ProductId ORDER BY OrderCount DESC",productIds)
- ForumsAdmin
- AbleCommerce Moderator
- Posts: 399
- Joined: Wed Mar 13, 2013 7:19 am
Re: Popular Products are showing random order?
Popular products control does not display products randomly. The ones that are purchased most are shown first. The order by clause uses something like this
Code: Select all
ORDER BY SUM(ac_OrderItems.Quantity) DESC
Re: Popular Products are showing random order?
I dont know whats going on then, because my code //ProductList.DataSource = ProductDataSource.GetPopularProducts(_MaxItems,_CategoryId);
is displaying products, but it is not picking up the correct category, and it is showing them in different order every time.
How would I implement the loadforcriteria to replace: ProductList.DataSource = ProductDataSource.NarrowSearch("",_CategoryId,0,0,0,_MaxItems,0,"ProductId");
to only show best sellers form that category in order
is displaying products, but it is not picking up the correct category, and it is showing them in different order every time.
How would I implement the loadforcriteria to replace: ProductList.DataSource = ProductDataSource.NarrowSearch("",_CategoryId,0,0,0,_MaxItems,0,"ProductId");
to only show best sellers form that category in order
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Popular Products are showing random order?
In Gold, you can't pass scriplet parameters anymore like this that you could do in Able 7
You have to do it in the master page, like Layouts/ThreeColumn.Master
You can't pass a category id unless you have customized it.
Code: Select all
[[ConLib:custom/bestsell CategoryId="120" Caption="Best Sellers" MaxItems="360"]]
Code: Select all
<uc:PopularProductsDialog ID="PopularProductsDialogRight" MaxItems="360" runat="server" />
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Re: Popular Products are showing random order?
I am actually using able commerce 7.
The issue is that I have 3 different categories on the home page that I am pulling product from. So I have the code 3 times with 3 different cats: such as
[[ConLib:custom/bestsell CategoryId="2" Caption="Best Sellers" MaxItems="360"]]
[[ConLib:custom/bestsell CategoryId="16" Caption="Best Sellers" MaxItems="360"]]
[[ConLib:custom/bestsell CategoryId="3" Caption="Best Sellers" MaxItems="360"]]
PopularProducts is pulling from both the parent and all subs before determining (randomly) which ones to display, so I think I need to use a SQL statement, and pull each category and sort via OrderCount method... how would I go about this.
The issue is that I have 3 different categories on the home page that I am pulling product from. So I have the code 3 times with 3 different cats: such as
[[ConLib:custom/bestsell CategoryId="2" Caption="Best Sellers" MaxItems="360"]]
[[ConLib:custom/bestsell CategoryId="16" Caption="Best Sellers" MaxItems="360"]]
[[ConLib:custom/bestsell CategoryId="3" Caption="Best Sellers" MaxItems="360"]]
PopularProducts is pulling from both the parent and all subs before determining (randomly) which ones to display, so I think I need to use a SQL statement, and pull each category and sort via OrderCount method... how would I go about this.
Re: Popular Products are showing random order?
Is there a way I could implement an SQL query (SELECT P.ProductId AS ProductId, COUNT(OI.ProductId) AS OrderCount FROM ac_OrderItems AS OI RIGHT OUTER JOIN ac_Products AS P ON OI.ProductId = P.ProductId WHERE P.ProductId IN ({0}) GROUP BY OI.ProductId, P.ProductId ORDER BY OrderCount DESC",productIds)
such as the one above and pull it based on results?
such as the one above and pull it based on results?
Re: Popular Products are showing random order?
Anyone? Still needing help with this.
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Popular Products are showing random order?
You could try this method and see if it works before you do custom sql
GetPopularProductsByCategory(int categoryId, int limit)
If you need to do custom sql, this article will point you in the right direction.
http://wiki.ablecommerce.com/index.php/Custom_Queries
GetPopularProductsByCategory(int categoryId, int limit)
If you need to do custom sql, this article will point you in the right direction.
http://wiki.ablecommerce.com/index.php/Custom_Queries
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Re: Popular Products are showing random order?
I tried that, and unfortunately it is still displaying them in a different order each page load.