Close

Extra child menus

garrie007
11 years ago
#1880 Quote
Avatar
  • 7
Hi,

Just purchased your NopMegaMenu for NopCommerce 2.65 after giving it a trial and really like it, got it set nicely but what i a m trying to acheive, dont know if possiable out of the box or not? but this is what i am trying to do:


Categories:

A                  B                   C                       D                       E                         F
                                          |
                                          |
                                          Sub A              Sub B             Sub C                             Manufact List
                                          list item1          list item1         list item1                         list item1
                                          list item2          list item2         list item2                         list item2
                                          list item3          list item3
                                                                  list item4
                                                                  list item5





how do i do this?

Kind regards

Garrie

ps. if you require any info like order number etc let me know.





          
IvanStoyanov
11 years ago
#1888 Quote
Avatar
  • 269
garrie007 wrote:
Hi,

Just purchased your NopMegaMenu for NopCommerce 2.65 after giving it a trial and really like it, got it set nicely but what i a m trying to acheive, dont know if possiable out of the box or not? but this is what i am trying to do:


Categories:

A                  B                   C                       D                       E                         F
                                          |
                                          |
                                          Sub A              Sub B             Sub C                             Manufact List
                                          list item1          list item1         list item1                         list item1
                                          list item2          list item2         list item2                         list item2
                                          list item3          list item3
                                                                  list item4
                                                                  list item5





how do i do this?

Kind regards

Garrie

ps. if you require any info like order number etc let me know.





          


Hi garrie007,

To do this you need to edit the CategoryMenuTemplate.WithoutPictures.cshtml view located at /Plugins/SevenSpikes.Nop.Plugins.MegaMenu/Views/MegaMenu.

The MegaMenuCategoriesModels that is used in it contains a
IList<MegaMenuCategoryModel>
  The MegaMenuCategoryModel contains:
public CategoryModel CategoryModel

        public IList<MegaMenuCategoryModel> SubCategories

        public IList<ManufacturerModel> CategoryManufacturers

        public IEnumerable<ProductOverviewModel> BestSellerProducts


You can use the model in the view to display as many categories and sub-categories as you want.

Ivan Stoyanov
Thank you for choosing our products! Your feedback is important to us!
garrie007
11 years ago
#1897 Quote
Avatar
  • 7
Hi,

I tried adding extra main cats and sub cats but to no avail, do you have any examples.

Just getting back into development after last doing it when asp.net 2.0 first came out so a little rusty.

Regards

Garrie





IvanStoyanov
11 years ago
#1899 Quote
Avatar
  • 269
garrie007 wrote:
Hi,

I tried adding extra main cats and sub cats but to no avail, do you have any examples.

Just getting back into development after last doing it when asp.net 2.0 first came out so a little rusty.

Regards

Garrie


Hi Garrie,

Go to /Plugins/SevenSpikes.Nop.Plugins.MegaMenu/Views/MegaMenu and open the CategoryMenuTemplate.WithoutPictures.cshtml view.

Go to line 90 and after the following code:
<li><a href="@Url.RouteUrl("Category", new { SeName = subCategory.CategoryModel.SeName })">@subCategory.CategoryModel.Name</a>


paste this:

 <ul>
                                    @foreach (var subCategory1 in subCategory.SubCategories)
                                    {
                                        <li><a href="@Url.RouteUrl("Category", new { SeName = subCategory1.CategoryModel.SeName })">@subCategory1.CategoryModel.Name</a></li>
                                    }
                                </ul>


your code should look like this:

<li><a href="@Url.RouteUrl("Category", new { SeName = subCategory.CategoryModel.SeName })">@subCategory.CategoryModel.Name</a>
                                <ul>
                                    @foreach (var subCategory1 in subCategory.SubCategories)
                                    {
                                        <li><a href="@Url.RouteUrl("Category", new { SeName = subCategory1.CategoryModel.SeName })">@subCategory1.CategoryModel.Name</a></li>
                                    }
                                </ul>
                            </li>

NOTE: This will work only when Show categories in a single menu setting is disabled and the Category menu template is set to Categories in list.

Ivan Stoyanov
Thank you for choosing our products! Your feedback is important to us!
garrie007
11 years ago
#1903 Quote
Avatar
  • 7
Hi,

I have done the required changes but its still not working, code and photo below.

Category setting:

Main cat: Products and both sub cats use Products as main parent category.

Menu picture:


Admin settings:




<ul>
                        @{var categoriesCounter = 0;}
                        @foreach (var subCategory in category.SubCategories)
                        {
                            if (categoriesCounter == megaMenuSettings.NumberOfCategories && megaMenuSettings.NumberOfCategories != 0)
                            {
                            <li><a class="view-all" href="@Url.RouteUrl("Category", new { categoryId = category.CategoryModel.Id, SeName = category.CategoryModel.SeName })">@T("SevenSpikes.MegaMenu.ViewAllCategories")</a>
                            </li>
                                break;
                            }                        
                            <li><a href="@Url.RouteUrl("Category", new { categoryId = subCategory.CategoryModel.Id, SeName = subCategory.CategoryModel.SeName })">@subCategory.CategoryModel.Name</a>
                                <ul>
                                    @foreach (var subCategory1 in subCategory.SubCategories)
                                    {                                        
                                        <li><a href="@Url.RouteUrl("Category", new { SeName = subCategory1.CategoryModel.SeName })">@subCategory1.CategoryModel.Name</a></li>
                                        <li><a href="@Url.RouteUrl("Category", new { SeName = subCategory1.CategoryModel.SeName })">@subCategory1.CategoryModel.Name</a></li>
                                        
                                    }
                                </ul>
                            </li>
                                    categoriesCounter++;

                        }
                    </ul>




Regards
IvanStoyanov
11 years ago
#1905 Quote
Avatar
  • 269
garrie007 wrote:
Hi,

I have done the required changes but its still not working, code and photo below.

Category setting:

Main cat: Products and both sub cats use Products as main parent category.

Menu picture:


Admin settings:




<ul>
                        @{var categoriesCounter = 0;}
                        @foreach (var subCategory in category.SubCategories)
                        {
                            if (categoriesCounter == megaMenuSettings.NumberOfCategories && megaMenuSettings.NumberOfCategories != 0)
                            {
                            <li><a class="view-all" href="@Url.RouteUrl("Category", new { categoryId = category.CategoryModel.Id, SeName = category.CategoryModel.SeName })">@T("SevenSpikes.MegaMenu.ViewAllCategories")</a>
                            </li>
                                break;
                            }                        
                            <li><a href="@Url.RouteUrl("Category", new { categoryId = subCategory.CategoryModel.Id, SeName = subCategory.CategoryModel.SeName })">@subCategory.CategoryModel.Name</a>
                                <ul>
                                    @foreach (var subCategory1 in subCategory.SubCategories)
                                    {                                        
                                        <li><a href="@Url.RouteUrl("Category", new { SeName = subCategory1.CategoryModel.SeName })">@subCategory1.CategoryModel.Name</a></li>
                                        <li><a href="@Url.RouteUrl("Category", new { SeName = subCategory1.CategoryModel.SeName })">@subCategory1.CategoryModel.Name</a></li>
                                        
                                    }
                                </ul>
                            </li>
                                    categoriesCounter++;

                        }
                    </ul>




Regards


Hi garrie007,

What does  list item1 means?
The code that I gave you works if list item1 is a subcategory of Sub B for example.
I can see from your website, that you have only 1 level of subcategories (top level category => subcategory) the code will work for top level category => subcategory=> subcategory
Thank you for choosing our products! Your feedback is important to us!
garrie007
11 years ago
#1906 Quote
Avatar
  • 7
IvanStoyanov wrote:
Hi,

I have done the required changes but its still not working, code and photo below.

Category setting:

Main cat: Products and both sub cats use Products as main parent category.

Menu picture:


Admin settings:




<ul>
                        @{var categoriesCounter = 0;}
                        @foreach (var subCategory in category.SubCategories)
                        {
                            if (categoriesCounter == megaMenuSettings.NumberOfCategories && megaMenuSettings.NumberOfCategories != 0)
                            {
                            <li><a class="view-all" href="@Url.RouteUrl("Category", new { categoryId = category.CategoryModel.Id, SeName = category.CategoryModel.SeName })">@T("SevenSpikes.MegaMenu.ViewAllCategories")</a>
                            </li>
                                break;
                            }                        
                            <li><a href="@Url.RouteUrl("Category", new { categoryId = subCategory.CategoryModel.Id, SeName = subCategory.CategoryModel.SeName })">@subCategory.CategoryModel.Name</a>
                                <ul>
                                    @foreach (var subCategory1 in subCategory.SubCategories)
                                    {                                        
                                        <li><a href="@Url.RouteUrl("Category", new { SeName = subCategory1.CategoryModel.SeName })">@subCategory1.CategoryModel.Name</a></li>
                                        <li><a href="@Url.RouteUrl("Category", new { SeName = subCategory1.CategoryModel.SeName })">@subCategory1.CategoryModel.Name</a></li>
                                        
                                    }
                                </ul>
                            </li>
                                    categoriesCounter++;

                        }
                    </ul>




Regards

Hi garrie007,

What does  list item1 means?
The code that I gave you works if list item1 is a subcategory of Sub B for example.
I can see from your website, that you have only 1 level of subcategories (top level category => subcategory) the code will work for top level category => subcategory=> subcategory


Hi,

I am trying to achieve like in your theme electronics, shop by category but for each main seperate category in my menu.

A                  B                   C(main)            D                       E                         F
                                          |
                                          |----------------------|---------------------|--------------------|
                                          |                           |                           |                         |
                                          Sub cat A          Sub cat B          Sub cat C            Manufact List
                                          product cat1     product cat1      product cat1        manufactor1
                                          product cat2     product cat2      product cat2        manufactor2
                                          product cat3     product cat3
                                                                   product cat4
                                                                   product cat5




Regards