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
speedythinker1832579  
#1 Posted : Tuesday, September 1, 2020 2:52:36 PM(UTC)
speedythinker1832579

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 5/20/2019(UTC)
Posts: 54

Thanks: 1 times
I've been using Able since 5.x. And even the latest V9.x still lack of the 'state' capability. Not sure if it is browser issue or coding issue

Let's say I'm editing a product on page 3 and a few other similar products on the same page. Once I finished the editing and click "Save & Close", the page sent back to Page 1. So, I have to click Page 3 again in order to edit other products on that page.

The worst task that I ever experienced was that when I tried to position a product on a page by using Up or Dn arrow button, say page 2 other than Page 1, each click on the arrow button will send me back to the page 1. So, I have to go back to that particular page, hit an arrow key to do the sorting. It was so annoying because the 'state' was not being kept. If the the "state" is working, I should be able to stay on the same page and finished all product positions sorting quickly.

Can this be fixed?

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

ray22901031  
#2 Posted : Tuesday, September 1, 2020 3:08:58 PM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 909

Thanks: 3 times
Was thanked: 15 time(s) in 15 post(s)
I know exactly what you mean, this is what I use to work around the problem. When I add or edit products or pretty much anything and I don't want to lose my place, I always hold the control key and then click the link. This will open the product that I need to edit in a new window still keeping the same session ID. When I finish editing and saving the product, I merely closed the new window without losing my place in the old window.

The only drawback to this is that you will not see your changes unless you do a refresh on the old window, which of course could mess things up again, but for me that's okay, especially when you're working on a product that happens to be four pages down.

I hope this helps.
-Ray
shari  
#3 Posted : Wednesday, September 2, 2020 1:26:53 AM(UTC)
shaharyar

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)
Hi All,

This is actually how the paging is implemented. We are not preserving the page information across multiple requests. We will see what can be done to resolve the issue.

Thanks for your feedback.
Shaharyar
shari  
#4 Posted : Wednesday, September 2, 2020 3:13:53 AM(UTC)
shaharyar

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)
To fix the sorting issue for Browse Catalog page, you can follow these steps:

1- Open file \Website\Areas\Admin\Controllers\CategoryController.cs
2- Find the code for function SortcategoryItem

Code:
public ActionResult SortcategoryItem(string CommandName, int itemIndex, int catalogNodeId, int catalogNodeTypeId)
        {
            Category currentCategory = GetCategory();
            CatalogNodeType catalogNodeType = (CatalogNodeType)AlwaysConvert.ToInt(catalogNodeTypeId);
            int index;
            switch (CommandName)
            {
                case "MoveUp":
                    index = currentCategory.CatalogNodes.IndexOf(currentCategory.Id, catalogNodeId, (byte)catalogNodeType);
                    if (index > 0)
                    {
                        CatalogNode tempNode = currentCategory.CatalogNodes[index - 1];
                        currentCategory.CatalogNodes[index - 1] = currentCategory.CatalogNodes[index];
                        currentCategory.CatalogNodes[index] = tempNode;
                        short newOrderBy = 0;
                        foreach (CatalogNode node in currentCategory.CatalogNodes)
                        {
                            node.OrderBy = newOrderBy;
                            _catalogNodeRepo.Save(node);
                            newOrderBy++;
                        }

                        // recalculate orderby for impacted child products
                        RecalculateOrderBy(currentCategory.CatalogNodes[index - 1]);
                        RecalculateOrderBy(currentCategory.CatalogNodes[index]);

                        // reset the category menu cache for retail side
                        ResetCategoryMenuCache();
                    }
                    break;
                case "MoveDown":
                    index = currentCategory.CatalogNodes.IndexOf(currentCategory.Id, catalogNodeId, (byte)catalogNodeType);
                    if (index < currentCategory.CatalogNodes.Count - 1)
                    {
                        CatalogNode tempNode = currentCategory.CatalogNodes[index + 1];
                        currentCategory.CatalogNodes[index + 1] = currentCategory.CatalogNodes[index];
                        currentCategory.CatalogNodes[index] = tempNode;
                        short newOrderBy = 0;
                        foreach (CatalogNode node in currentCategory.CatalogNodes)
                        {
                            node.OrderBy = newOrderBy;
                            _catalogNodeRepo.Save(node);
                            newOrderBy++;
                        }

                        // recalculate orderby for impacted child products
                        RecalculateOrderBy(currentCategory.CatalogNodes[index + 1]);
                        RecalculateOrderBy(currentCategory.CatalogNodes[index]);

                        // reset the category menu cache for retail side
                        ResetCategoryMenuCache();
                    }
                    break;
            }
            return ListCategories();
        }


3- And replace it with

Code:
public ActionResult SortcategoryItem(string CommandName, int itemIndex, int catalogNodeId, int catalogNodeTypeId, int page = 1, int pageSize = 20)
        {
            Category currentCategory = GetCategory();
            CatalogNodeType catalogNodeType = (CatalogNodeType)AlwaysConvert.ToInt(catalogNodeTypeId);
            int index;
            switch (CommandName)
            {
                case "MoveUp":
                    index = currentCategory.CatalogNodes.IndexOf(currentCategory.Id, catalogNodeId, (byte)catalogNodeType);
                    if (index > 0)
                    {
                        CatalogNode tempNode = currentCategory.CatalogNodes[index - 1];
                        currentCategory.CatalogNodes[index - 1] = currentCategory.CatalogNodes[index];
                        currentCategory.CatalogNodes[index] = tempNode;
                        short newOrderBy = 0;
                        foreach (CatalogNode node in currentCategory.CatalogNodes)
                        {
                            node.OrderBy = newOrderBy;
                            _catalogNodeRepo.Save(node);
                            newOrderBy++;
                        }

                        // recalculate orderby for impacted child products
                        RecalculateOrderBy(currentCategory.CatalogNodes[index - 1]);
                        RecalculateOrderBy(currentCategory.CatalogNodes[index]);

                        // reset the category menu cache for retail side
                        ResetCategoryMenuCache();
                    }
                    break;
                case "MoveDown":
                    index = currentCategory.CatalogNodes.IndexOf(currentCategory.Id, catalogNodeId, (byte)catalogNodeType);
                    if (index < currentCategory.CatalogNodes.Count - 1)
                    {
                        CatalogNode tempNode = currentCategory.CatalogNodes[index + 1];
                        currentCategory.CatalogNodes[index + 1] = currentCategory.CatalogNodes[index];
                        currentCategory.CatalogNodes[index] = tempNode;
                        short newOrderBy = 0;
                        foreach (CatalogNode node in currentCategory.CatalogNodes)
                        {
                            node.OrderBy = newOrderBy;
                            _catalogNodeRepo.Save(node);
                            newOrderBy++;
                        }

                        // recalculate orderby for impacted child products
                        RecalculateOrderBy(currentCategory.CatalogNodes[index + 1]);
                        RecalculateOrderBy(currentCategory.CatalogNodes[index]);

                        // reset the category menu cache for retail side
                        ResetCategoryMenuCache();
                    }
                    break;
            }
            return ListCategories(page: page, pageSize: pageSize);
        }


4- Now open view file \Website\Areas\Admin\Views\Category\_ListCategories.cshtml
5- Find the code

Code:
@Ajax.ActionLink(" ", "SortCategoryItem", "Category", new { CategoryId = category.ParentCategoryId, catalogNodeId = category.CatalogNodeId, catalogNodeTypeId = category.CatalogNodeTypeId, itemIndex = i, CommandName = "MoveUp" }, new AjaxOptions() { UpdateTargetId = "categories-list-container", OnSuccess = "initAbleGrid" }, new { @class = "fa fa-arrow-up" })
@Ajax.ActionLink(" ", "SortCategoryItem", "Category", new { CategoryId = category.ParentCategoryId, catalogNodeId = category.CatalogNodeId, catalogNodeTypeId = category.CatalogNodeTypeId, itemIndex = i, CommandName = "MoveDown" }, new AjaxOptions() { UpdateTargetId = "categories-list-container", OnSuccess = "initAbleGrid" }, new { @class = "fa fa-arrow-down" })



6- Replace it with

Code:
@Ajax.ActionLink(" ", "SortCategoryItem", "Category", new { page = Model.Categories.PageNumber, pageSize = Model.Categories.PageSize, CategoryId = category.ParentCategoryId, catalogNodeId = category.CatalogNodeId, catalogNodeTypeId = category.CatalogNodeTypeId, itemIndex = i, CommandName = "MoveUp" }, new AjaxOptions() { UpdateTargetId = "categories-list-container", OnSuccess = "initAbleGrid" }, new { @class = "fa fa-arrow-up" })
@Ajax.ActionLink(" ", "SortCategoryItem", "Category", new { page = Model.Categories.PageNumber, pageSize = Model.Categories.PageSize, CategoryId = category.ParentCategoryId, catalogNodeId = category.CatalogNodeId, catalogNodeTypeId = category.CatalogNodeTypeId, itemIndex = i, CommandName = "MoveDown" }, new AjaxOptions() { UpdateTargetId = "categories-list-container", OnSuccess = "initAbleGrid" }, new { @class = "fa fa-arrow-down" })


7- This includes a change in a controller file, so you need to compile the project.

Users browsing this topic
Guest
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.