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

Issue-33519. Added logic for grouping alerts by store #35996

Closed
wants to merge 35 commits into from

Conversation

topanok
Copy link
Contributor

@topanok topanok commented Aug 22, 2022

Description (*)

Added logic for grouping alerts by store. The problem was that when sorting collection items, the store ID of the last item of current user is always add to the email object. This fix also fixed the situation with PriceAlerts, because the logic is used by everyone.

Fixed Issues (if relevant)

  1. Fixes Template file retrieving should be store scoped #33519

Manual testing scenarios (*)

  1. Setup Multiple Stores/websites in Magento
  2. Create 2 different Stock Alert Email Templates for each store (Marketing - Communications - Email Templates - Add New Template)
  3. Enable Product Alerts and Apply the newly created templates for each Store
  4. Stores - Configuration - Catalog - Catalog - Product Alerts - Stock Alert Email Template - Set the new template created for new Store view scope , "Allow Alert When Product Comes Back in Stock" - Yes
    Default Scope: Product Alerts Run Settings - Give the Start time and Save Configuration
    Change the Scope of Store View to another Store view and apply other newly created template and save the configuration
  5. Reindex and clear cache
  6. Admin - Add a new Product - Set the Product to Out Of Stock and Save
  7. Front-end - New Store website (for ex: France website) - Sign in as customer - Product Details page - Click on "Notify me when this product is in stock"
  8. Open the same Product in different Store (for ex: Germany website) - Sign in as same customer - Product Details page - Click on "Notify me when this product is in stock"
  9. Admin - Edit the same product and Set the stock status to "In Stock" and Save
  10. Run the Cron > php bin/magento cron:run
  11. Verify emails of both the Stores(You should receive two emails from both Stores with different email templates)

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)

@m2-assistant
Copy link

m2-assistant bot commented Aug 22, 2022

Hi @topanok. Thank you for your contribution
Here are some useful tips 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

❗ 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

ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.

For more details, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests 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 Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

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

@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 Aug 22, 2022
@m2-github-services m2-github-services added Partner: Perspective Studio partners-contribution Pull Request is created by Magento Partner labels Aug 22, 2022
@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

1 similar comment
@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

1 similar comment
@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

1 similar comment
@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@topanok
Copy link
Contributor Author

topanok commented Sep 21, 2022

@magento run Integration Tests, WebAPI Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@topanok
Copy link
Contributor Author

topanok commented Sep 21, 2022

@magento run Integration Tests, WebAPI Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@topanok
Copy link
Contributor Author

topanok commented Sep 22, 2022

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@topanok
Copy link
Contributor Author

topanok commented Sep 22, 2022

@magento run Integration Tests, Functional Tests B2B

@engcom-Delta
Copy link
Contributor

@topanok, We have tried to reproduce and test this issue but we are not getting any product stock alert email.

Steps to reproduce:

1.Setup Multiple Stores/websites in Magento
2.Create 2 different Stock Alert Email Templates for each store (Marketing - Communications - Email Templates - Add New Template)
3.Enable Product Alerts and Apply the newly created templates for each Store
4.Stores - Configuration - Catalog - Catalog - Product Alerts - Stock Alert Email Template - Set the new template created for new Store view scope , "Allow Alert When Product Comes Back in Stock" - Yes
Default Scope: Product Alerts Run Settings - Give the Start time and Save Configuration
5.Change the Scope of Store View to another Store view and apply other newly created template and save the configuration
6.Reindex and clear cache
7Admin - Add a new Product - Set the Product to Out Of Stock and Save
8.Front-end - New Store website (for ex: France website) - Sign in as customer - Product Details page - Click on "Notify me when this product is in stock"
9.Open the same Product in different Store (for ex: Germany website) - Sign in as same customer - Product Details page - Click on "Notify me when this product is in stock"
10.Admin - Edit the same product and Set the stock status to "In Stock" and Save
11.Run the Cron > php bin/magento cron:run
12.Verify emails of both the Stores

Screenshot 2024-02-28 at 6 49 58 PM Screenshot 2024-02-28 at 6 50 22 PM Screenshot 2024-02-28 at 6 51 03 PM Screenshot 2024-02-28 at 6 51 52 PM Screenshot 2024-02-28 at 6 52 55 PM Screenshot 2024-02-28 at 6 53 50 PM Screenshot 2024-02-28 at 6 54 50 PM Screenshot 2024-02-28 at 6 55 25 PM Screenshot 2024-02-28 at 6 55 32 PM Screenshot 2024-02-28 at 6 55 45 PM Screenshot 2024-02-28 at 6 55 57 PM Screenshot 2024-02-28 at 6 56 06 PM Screenshot 2024-02-28 at 6 57 19 PM Screenshot 2024-02-28 at 6 56 40 PM Screenshot 2024-02-28 at 7 08 44 PM

Kindly suggest if something is missing

@topanok
Copy link
Contributor Author

topanok commented Feb 29, 2024

@engcom-Delta Hello! Mail server configured? Can you get any email like password reset? And wait until midnight))
Снимок экрана 2024-02-29 в 20 32 32

@engcom-Delta
Copy link
Contributor

@engcom-Delta Hello! Mail server configured? Can you get any email like password reset? And wait until midnight)) Снимок экрана 2024-02-29 в 20 32 32

@topanok, Yes Mail server configured and i am getting password reset email but not the alert once till now

@topanok
Copy link
Contributor Author

topanok commented Mar 4, 2024

@engcom-Delta Perhaps this is related to the time of sending letters, which you have set to midnight, and the one-time start of the cron did not work. Start the cron in constant operation with the php bin/magento cron:install command and wait for the letter after midnight or change the sending time to the nearest one. I hope you cleared the config cache after saving?

@topanok
Copy link
Contributor Author

topanok commented Mar 4, 2024

@engcom-Delta I checked the functionality. Everything works if the cron is running. Namely... The time set in the admin is responsible for starting the cron, which adds operations to the queue. After that, the cron works, which performs the scheduled operations. It turns out that the command from the message above (php bin/magento cron:install) should fix the situation. But you won't get notifications until midnight.
If you do not receive anything, then subscribe to the product again, because something may have gone wrong due to the disabled cron. This is partly my fault for writing the wrong command to run kron. Sorry!)

@engcom-Delta
Copy link
Contributor

@engcom-Delta I checked the functionality. Everything works if the cron is running. Namely... The time set in the admin is responsible for starting the cron, which adds operations to the queue. After that, the cron works, which performs the scheduled operations. It turns out that the command from the message above (php bin/magento cron:install) should fix the situation. But you won't get notifications until midnight. If you do not receive anything, then subscribe to the product again, because something may have gone wrong due to the disabled cron. This is partly my fault for writing the wrong command to run kron. Sorry!)

@topanok, That's okay and my cron is working fine but we are not getting the alert mails and some more PRs are on hold due to that. May i know in which version of magento it is working for you and more details if any.

Thanks,

@engcom-Delta
Copy link
Contributor

@topanok Waiting for your reply on the PR to move ahead.

@topanok
Copy link
Contributor Author

topanok commented Mar 26, 2024

@topanok Waiting for your reply on the PR to move ahead.

Hello. Tested on the same branch as PR and Magento version dev-2.4-develop. Please show what you have in the product_alert_stock table in the marked columns.
Снимок экрана 2024-03-26 в 20 18 51

@topanok
Copy link
Contributor Author

topanok commented Mar 27, 2024

@topanok Waiting for your reply on the PR to move ahead.

Hello! I raised the magento instance yesterday to test everything again. Here are the results. As you can see, the letters have arrived and you can see it in the magento database. So I can assume that you have some problems with the environment. Maybe ask someone for help.

Снимок экрана 2024-03-27 в 10 30 53 Снимок экрана 2024-03-27 в 10 30 30

@engcom-Delta
Copy link
Contributor

Hi @topanok , Thanks for your reply. We are also using 2.4 develop. I have checked the table product_alert_stock. Adding the screenshot for the same.

Screenshot 2024-03-27 at 11 54 10 AM

@engcom-Delta
Copy link
Contributor

Issue related to product alert stock is #35602 is reopened and this is a blocker to test this PR.

So moving this PR to Waiting related PRs.

@topanok
Copy link
Contributor Author

topanok commented Mar 27, 2024

Hi @topanok , Thanks for your reply. We are also using 2.4 develop. I have checked the table product_alert_stock. Adding the screenshot for the same.

Screenshot 2024-03-27 at 11 54 10 AM

It looks like you don't have cron running or you don't have mail sent configured. As you can see from my previous post, everything was working fine for me. So maybe get someone else to test it. I don't know how to help you.

@engcom-Delta
Copy link
Contributor

Hi @topanok , Thanks for your reply. We are also using 2.4 develop. I have checked the table product_alert_stock. Adding the screenshot for the same.
Screenshot 2024-03-27 at 11 54 10 AM

It looks like you don't have cron running or you don't have mail sent configured. As you can see from my previous post, everything was working fine for me. So maybe get someone else to test it. I don't know how to help you.

Hi @topanok , As mentioned in the below comment we are not getting product alert email as of now when cron is running and email alert has set , so we have reopened the issue.We will wait till the issue is resolved to test this PR.

#35996 (comment)

@topanok
Copy link
Contributor Author

topanok commented Mar 29, 2024

Hi @topanok , Thanks for your reply. We are also using 2.4 develop. I have checked the table product_alert_stock. Adding the screenshot for the same.
Screenshot 2024-03-27 at 11 54 10 AM

It looks like you don't have cron running or you don't have mail sent configured. As you can see from my previous post, everything was working fine for me. So maybe get someone else to test it. I don't know how to help you.

Hi @topanok , As mentioned in the below comment we are not getting product alert email as of now when cron is running and email alert has set , so we have reopened the issue.We will wait till the issue is resolved to test this PR.

#35996 (comment)

You can wait, but I won't do anything. It's not my problem that you can't test. I'm already fed up with this pull request, which is already 1.5 years old.

@engcom-Hotel
Copy link
Contributor

Hello @topanok,

The issue that was preventing us from receiving alert emails has been resolved. We can now move forward with this PR. However, we kindly request that you resolve the conflicts.

Thanks

@engcom-Hotel
Copy link
Contributor

Hello @topanok,

This is a reminder to resolve the conflicts of this PR. Please do the needful so that we can proceed further with this.

Thanks

@engcom-Hotel
Copy link
Contributor

Hello @topanok,

A gentle reminder to resolve the conflicts on this PR.

Thanks

@engcom-Hotel
Copy link
Contributor

Hello @topanok,

We have noticed that this PR has not been updated for a while. Therefore, we are closing it for now.

Please let us know when you are ready to work on it again, and we will be happy to reopen the PR.

Thank you for your valuable contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Email Component: ProductAlert Partner: Perspective Studio partners-contribution Pull Request is created by Magento Partner Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Project: Community Picked PRs upvoted by the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Template file retrieving should be store scoped
9 participants