magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

fix Column 'customer_id' in where clause is ambiguous,

Open BeardTech opened this issue 2 years ago • 5 comments

Description (*)

Add main_table to select for customer online filter.

Fixed Issues (if relevant)

When we try to filter the online customer grid we have an issue :

Integrity constraint violation: 1052 Column 'customer_id' in where clause is ambiguous, query was: SELECT `main_table`.*, `customer`.`email`, `customer`.`firstname`, `customer`.`lastname`, IF(main_table.customer_id IS NOT NULL AND main_table.customer_id != 0, 'c', 'v') AS `visitor_type`, `company_customer`.`company_id`, `company`.`company_name` FROM `customer_visitor` AS `main_table` LEFT JOIN `customer_entity` AS `customer` ON customer.entity_id = main_table.customer_id LEFT JOIN `company_advanced_customer_entity` AS `company_customer` ON main_table.customer_id = company_customer.customer_id LEFT JOIN `company` ON company.entity_id = company_customer.company_id WHERE (main_table.last_visit_at >= '2023-07-28 09:34:09') AND (((`customer_id` > 0))) ORDER BY customer_id ASC LIMIT 20 in /app/vendor/magento/framework/DB/Statement/Pdo/Mysql.php:109

Manual testing scenarios (*)

  1. In admin Navigate to customers -> Now Online
  2. Try to filter "type" -> value "customer"
  3. Enjoy

Contribution checklist (*)

  • [ ] Pull request has a meaningful description of its purpose
  • [ ] All commits are accompanied by meaningful commit messages
  • [ ] All new or changed code is covered with unit/integration tests (if applicable)
  • [ ] README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • [ ] All automated tests passed successfully (all builds are green)

Resolved issues:

  1. [x] resolves magento/magento2#37822: fix Column 'customer_id' in where clause is ambiguous,

BeardTech avatar Jul 28 '23 10:07 BeardTech

Hi @BeardTech. Thank you for your contribution! Here are some useful tips on how you can test your changes using Magento test environment.

Add the comment under your pull request to deploy test or vanilla Magento instance:
  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

:exclamation: Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s) For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here :information_source: Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation. Join Magento Community Engineering Slack and ask your questions in #github channel.

m2-assistant[bot] avatar Jul 28 '23 10:07 m2-assistant[bot]

@magento create issue

engcom-Hotel avatar Aug 01 '23 11:08 engcom-Hotel

@magento run all tests

engcom-Hotel avatar Aug 01 '23 11:08 engcom-Hotel

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@magento run all tests

engcom-Hotel avatar Oct 16 '24 06:10 engcom-Hotel

Hello @BeardTech,

We have noticed that this PR has not been updated for a period of long time. Hence we are closing this PR for now.

Let us know when you are ready to work on it again, and we will be happy to re-open it. Thank you for your contribution!

Thanks

engcom-Hotel avatar Nov 12 '24 14:11 engcom-Hotel