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

main_table prefix on exception company_name #31764

Open
DavaGordon opened this issue Jan 19, 2021 · 12 comments
Open

main_table prefix on exception company_name #31764

DavaGordon opened this issue Jan 19, 2021 · 12 comments
Labels
Area: B2B Component: Customer Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: ready for confirmation Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: ready for grooming project: B2B Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S1 Affects critical data or functionality and forces users to employ a workaround.

Comments

@DavaGordon
Copy link

DavaGordon commented Jan 19, 2021

No description provided.

@m2-assistant
Copy link

m2-assistant bot commented Jan 19, 2021

Hi @DavaGordon. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@gabrieldagama gabrieldagama added Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Severity: S1 Affects critical data or functionality and forces users to employ a workaround. labels Jan 19, 2021
@gabrieldagama
Copy link
Contributor

Hi @DavaGordon, I couldn't reproduce this issue on 2.4, can you confirm the steps and how to reproduce such problem?

Thanks.

@gabrieldagama gabrieldagama added the Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch label Jan 27, 2021
@DavaGordon
Copy link
Author

DavaGordon commented Jan 27, 2021

Magneto 2 EE (2.3.6) / B2B Module / Magneto Cloud

Steps
Admin Login > Customers

Filter by company name issue occurred reason for this is the reference of company name was coming from the company table which was not in the main table so when we filtered by company we received this issue. this was tested across 3 seperate websites all using similar environment specs and with all none standard magento modules disabled.

Outcome
Unable to filter by company name. after some investigation i found that the original code

if (is_string($field) && count(explode('.', $field)) === 1) {

Always returned true as a result the it returning true the prefix of main_table was added to company_name which if you look at the overall code did no exist in the customer_grid_flat table as we had the company module active so the code should have returned false and retrieved the value from the

company.company_name rather than customer_grid_flat(main_table).company_name

The code below which was put in place on all 3 environments checks the main_table index to check if the column is valid if returns true it will append the main_table prefix otherwise the reference will look in the correct place which is the company table

if (is_string($field) && in_array($field, $this->getFulltextIndexColumns())) {

Tested 3 environments no link in code base 3 seperate companies all same issue. fix resolves issue for all 3

@m2-community-project m2-community-project bot added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Feb 18, 2021
@gabrieldagama gabrieldagama removed the Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. label Feb 18, 2021
@danieluniform
Copy link

danieluniform commented Oct 12, 2021

This bug occurs in Magento 2.3.7-pt2 as well. Default Magento does not have Company fields setup but once customers are linked to companies, I believe it's not hard to reproduce this error.

@danieluniform
Copy link

Solved this on our platform with a before plugin.

/**
     * Fix Magento 2.3.7 problem of not being able to locate the company_name field.
     *
     * @param \Magento\Customer\Model\ResourceModel\Grid\Collection $subject
     * @param $field
     * @param $condition
     * @return array
     */
    public function beforeAddFieldToFilter(\Magento\Customer\Model\ResourceModel\Grid\Collection $subject, $field, $condition) {
        if (strpos($field, 'company_name') !== false ) {
            $field = 'company.company_name';
        }
        return [$field, $condition];
    }

@danieluniform
Copy link

It's not really necessary to reproduce this ticket in order to see that this problem exists.

The list of columns in customer_grid_flat is : ["name","email","created_in","taxvat","shipping_full","billing_full","billing_firstname","billing_lastname","billing_telephone","billing_postcode","billing_region","billing_city","billing_fax","billing_company"]

By default, company_name (as in the search fields) is not in customer_grid_flat. Thus, filtering by "company" breaks as it's not a part of the customer index. This should probably be fixed by someone on the team.

@apedicdev
Copy link
Contributor

@danieluniform did u try reindexing? being a flat table it should add the missing column as it happened for me

@engcom-November engcom-November self-assigned this Sep 14, 2022
@m2-assistant
Copy link

m2-assistant bot commented Sep 14, 2022

Hi @engcom-November. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-November
Copy link
Contributor

Verified the issue on Magento 2.4-develop all instances : Enterprise and B2B but observed different behavior while verifying the issue but no exception/errors observed in logs.
Scenario 1: 2.4-develop branch without B2B:
Customers - All Customers - Filtering with Company column (updated with billing / Shipping Addresses - Company name) working fine. Address company name displayed in the grid - No issue
Scenario 2: B2B instance:
After installing B2B modules - Company name got removed for all the existing customers from the All customers page.
Created a Company account from front end - and verified Admin - Customers - All Customers page - Company name is updated in Company column. however filtering with Company name is not working.
Filtering with Address - Company name is working
image
image

image

@engcom-November engcom-November added Component: Customer Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Reported on 2.4.x Indicates original Magento version for the Issue report. Area: B2B project: B2B Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Sep 15, 2022
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-6683 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Sep 15, 2022

✅ Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@github-jira-sync-bot github-jira-sync-bot added Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. and removed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. labels Aug 28, 2023
@engcom-Bravo
Copy link
Contributor

Hello,

Internal team has started to work on it

Thanks.

@github-jira-sync-bot github-jira-sync-bot added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. and removed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. labels Aug 6, 2024
@engcom-Hotel engcom-Hotel moved this to Ready for Development in High Priority Backlog Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: B2B Component: Customer Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: ready for confirmation Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: ready for grooming project: B2B Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S1 Affects critical data or functionality and forces users to employ a workaround.
Projects
Status: Ready for Development
Development

Successfully merging a pull request may close this issue.

7 participants