AbleCommerce Forums
»
AbleCommerce
»
General Questions
»
Moving a category does not update it's url
Rank: Advanced Member
Groups: HelpDesk, Developers Joined: 11/9/2018(UTC) Posts: 564
Thanks: 122 times Was thanked: 26 time(s) in 25 post(s)
|
When I move a sub category from one root category to another, the CategoryUrl value does not update.
So if I start with the /Dogs/Dog_Collars/ category and move it to /Cats/, previewing the Dog_Collars category gives me a url of /Dogs/Dog_Collars
This is a problem for my client. They don't want the old catalog path locked in when they move a sub category in the store. If we're going to be forced to have the catalog path in the url, why isn't it being updated when we move categories?
Or am I missing something here?
|
|
|
|
Rank: Advanced Member
Groups: Admin, Developers, Registered, HelpDesk, Authorized User Joined: 10/5/2018(UTC) Posts: 704
Thanks: 5 times Was thanked: 113 time(s) in 112 post(s)
|
Thanks for pointing this out. I am registering this as a bug. For now, you can try the following fix: 1- Open file \Areas\Admin\Controllers\CategoryController.cs 2- Search for function MoveCatalogObjects() and locate the following line of code Code:if (!product.Categories.Contains(moveModel.SelectedCategoryId)) product.Categories.Add(moveModel.SelectedCategoryId);
3- Replace with Code:if (!product.Categories.Contains(moveModel.SelectedCategoryId)) product.Categories.Add(moveModel.SelectedCategoryId);
product.GenerateUrl();
|
|
|
|
Rank: Advanced Member
Groups: HelpDesk, Developers Joined: 11/9/2018(UTC) Posts: 564
Thanks: 122 times Was thanked: 26 time(s) in 25 post(s)
|
This didn't work for me. I'm moving a category, not a product. The line to replace is inside Code:if (catalogItem is Product)
Your code change will never get hit if I'm moving a category.
|
|
|
|
Rank: Advanced Member
Groups: HelpDesk, Developers Joined: 11/9/2018(UTC) Posts: 564
Thanks: 122 times Was thanked: 26 time(s) in 25 post(s)
|
You pointed me in the right direction. To fix it for categories, you must regenerate the category url in the foreach loop above your code change. I'm guessing this bug actually applies to all catalog object types in this routine, so I should call GenerateUrl() in each object type? Code:
if (_Categories != null)
{
foreach (Category category in _Categories)
{
category.ParentId = moveModel.SelectedCategoryId;
// 7-29-2021
// bug fix from Able
category.GenerateUrl();
// end bug fix
_categoryRepo.Save(category);
}
}
|
1 user thanked Joe Payne2 for this useful post.
|
|
|
Rank: Advanced Member
Groups: Authorized User, Registered, Developers, HelpDesk Joined: 11/30/2018(UTC) Posts: 86
Thanks: 8 times Was thanked: 1 time(s) in 1 post(s)
|
Thanks for the heads up on this issue with moving products. When I was finished, I had 22 errors in my logs. Quote:An error has occured at https://192.168.0.2/Admi...arentId=2722&id=2722 View less Exception: The request queue limit of the session is exceeded. Stack Trace: at System.Web.SessionState.SessionStateModule.QueueRef() at System.Web.SessionState.SessionStateModule.PollLockedSession() at System.Web.SessionState.SessionStateModule.GetSessionStateItem() at System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) I don't know know if this could be related to being a Dev test site I'm working with. Ricky
|
|
|
|
Rank: Advanced Member
Groups: HelpDesk, Developers Joined: 11/9/2018(UTC) Posts: 564
Thanks: 122 times Was thanked: 26 time(s) in 25 post(s)
|
|
|
|
|
Rank: Advanced Member
Groups: Authorized User, Registered, Developers, HelpDesk Joined: 11/30/2018(UTC) Posts: 86
Thanks: 8 times Was thanked: 1 time(s) in 1 post(s)
|
This Box is a 2016 Server with SQL 2019 Express running ASP.net 4.8
I run each test site in their own application pool as well.
|
|
|
|
Rank: Administration
Groups: Admin, Administrators, HelpDesk, System, Authorized User, Developers, Registered Joined: 10/5/2018(UTC) Posts: 175
Thanks: 8 times Was thanked: 17 time(s) in 15 post(s)
|
If you move a catalog object to a different category then you will have to readjust the URL. This is because in AC9, if you make any change to URL then the previous URL will no longer work. Unless you create a redirect to preserve any previously indexed references, changing the URL may result in loss of SEO. Perhaps, it would make more sense to simply regenerate the URLs if you are still under development. In a LIVE website you will have to carefully consider the implications of moving items from one category to another. Similarly, if you rename an item you will notice the message we show regarding the URL of item. You have to adjust it manually and optionally you can choose to add a redirect from previous URL. Edited by user Tuesday, August 3, 2021 8:25:29 AM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: HelpDesk, Developers Joined: 11/9/2018(UTC) Posts: 564
Thanks: 122 times Was thanked: 26 time(s) in 25 post(s)
|
Originally Posted by: mazhar If you move a catalog object to a different category then you will have to readjust the URL. Surely this can be automated like you do when a product or category url is edited and the checkbox appears to create an automatic redirect rule? This is a major hassle going forward. Every category move anyone makes will require two additional separate and manual steps. One to fix the url, another to create the redirect rule. There's no reason the code couldn't do both automatically. Otherwise this just sets up store admins for a whole lot of confusion. People aren't going to remember it every single time. I've got clients with over 700 categories. They're moving stuff all the time. This issue effectively triples that workload.
|
|
|
|
AbleCommerce Forums
»
AbleCommerce
»
General Questions
»
Moving a category does not update it's url
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The AbleCommerce Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close