logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
Joe Payne2  
#1 Posted : Wednesday, July 28, 2021 3:02:15 PM(UTC)
Joe Payne2

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?

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

shaharyar  
#2 Posted : Thursday, July 29, 2021 4:31:18 AM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 703

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();
Joe Payne2  
#3 Posted : Thursday, July 29, 2021 8:54:24 AM(UTC)
Joe Payne2

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.
Joe Payne2  
#4 Posted : Thursday, July 29, 2021 9:01:19 AM(UTC)
Joe Payne2

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);
                    }
                }
thanks 1 user thanked Joe Payne2 for this useful post.
rlopez397954 on 7/30/2021(UTC)
rlopez397954  
#5 Posted : Friday, July 30, 2021 6:44:43 PM(UTC)
rlopez397954

Rank: Advanced Member

Groups: Authorized User, Registered, Developers
Joined: 11/30/2018(UTC)
Posts: 81

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
Joe Payne2  
#6 Posted : Monday, August 2, 2021 8:13:30 AM(UTC)
Joe Payne2

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)
Interesting error, can't recall ever seeing that before. Are you running in ASP.Net 4.7?

https://stackoverflow.co...-the-session-is-exceeded
rlopez397954  
#7 Posted : Monday, August 2, 2021 10:17:41 AM(UTC)
rlopez397954

Rank: Advanced Member

Groups: Authorized User, Registered, Developers
Joined: 11/30/2018(UTC)
Posts: 81

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.
mazhar  
#8 Posted : Tuesday, August 3, 2021 8:24:17 AM(UTC)
mazhar

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

Joe Payne2  
#9 Posted : Wednesday, August 4, 2021 9:01:30 AM(UTC)
Joe Payne2

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 Go to Quoted Post
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.
Users browsing this topic
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.