๐Ÿ‡๐Ÿ‡๐Ÿ‡ How to decide the right Magento 2 architecture to use


I'll be sending out a few emails this week to teach some concepts about RabbitMQ & Magento. If you'd rather not receive them, simply remove yourself from these emails.

What do you do when a plugin doesn't work?

Think you can always use a Magento plugin to modify a public function?

Think again.

Even though functions with a public visibility can be easily plugged into, there are situations where they just wonโ€™t do what you want them to do.

In the Magento Message Queues with RabbitMQ course, weโ€™re building a custom module that runs a sentiment analysis on product reviews to help determine if the review has a positive, negative, or neutral sentiment.

To do this, we need to run some code whenever a product review is saved. Youโ€™d usually lean on using something like an after() plugin to do this, but since we are passing the review text to a third-party API and sending it to a message queue to be ran at a later time, we need access to the review ID... but don't have it because the original method returns a response redirect object ๐Ÿคฌ

But this just means that we need to go deeper. Magento is deeply extensible and has tons of built-in functionality, and there is usually a solution in place to handle what you need to do.

If you dig a big deeper, youโ€™ll find a save_commit_after event that is emitted any time a database transaction occurs. This means that we can hook into the core โ€œreviewโ€ table by listening for the review_save_commit_after event. And this also means we have access to any data within that database row, including the review ID.

I cover this and 30 other more lessons in the full M2 + RabbitMQ course! Iโ€™ve been publishing new lessons all this week, and the course will be complete by the end of the month.

If you want early access, consider enrolling in the University. Youโ€™ll get access to over 500 video lessons that will help you understand not only how Magento 2 works, but how to be efficient and get things done the right way. You'll also get access to a thriving private Magento community to help get answers to all your other Magento questions.

โ€‹
There will probably only be one more email sent out before the course is officially available, so be on the lookout for that!

Join Segment, the Magento newsletter

Join Segment, M.academy's free monthly newsletter about Magento, read my thousands of developers & merchants to keep in touch with the industry. Check out previous issues of Segment by clicking the Posts tab below ๐Ÿ‘‡

Read more from Join Segment, the Magento newsletter
M.academy Website Home Page

Aug 2024 Read by 9,000+ Magento developers.Send to a friend. Complete M.academy refresh Hey friend, It's been a few years since M.academy launched, and I thought it was time that our image got a bit of a refresh. So over the summer, I worked on a few things: A refreshed website and updated tagline: Lots of energy, bright colors, and a new focus on "mastering" Magento development rather than simply learning the fundamentals -- since there are already courses for all of those ๐Ÿ˜‰ An updated look...

This hasn't been a quiet week by any means, even in Magento land. Before we get to the guts of this issue, which is all about how to debug and troubleshoot product collection issues, I need to let you know about urgent security exploit that needs to be addressed. But first, a word from our sponsor. If you are interested in order fulfillment, check out Portless: Sponsored by Portless Skip the ship, unlock cashflow and scale globally in less time Discover the future of e-commerce logistics with...

I hope everyone is having a great summer and able to take some time off! After a few meh summers, we've been enjoying some 90+ degree days in Cleveland, Ohio, and it's wonderful. I always see summer as a bit of a break from the normal coding routine, a chance to get outside of our heads and clear my mind -- a bit like starting a new year. Anyone relate? This Segment is about a new feature available in PHP 8.3. But first, a word from our sponsor: Sponsored by Portless Skip the ship, unlock...