Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new useful columns in products tab in category view #2713

Merged
merged 14 commits into from
Apr 26, 2024

Conversation

dbachmann
Copy link
Contributor

Description (*)

Sometimes when you work in the category view in backend it is necessary to edit a product. It was not possible to edit a product from the products tab in category. To improve usability in backend I added two more columns: One with the current product status and the other provides an edit link which opens the desired product in a popup.

category_view_be

Manual testing scenarios (*)

  1. Go to categories
  2. Open a category
  3. Open products tab
  4. Click on edit

@github-actions github-actions bot added the Component: Adminhtml Relates to Mage_Adminhtml label Nov 16, 2022
matteotestoni
matteotestoni previously approved these changes Apr 5, 2023
@fballiano fballiano changed the base branch from 1.9.4.x to main May 12, 2023 22:41
@fballiano fballiano dismissed matteotestoni’s stale review May 12, 2023 22:41

The base branch was changed.

@fballiano fballiano changed the base branch from main to 1.9.4.x May 12, 2023 22:41
@fballiano
Copy link
Contributor

fixed conflict

@fballiano fballiano force-pushed the usability_improvement_category branch from b6f72e7 to f8a125c Compare May 12, 2023 22:51
@fballiano fballiano changed the base branch from 1.9.4.x to main May 12, 2023 22:52
@ADDISON74
Copy link
Collaborator

ADDISON74 commented Mar 3, 2024

My comments related to this PR are the following

SOLVED
1 - The positioning of the columns in this product grid must be the same as the ones in the Related, Up-sells, Cross-sells grids, which can be found in the product editing page. A first requested change, the Status column must be placed to be next after the Name column.

status

SOLVED
2 - Not only the Status must be added as a column in this grid, but also other columns that are absolutely essential when adding products directly to the category page and that make work more efficient. Similar to the grids mentioned in point 1, Type, Attribute Set Name, Visibility are important and must be added. A product should not be searched only by name.

NOT SOLVED
3 - This is an editable grid. If the [Save] button is not clicked before the Edit link is used, all the changes made in that page, not only in the grid (product addition/removal, position) are lost. In addition, there is no warning icon that you must save your work. As it is now, the voluntary or involuntary click of the Edit link loads the product editing page in the same window, at which point all the changes made are lost. I read your comments, the decision to remove the initial code was in a 1 to 1 situation. My opinion is that we should not force the users to hold down the Shift key to open a new window. Firstly, that they don't know about it, secondly, that they don't do it out of error, fatigue. The situation is similar to other cases of editing in a page where changes behind must be kept, such as Associated Products and where the Magento team has taken this into account. Adding this action must follow the existing behavior in OpenMage and this means to open the editing in another window.

NOT SOLVED
4 - In the window that opens, it would be elegant to keep the behavior of the buttons in the case of editing the Associated Products. There are only three buttons in the window, see bellow. I haven't studied how it could be done, but I think it can be solved in a new Settings.php file that is added to the same directory.

buttons

SOLVED
5 - Regarding the Status column, the line 'id' => I haven't found it in other grids. It can be removed.

@ADDISON74
Copy link
Collaborator

This should be the Action column. popup => 1 enables only three buttons in the window [Close Window], [Reset] and [Save], like for the Associated Products.

        $this->addColumn('action', [
            'header'    => Mage::helper('catalog')->__('Action'),
            'width'     => '50px',
            'type'      => 'action',
            'getter'    => 'getId',
            'actions'   => [
                [
                    'caption'   => Mage::helper('catalog')->__('Edit'),
                    'url'       => [
                        'base'      => 'adminhtml/catalog_product/edit',
                        'params'    => [
                            'store' => $this->getRequest()->getParam('store'),
                            'popup' => 1
                        ],
                    ],
                    'field'     => 'id',
                    'onclick' => 'popWin(this.href,\'_blank\',\'width=1024,height=750,resizable=1,scrollbars=1\');return false;',
                ],
            ],
            'filter' => false,
            'sortable' => false,
            'index' => 'stores',
        ]);

There is an issue after saving the product. The bellow window doesn't have the same behavior like the one for Associated Products. The window is not closing automatically and the [Close Window] button it is not working. The error in console is

Uncaught TypeError: Cannot read properties of undefined (reading 'updateProduct')
    at addProduct (1ae108f468e971e091309d629583f5aa/:133:44)
    at 1ae108f468e971e091309d629583f5aa/:151:1

window

This change makes the Category Products grid having the same columns and format as the Related Products / Up-sells / Cross-sells grids.
@ADDISON74
Copy link
Collaborator

ADDISON74 commented Mar 3, 2024

I have updated this PR. Now the grid has the same format as those in Related Products / Up-sells / Cross-sells.

The unsolved problem is still the editing action:

1 - Editing a product must be done in a new window, opened by clicking on the link and having the same behavior as when the associated products are edited.

2 - There must be 3 buttons in the window. After pressing the [Save] button, the window either closes automatically or by pressing the [Close Window] button, exactly the same behavior as when the associated products are edited.

3 - Editing a product should update the grid. For example, when the status of the product is changed by saving, the change does not occur in the grid. A click on other category then coming back to the initial category will make visible the changes.

PS - I deleted some irrelevant posts.

@OpenMage OpenMage deleted a comment from fballiano Mar 3, 2024
@OpenMage OpenMage deleted a comment from fballiano Mar 3, 2024
@ADDISON74 ADDISON74 changed the title Added two new columns in products tab in category view Added new useful columns in products tab in category view Mar 7, 2024
@fballiano
Copy link
Contributor

fballiano commented Apr 25, 2024

I don't like the opening of new windows because accessibility mandates that it has to be the user to decide if they want the same window, a new tab or a new window.

but since it's already used in configurable products, I've reverted my change and implemented the popup parameter as requested by @ADDISON74 to have the same behavior (and same window name) of the configurable products management page.

since everything seems to be working fine and there were already quite some tests, if all workflows are green I'll merge it.

fballiano
fballiano previously approved these changes Apr 25, 2024
@fballiano
Copy link
Contributor

actually... no... adding the popup parameter has this behavior now

Screenshot 2024-04-25 alle 19 18 56

@github-actions github-actions bot added Component: Catalog Relates to Mage_Catalog Template : admin Relates to admin template labels Apr 25, 2024
@fballiano
Copy link
Contributor

this is because the popup parameter calls some specific javascript code for configurables:

Screenshot 2024-04-25 alle 19 20 14

I' ve now patched the js in order to not have the js error when trying to close the windows (tested both here and configurable and both still work) but I wouldn't develop all this new javascript just to refresh the grid, it seems too much for this small functionality

@fballiano
Copy link
Contributor

I made the reload work yeah! so all of the points listed by @ADDISON74 should be solved

Copy link
Collaborator

@ADDISON74 ADDISON74 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked this PR and all my previous reported issues were resolved. Editing a product opens a new window, there are 3 buttons as in the case of associated products, if the status of the product is changed and the [Save] button is pressed, the status is immediately changed in the grid on the category page. The editing window closes automatically if the button is not pressed. I found no errors in the console. There have been similar paid or free versions in the past, but none offered what was implemented here.

@fballiano - thank you for completing this PR.

@fballiano
Copy link
Contributor

one more on the road to zero PRs, let's go!

@fballiano fballiano merged commit ed47436 into OpenMage:main Apr 26, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Adminhtml Relates to Mage_Adminhtml Component: Catalog Relates to Mage_Catalog documentation environment Template : admin Relates to admin template
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants