Product display order

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 年 前
Hi I'm quite new to nopCommerce and am using the latest 1.6 version.

My site is very simple I have less then 10 products to display (some have variations some don't). I have 1 category as they all fall into the same one. For each product I have selected to 'show on homepage' and I have hidden or deselected almost everything else on the page save for the shopping cart and the my account links. This way I have a nice neat set of product images that go to the product (and its variants)

Now the only thing I want to do is control the order of these items. Right now it is alphabetic.

Is this possible? I can order within the category, but it seems to me the way I have marked each item to be shown on the main page is the easiest way to set up a very small catalogue of items. I don't want a single category link to be shown. I get the feeling once 'show on home page' is checked a second input should be show for the display order.

Can anyone guide me on what I'm doing wrong here?
13 年 前
Hello.

You can code this feature if you want.

Change the HomePageProducts.ascx.cs file in the modules folder. Locate BindData method and add the bold line:

private void BindData()
        {
            var products = ProductManager.GetAllProductsDisplayedOnHomePage();
            if (products.Count > 0)
            {
                products.Sort(delegate(Product p1, Product p2) { return p1.ProductCategories[0].DisplayOrder.CompareTo(p2.ProductCategories[0].DisplayOrder) ; });
                dlCatalog.DataSource = products;
                dlCatalog.DataBind();
            }
            else
            {
                this.Visible = false;
            }
        }


This should sort the products based on the category order...
Note that this is a hack. You must guarantee that every product has at least one category. if not you will receive an error. If you want to make sure this doesn't occur add a try catch block.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.