Working with Topic Pages Links

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 years ago
I created four Topic pages in nopCommerce 4.3 and made sure to set the Order starting from 0 to the first link and increase by 1.  Then, when I try to add them to my index page, utilizing the following model, the links do not get published in the order that I want.   It looks like they are getting displayed in alphabetical order.  How do I make sure that the links are displayed in the Menu list according to the order number that I selected?
    
@foreach (var topic in Model.Topics)
    {
        <li><a href="@Url.RouteUrl("Topic", new { SeName = topic.SeName })">@topic.Name</a></li>
    }
3 years ago
The Display Order is not stored in the topic model
So you need to change the code that builds the model in
Presentation\Nop.Web\Factories\CatalogModelFactory.cs

            //top menu topics
            var topicModel = _topicService.GetAllTopics(_storeContext.CurrentStore.Id, onlyIncludedInTopMenu: true).OrderBy(t => t.DisplayOrder)
3 years ago
Hi,

The current Model code Query is the following:

            //top menu topics
            var topicModel = _topicService.GetAllTopics(_storeContext.CurrentStore.Id, onlyIncludedInTopMenu: true)
                    .Select(t => new TopMenuModel.TopicModel
                    {
                        Id = t.Id,
                        Name = _localizationService.GetLocalized(t, x => x.Title),
                        SeName = _urlRecordService.GetSeName(t)
                    }).ToList();


As you indicated, I changed it to:

            //top menu topics
            var topicModel = _topicService.GetAllTopics(_storeContext.CurrentStore.Id, onlyIncludedInTopMenu: true).OrderBy(t => t.DisplayOrder)
                    .Select(t => new TopMenuModel.TopicModel
                    {
                        Id = t.Id,
                        Name = _localizationService.GetLocalized(t, x => x.Title),
                        SeName = _urlRecordService.GetSeName(t)
                    }).ToList();


The Topic Menu that is generated is:

Products
Our Story
My account
contact us


I am trying to get the Menu to return like this:

Our Story
Products
Contact Us
My account


Such that even the Contact Us is modified and Capitalized to match the remaining Menu Links.
3 years ago
OrderBy should work, so if your not getting desired order, then check the Topic's 'Display order'.

If you are not getting correct upper/lowercase, then check your locale resource string.
3 years ago
New York wrote:
OrderBy should work, so if your not getting desired order, then check the Topic's 'Display order'.

If you are not getting correct upper/lowercase, then check your locale resource string.


Yes, I checked and modified the DisplayOrder and actually getting the proper order.
I have two Questions:  Would you please advise on how to check my locale resource string?
3 years ago
Admin Configuration/Languages
Edit your language and locate the resource value being used to display the text "contact us" and change it to "Contact Us" or what ever your wanting to be displayed.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.