How to remove left side categories from homepage? Help pls

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
8 years ago
Hi guys. Can somebody help me to remove categories from left side on homepage. Ck picture.



as we have only Catalog and Join Our Team in Top Menu, we need this to stay on mobile website version also. Ty
8 years ago
Hi,

You can go to this file: \Views\Shared\_ColumnsThree.cshtml and find this row:
@Html.Action("CategoryNavigation", "Catalog", new { currentCategoryId = currentCategoryId, currentProductId = currentProductId })

Then comment it like this:
@*@Html.Action("CategoryNavigation", "Catalog", new { currentCategoryId = currentCategoryId, currentProductId = currentProductId })*@

This will hide the Category Navigation from all pages that uses the three columns template.

Then go to this file: \Views\Shared\_ColumnsTwo.cshtml and repeat the same task. This will hide the Category Navigation from all pages that uses the two columns template.

I hope this helped!
8 years ago
HI. Tnx on ur help, its worked but homepage was ERROR and nothing show up. other pages worked and categories disappeared on left side.
8 years ago
CarpeDiem wrote:
HI. Tnx on ur help, its worked but homepage was ERROR and nothing show up. other pages worked and categories disappeared on left side.


Hi,

Maybe there is even a better way to achieve what you want. I told you to change the _ColumnsTwo.cshtml view, but it is not necessary since you want to remove the category navigation only from the home page (I though that when you have the categories in the menu you will not need them on any page). So you can revert the _ColumnsTwo view.

About the _ColumnsThree.cshtml view - replace the whole row:
@Html.Action("CategoryNavigation", "Catalog", new { currentCategoryId = currentCategoryId, currentProductId = currentProductId })

with this code:
if (!Url.RequestContext.RouteData.Values["controller"].ToString().Equals("home", StringComparison.InvariantCultureIgnoreCase) &&
            !Url.RequestContext.RouteData.Values["action"].ToString().Equals("index", StringComparison.InvariantCultureIgnoreCase))
        {
            @Html.Action("CategoryNavigation", "Catalog", new { currentCategoryId = currentCategoryId, currentProductId = currentProductId })
        }


This will hide the category navigation only when you are on the home page. Exactly what you wanted!
8 years ago
Nop-Templates.com wrote:
HI. Tnx on ur help, its worked but homepage was ERROR and nothing show up. other pages worked and categories disappeared on left side.

Hi,

Maybe there is even a better way to achieve what you want. I told you to change the _ColumnsTwo.cshtml view, but it is not necessary since you want to remove the category navigation only from the home page (I though that when you have the categories in the menu you will not need them on any page). So you can revert the _ColumnsTwo view.

About the _ColumnsThree.cshtml view - replace the whole row:
@Html.Action("CategoryNavigation", "Catalog", new { currentCategoryId = currentCategoryId, currentProductId = currentProductId })

with this code:
if (!Url.RequestContext.RouteData.Values["controller"].ToString().Equals("home", StringComparison.InvariantCultureIgnoreCase) &&
            !Url.RequestContext.RouteData.Values["action"].ToString().Equals("index", StringComparison.InvariantCultureIgnoreCase))
        {
            @Html.Action("CategoryNavigation", "Catalog", new { currentCategoryId = currentCategoryId, currentProductId = currentProductId })
        }


This will hide the category navigation only when you are on the home page. Exactly what you wanted!


Hello Sir. And thx again for your time and help. your code working :) yes I wrote on homepage, but its need to be removed from all pages. In first your code all was good, left side categores disappeared from all pages but homepage cant be opened cause of error. Now this your new code working good on homepage but it showing categories on all other pages. We need only that and one more thing if u know how to add phone number field on Contact Us form and we can open our business and start selling. Again I wanna thank you on your time and help.
8 years ago
CarpeDiem wrote:

Hello Sir. And thx again for your time and help. your code working :) yes I wrote on homepage, but its need to be removed from all pages. In first your code all was good, left side categores disappeared from all pages but homepage cant be opened cause of error. Now this your new code working good on homepage but it showing categories on all other pages. We need only that and one more thing if u know how to add phone number field on Contact Us form and we can open our business and start selling. Again I wanna thank you on your time and help.


Hi,

Now I am not sure if you want to remove the category navigation from all pages or only from the home page. If you want to remove it from all pages use the first method (you can write here what was your error on the home page, so we can help you fix it), if you want to remove it only from home page - use the second one.

About the Contact Us form - this will require changing of the code, which I personally do not recommend you - you should change the view, the model and the controller.
8 years ago
Nop-Templates.com wrote:

Hello Sir. And thx again for your time and help. your code working :) yes I wrote on homepage, but its need to be removed from all pages. In first your code all was good, left side categores disappeared from all pages but homepage cant be opened cause of error. Now this your new code working good on homepage but it showing categories on all other pages. We need only that and one more thing if u know how to add phone number field on Contact Us form and we can open our business and start selling. Again I wanna thank you on your time and help.

Hi,

Now I am not sure if you want to remove the category navigation from all pages or only from the home page. If you want to remove it from all pages use the first method (you can write here what was your error on the home page, so we can help you fix it), if you want to remove it only from home page - use the second one.

About the Contact Us form - this will require changing of the code, which I personally do not recommend you - you should change the view, the model and the controller.


Well I read your answer 5 mins ago, and I repeat your steps, and now all works great :D I guess I made some mistake in copy-paste yesterday.  For contact us form, we need some form where our potential consultants can request info but they have to write phone number to call them. We will run MLM business and phone number field will be very helpful. Tnx again cause u for stopping by to help again.
8 years ago
Excellent code for hide categorys from homepage nop-Templates!

Could you please write code for the opposite, hide eg. "RecentlyAddedProducts" from page but not from homepage? use of _ColumnsTwo left side.


Best regards!
8 years ago
CarpeDiem wrote:
HI. Tnx on ur help, its worked but homepage was ERROR and nothing show up. other pages worked and categories disappeared on left side.

Hi,

Maybe there is even a better way to achieve what you want. I told you to change the _ColumnsTwo.cshtml view, but it is not necessary since you want to remove the category navigation only from the home page (I though that when you have the categories in the menu you will not need them on any page). So you can revert the _ColumnsTwo view.

About the _ColumnsThree.cshtml view - replace the whole row:
@Html.Action("CategoryNavigation", "Catalog", new { currentCategoryId = currentCategoryId, currentProductId = currentProductId })

with this code:
if (!Url.RequestContext.RouteData.Values["controller"].ToString().Equals("home", StringComparison.InvariantCultureIgnoreCase) &&
            !Url.RequestContext.RouteData.Values["action"].ToString().Equals("index", StringComparison.InvariantCultureIgnoreCase))
        {
            @Html.Action("CategoryNavigation", "Catalog", new { currentCategoryId = currentCategoryId, currentProductId = currentProductId })
        }


This will hide the category navigation only when you are on the home page. Exactly what you wanted!

Hello Sir. And thx again for your time and help. your code working :) yes I wrote on homepage, but its need to be removed from all pages. In first your code all was good, left side categores disappeared from all pages but homepage cant be opened cause of error. Now this your new code working good on homepage but it showing categories on all other pages. We need only that and one more thing if u know how to add phone number field on Contact Us form and we can open our business and start selling. Again I wanna thank you on your time and help.



This code work awesome in me, thanks a lot my problem solve without lot of effort
6 years ago
Isn't there any way to disable sidebar from admin panel ?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.