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

Enhancement for categories management and products grids #1379

Closed
wants to merge 3 commits into from
Closed

Enhancement for categories management and products grids #1379

wants to merge 3 commits into from

Conversation

luigifab
Copy link
Contributor

@luigifab luigifab commented Jan 8, 2021

Latest version is here with IPv6.

Description

It allow to keep current selected tab on store switch, and to keep current category and current store on refresh in categories management. It prevents to add a new category without a parent category.

It add columns to products grid in categories (status, visibility, action).

image

It open product edit in a popin (without header and footer) with the current selected store in categories and in associated products of configurable products. You can also open the edit page in a new tab or in a new window.

image

It allow to check or uncheck products only when clicking on the checkbox or in the td that contain the checkbox for all grids (products in categories ; related, upsell, crosssell, associated (for grouped and configurable products)).

OpenMage 20.0.13 / PHP 7.4.11 - 8.0.11

Manual testing scenarios

TEST 1
Go to Catalog / Categories.

  • Try to create a new subcategory without selecting a parent. This is not possible.
  • You can check or uncheck products only when clicking on td input.
  • New columns "Status", "Visibility" and "Action".
  • The edit link opens product edit page in popup (with the current store).
  • You can open the [Edit] link in a new browser tab (middle click or right click "Open in a new tab/window").
  • Use Name, Price, Status and Visibility values from selected store.

TEST 2
Go to Catalog > Categories the select any category.
Go to Category Products tab.

  • Select another store with store switcher. The current tab is not lost.
  • Press F5 or refresh the page. The current category and the current store are not lost.
  • Uncheck all products then reset filter or filter or sort or page change. After AJAX all products are unchecked.

TEST 3
Go to Catalog > Products and choose any configurable product. For Associated Products grid.

  • You can check or uncheck products only when clicking on td input.
  • The [Edit] link opens product edit page in popup (with the current store)
  • You can open the [Edit] link on a new tab (middle click or right click open in a new tab/window)

TEST 4
Go to Catalog > Products and choose any product.
For Related, Up-sells and Cross-sells, Associated (for grouped products) grids.

  • Uncheck all products then reset filter or filter or sort or page change. After AJAX all products are unchecked.
  • Check some products then reset filter or filter or sort or page change. After AJAX selected products are checked.
  • You can check check or uncheck products only when clicking on td input.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)
  • Add yourself to contributors list

colinmollenhour
colinmollenhour previously approved these changes Jan 8, 2021
@addison74
Copy link
Contributor

Could you please provide some insides why you wanted to add those columns? For example Status column - it could be OK. In this way you know what products are Enable/Disable.

My suggestion is for a link at the end of the row to edit the product. This could be a much better option. Once I see a product Disable I can edit it with one click.

@luigifab
Copy link
Contributor Author

luigifab commented Jan 9, 2021

Yes, this is only to easily see which products can be displayed in the category.
We can also add a link to the product page, why not.

@kiatng kiatng added the Component: Adminhtml Relates to Mage_Adminhtml label Jan 10, 2021
@github-actions github-actions bot added Component: Catalog Relates to Mage_Catalog Template : admin Relates to admin template translations Relates to app/locale labels May 29, 2021
@luigifab luigifab changed the title Enhancement for catalog/categories Enhancement for categories management May 29, 2021
@Flyingmana
Copy link
Contributor

Could someone check the sql queries which change here?
Having a Explain of the query would be even better.

@luigifab
Copy link
Contributor Author

luigifab commented Jun 20, 2021

Request before:

SELECT `e`.*, `at_position`.`position` FROM `catalog_product_entity` AS `e`
 LEFT JOIN `catalog_category_product` AS `at_position` ON (at_position.`product_id`=e.entity_id) AND (category_id=2)

image

Request after:

SELECT `e`.*, `at_position`.`position`, `at_name`.`value` AS `name`, `at_price`.`value` AS `price`, `at_status`.`value` AS `status`, `at_visibility`.`value` AS `visibility` FROM `catalog_product_entity` AS `e`
 LEFT JOIN `catalog_category_product` AS `at_position` ON (at_position.`product_id`=e.entity_id) AND (category_id=2)
 LEFT JOIN `catalog_product_entity_varchar` AS `at_name` ON (`at_name`.`entity_id` = `e`.`entity_id`) AND (`at_name`.`attribute_id` = '73') AND (`at_name`.`store_id` = 0)
 LEFT JOIN `catalog_product_entity_decimal` AS `at_price` ON (`at_price`.`entity_id` = `e`.`entity_id`) AND (`at_price`.`attribute_id` = '77') AND (`at_price`.`store_id` = 0)
 LEFT JOIN `catalog_product_entity_int` AS `at_status` ON (`at_status`.`entity_id` = `e`.`entity_id`) AND (`at_status`.`attribute_id` = '98') AND (`at_status`.`store_id` = 0)
 LEFT JOIN `catalog_product_entity_int` AS `at_visibility` ON (`at_visibility`.`entity_id` = `e`.`entity_id`) AND (`at_visibility`.`attribute_id` = '104') AND (`at_visibility`.`store_id` = 0)

image

@luigifab
Copy link
Contributor Author

I added a link to the product page. Click on it with the mouse wheel.

@addison74
Copy link
Contributor

addison74 commented Jun 20, 2021

@luigifab - A link to edit a product from Categories page is a nice feature. Please take in consideration these two issues:

  • Visibility of the feature. It shouldn't be a mouse wheel click because if you use a laptop there are situations when you couldn't have a mouse device available and it will become a problem. My suggestion is to add a new column at the right end. Inside every cell insert an Edit link. It is more intuitive and reveals the scope of the action.

  • Target for the link. Opening the product edit page in the same window or in a new window? I would choose opening in a new window, the same behavior like when editing Associated Products in configurable products. It is a new small window and after pressing the [Save] button appears a new content with the [Close] button at the bottom. If you don't press the close button the window will close automatically. In this way you stay in Categories page without coming back after editing the product. Why editing a product? From my experience you could have a product Out of Stock or Disable and even it is listed in the grid it won't appear in Frontend.

@luigifab
Copy link
Contributor Author

You are right, I doing that.

@github-actions github-actions bot added JavaScript Relates to js/* and removed JavaScript Relates to js/* labels Jun 24, 2021
@github-actions github-actions bot added the JavaScript Relates to js/* label Jul 13, 2021
@luigifab
Copy link
Contributor Author

luigifab commented Jul 13, 2021

I added the magic link. Not really tested for now.

@luigifab luigifab marked this pull request as draft July 13, 2021 18:27
@addison74
Copy link
Contributor

Nice addition. I will test this PR.

Recently in this page dedicated to categories I was bothered to deselect the products when clicking on a row. I accidentally deselected several products just because I clicked next to the position edit input box. The select/unselect actions must be done only on clicking the checkbox at the beginning of the row, not on the whole row.

@luigifab
Copy link
Contributor Author

luigifab commented Jul 23, 2021

I replaced the popup window by a popup iframe.
The select/unselect actions is now done only on clicking the checkbox or in the cell of the checkbox.

@luigifab luigifab marked this pull request as ready for review July 23, 2021 12:47
@luigifab luigifab marked this pull request as draft October 14, 2021 07:29
@github-actions github-actions bot added the Component: Bundle Relates to Mage_Bundle label Oct 14, 2021
@luigifab
Copy link
Contributor Author

As a Debian developer might say, this PR is not acceptable.
So I rewrited it. I will update PR description.

@luigifab luigifab changed the title Enhancement for categories management Enhancement for categories management and products grids Oct 14, 2021
@luigifab luigifab marked this pull request as ready for review November 24, 2021 10:05
fballiano
fballiano previously approved these changes Aug 3, 2022
@colinmollenhour
Copy link
Member

I skimmed the diff and it looks good but have not done any testing. I think someone besides me who uses these features more often than I should take a look such as @addison74 .

@addison74
Copy link
Contributor

addison74 commented Aug 12, 2022

I tested this PR and there are issues. All my respect to the work but I will not approve it in the shape it is now.

First of all, it has to be divided into several PRs so that each change/feature must be analyzed separately and approved. For example, a PR should be about the "Category Products" grid where 4 columns are entered, the product is edited and the row is selected. Another PR should be linked to the error message in the situation when you want to create a sub-category and you have not selected the parent one. Another PR should be related to the situation switching between Stores. Here I have practically finished the Test 1 section.

This is the result after testing and analysis changes and features. I used the command git fetch origin pull/1379/head:pr1379 and I got latest OM 1.9.4.x from today August 12th with this PR:

TEST 1
Go to Catalog > Manage Categories.

  • Try to create a new subcategory without selecting a parent. This is not possible. => WORKS ONLY AFTER THE PAGE LOADING. If you select a category then keep Ctrl key and click on it to unselect then you can add a subcategory, the warning message is not appearing in this case
  • You can check or uncheck products only when clicking on td input. => TO BE DISCUSSED
  • New columns "Status", "Visibility" and "Action". => NEEDS "TYPE" COLUMN AND WIDTH FOR MOST OF THE COLUMNS TO FIX THE ACTION COLUMN WIDTH
  • The edit link opens product edit page in popup (with the current store). => OK
  • You can open the [Edit] link in a new browser tab (middle click or right click "Open in a new tab/window"). => OK
  • Use Name, Price, Status and Visibility values from selected store. => TO BE DISCUSSED. This needs more testing, it seems OM has an issue with this feature (I was not able to set different prices for English, French, German store views)

TEST 2
Go to Catalog > Manage Categories then select any category.
Go to Category Products tab.

  • Select another store with store switcher. The current tab is not lost. => TO BE DISCUSSED. This needs more testing
  • Press F5 or refresh the page. The current category and the current store are not lost. TO BE DISCUSSED. This needs more testing
  • Uncheck all products then reset filter or filter or sort or page change. After AJAX all products are unchecked. TO BE DISCUSSED. We can use click to Edit that product in a popup window, pay attention to mouse pointer which is hand

TEST 3
Go to Catalog > Manage Products and choose any configurable product. For Associated Products grid.

  • You can check or uncheck products only when clicking on td input. => TO BE DISCUSSED. We can use click to Edit that product in a popup window, pay attention to mouse pointer which is hand
  • The [Edit] link opens product edit page in popup (with the current store) => OK
  • You can open the [Edit] link on a new tab (middle click or right click open in a new tab/window) => OK

TEST 4
Go to Catalog > Manage Products and choose any product.
For Related, Up-sells and Cross-sells, Associated (for grouped products) grids.

  • Uncheck all products then reset filter or filter or sort or page change. After AJAX all products are unchecked. => TO BE DISCUSSED
  • Check some products then reset filter or filter or sort or page change. After AJAX selected products are checked. => TO BE DISCUSSED
  • You can check check or uncheck products only when clicking on td input. => TO BE DISCUSSED. We can use click to Edit that product in a popup window, pay attention to mouse pointer which is hand.

@addison74 addison74 requested review from addison74 and removed request for addison74 August 12, 2022 23:26
@addison74
Copy link
Contributor

I would like to thank @luigifab for this nice work. I tested this PR and there are some issues that need a fix.

First of all, it has to be divided into several PRs so that each change/feature should be analyzed separately and approved. For example, a PR should be about the "Category Products" grid where 4 columns are entered, the product is edited and the row is selected. Another PR should be linked to the error message in the situation when you want to create a sub-category and you have not selected the parent one. Another PR should be related to the situation switching between the Stores. Here I have practically finished the Test 1 section.

This is the result after testing and analysis changes and features. I used the command git fetch origin pull/1379/head:pr1379 and I got latest OM 1.9.4.x from today August 13th with this PR:

TEST 1
Go to Catalog > Manage Categories.

  • Try to create a new subcategory without selecting a parent. This is not possible. => WORKS ONLY AFTER THE PAGE LOADS. If you select a category then keep [Ctrl] key pressed and click on to unselect it then you can add a subcategory, the warning message is not appearing in this case
  • You can check or uncheck products only when clicking on td input. => TO BE DISCUSSED. We can use click to Edit that product in a popup window, pay attention to mouse pointer which is hand
  • New columns "Status", "Visibility" and "Action". => NEEDS "TYPE" COLUMN TOO AND SET WIDTHS FOR MOST OF THE COLUMNS TO FIX THE ACTION COLUMN WIDTH
  • The edit link opens product edit page in popup (with the current store). => OK
  • You can open the [Edit] link in a new browser tab (middle click or right click "Open in a new tab/window"). => OK
  • Use Name, Price, Status and Visibility values from selected store. => TO BE DISCUSSED. This needs more testing, it seems OM has an issue with this feature (I was not able to set different prices for English, French, German store views)

TEST 2
Go to Catalog > Manage Categories then select any category.
Go to Category Products tab.

  • Select another store with store switcher. The current tab is not lost. => TO BE DISCUSSED. This needs more testing
  • Press F5 or refresh the page. The current category and the current store are not lost. TO BE DISCUSSED. This needs more testing
  • Uncheck all products then reset filter or filter or sort or page change. After AJAX all products are unchecked. TO BE DISCUSSED. We can use click to Edit that product in a popup window, pay attention to mouse pointer which is hand

TEST 3
Go to Catalog > Manage Products and choose any configurable product. For Associated Products grid.

  • You can check or uncheck products only when clicking on td input. => TO BE DISCUSSED. We can use click to Edit that product in a popup window, pay attention to mouse pointer which is hand
  • The [Edit] link opens product edit page in popup (with the current store) => OK
  • You can open the [Edit] link on a new tab (middle click or right click open in a new tab/window) => OK

TEST 4
Go to Catalog > Manage Products and choose any product.
For Related, Up-sells, Cross-sells, Associated Products (for Grouped Product type) grids.

  • Uncheck all products then reset filter or filter or sort or page change. After AJAX all products are unchecked. => TO BE DISCUSSED
  • Check some products then reset filter or filter or sort or page change. After AJAX selected products are checked. => TO BE DISCUSSED
  • You can check/uncheck products only when clicking on td input. => TO BE DISCUSSED. We can use click to Edit that product in a popup window, pay attention to mouse pointer which is hand.

@luigifab
Copy link
Contributor Author

luigifab commented Nov 6, 2022

I will again check and fix conflicts.

matteotestoni
matteotestoni previously approved these changes Apr 5, 2023
@addison74
Copy link
Contributor

My opinion related to this PR is that it contained too many changes. Ideally it would be for each modification to have its own PR so that the revision is as easy and fast as possible. It can be seen that I tested this PR and identified a lot of problems that need to be solved and discussed. In addition, we still have some conflicts to resolve.

@matteotestoni - out of curiosity, did you test this PR before approving it? With the new RFC such approvals can lead to the integration of a PR that could create issue. Everyone, please test a PR before approving it. We should not invoke that "haste makes waste". Thank you for your understanding.

@luigifab
Copy link
Contributor Author

luigifab commented Apr 9, 2023

Yes I started to split in multiple PR.
But in same time I'm using this PR as is.
I rebasing it, and I need to check ADDISON74 comment's.

- keep current selected tab on store switch
- keep current category and current store on refresh
Improve products categories management
- allow to check or uncheck product only when clicking on td input
- add status, visibility and action columns
- open product edit popup on an iframe with the current selected store
- allow to open product edit popup on a new tab (middle click or right click open in a new tab/window)
- show name, price, status and visibility values from selected store
- keep uncheck all products after reset filter or filter or sort or page change
Improve configurable product management
- allow to check or uncheck product only when clicking on td input
- open product edit popup on an iframe with the current selected store
- allow to open product edit popup on a new tab (middle click or right click open in a new tab/window)
Improve related, upsell, crosssell, and associated (for grouped products) management
- allow to check or uncheck product only when clicking on td input
@luigifab luigifab changed the base branch from 1.9.4.x to main April 9, 2023 08:55
@luigifab luigifab dismissed matteotestoni’s stale review April 9, 2023 08:55

The base branch was changed.

@luigifab
Copy link
Contributor Author

luigifab commented May 31, 2023

Closed because this PR must be split in multiple PR... and I will be out there until 2025.
Anyway, I continue use it as is.

@luigifab luigifab closed this May 31, 2023
@luigifab luigifab deleted the add-status-visibility-by-store branch May 31, 2023 08:26
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 Don't forget this PR enhancement JavaScript Relates to js/* Template : admin Relates to admin template translations Relates to app/locale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants