Questions tagged [event-observer]

Event/observer is used to work dynamically with Magento without altering the core code.

Filter by
Sorted by
Tagged with
0
votes
1answer
31 views

Custom Captcha not working in Magento2

I want to show captcha in Product Review Form, Followed the below link. Magento 2: How Captcha Module works? Created the module with relevant files and I am able to see the captcha in review form. ...
2
votes
1answer
39 views

How can I update customer custom attribute on order save?

I have an observer for the event when an order is placed by a customer. I tried "sales_model_service_quote_submit_before" I would like to take a value from the Order and save it to the customer. For ...
0
votes
1answer
11 views

Magento 2.2.2 custom observer attribute name not valid atomic type

I have a custom observer for admin admin_system_config_changed_section_{{$section_name}} the following are: events.xml: <?xml version="1.0" encoding="UTF-8"?> <config xmlns:xsi="http://www....
0
votes
3answers
52 views

Unable to redirect to cart page from observer?

Here is the code, please review and let advise. Demo/Test/etc/frontend/events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
0
votes
2answers
39 views

Magento 2 observer is not triggering

We are going to use controller_action_layout_generate_blocks_before frontend event in M2. please note same event which is working on M1 but it is not working please review my below code and share ...
2
votes
0answers
23 views

Magento2 - update to custom status after shipment creation

I created an Observer that makes some execution based on the company needs using event sales_order_shipment_save_after. It does everything I need except changing the order status to a specific. I ...
0
votes
1answer
33 views

How to print field in order email?

I want print a custom file in order transactional emails. Here is my Setup file: namespace xxx\xxxx\Setup; $quote = $setup->getTable('quote'); $salesOrder = $setup->getTable('...
0
votes
0answers
11 views

How to get Giftcard Code programmatically in Magento 2 EE?

How to create Gift Card Account programmatically, as I need to get coupon code using API. I am looking if it is possible to trigger built in observer programmatically in Model class e.g <event ...
0
votes
2answers
26 views

Magento 2 Observer class print event data

I want to preview all the details inside the object such as Order, Customers after saving the event. I tired below way but it not printing the object inside attributes.... Customer Object Magento\...
0
votes
0answers
19 views

Magento2 - Listen for order new comments

I am trying to create some kind of observer that will listen for new order comments and execute the function every time a comment is added. I tried three ways that did not work for me: Observer ...
0
votes
0answers
9 views

Magento2.3 : Unit Case writing for Observers

I was wondering what is best practice for Unit test case writing for observers ? I looked for examples in core , and found below file magento/module-sales/Test/Unit/Observer/...
0
votes
2answers
28 views

Magento2 : checkout_cart_product_add_after Event not working with API

I have created an observer on event "checkout_cart_product_add_after" and its working fine for web but not working with REST API.
2
votes
1answer
30 views

Magento 2.3 - limit certain categories products

We have a few categories which function like "bestsellers" categories; these categories can hold any number of products, but I'd like to show only the top four. So I figured to create an observer ...
0
votes
0answers
20 views

How can I get the customer increment ID in an observer in Magento2 if using the human friendly ID

I am trying to get a magento customer increment ID. I'm thinking I have to use the resource-model class just not sure what the best way to access it is or how to get it. public function __construct( ...
0
votes
2answers
36 views

Magento 1.9 - What is wrong in my Event Observer?

I just want to display my event name : app\etc\modules\Gta_RestrictProductByCountry.xml <?xml version="1.0"?> <config> <modules> <Gta_RestrictProductByCountry&...
0
votes
2answers
33 views

Cannot redirect to a specific page using Observer events such as sales_order_place_before, and checkout_submit_before in Magento 2.3

I am currently implementing a behavior where I will check the quote items in cart, then check if it contains my custom attributes. If true, then it will redirect me to a specific page(CMS) page. This ...
1
vote
0answers
46 views

Help - Magento 1.9 - How to do Observer should be trigger before place an order?

After calculated grand total in checkout page observer not trigger, Observer : app\etc\modules\Gta_RestrictProductByCountry.xml <?xml version="1.0"?> <config> <modules> ...
1
vote
2answers
45 views

How to put log in observer Magento 2 [duplicate]

I am trying to put log in observer sales_order_save_after Whenever I put logger in the execute I can’t do any checkout it complains about guest checkout payment Is there any other way I could see ...
0
votes
0answers
17 views

Observer on item removed

I need to trigger this event but just before the item is removed : sales_quote_remove_item But for now, the event is trigger after I want to do this : when the user is tryinng to remove the ...
2
votes
1answer
20 views

Event not fired when Full Page Cache is enabled in Magento 2

I am trying to run a piece of code on every page load. I have the following <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/...
0
votes
1answer
16 views

Magento2 after comment added observer

I need an observer to be executed when I add a new comment to an order. On Magento 1.9 I used sales_order_save_after event but it does not exist on M2 anymore. Anyone can help me with an event to do ...
0
votes
0answers
16 views

How to use of “checkout_type_multishipping_create_orders_single” event in Magento 2 EE?

This event is used to 'Check if customer balance was used in quote and reduce balance if so', I want to execute custom functionality on customer balance which is used as store credit in that order. ...
0
votes
1answer
88 views

Magento 2: change product name in quote item via event observer

I am trying to change the product name in the quote item via the event observer. I followed this guide but it does not work. public function execute(\Magento\Framework\Event\Observer $observer) { ...
3
votes
3answers
146 views

Magneto 2 How to call Helper function in observer file

I am new to Magento development and I am using a custom MySQL query in some places like in observer/plugin etc. These codes are repeating for all these files. so I want to make a new reusable ...
0
votes
1answer
24 views

What is the event that will fire after assigning customer to group in Magento?

I have to fire an observer method when the admin assign customer(s) to group on adminhtml. Can you help me which event is it? I tried adminhtml_customer_save_after but it didn't worked. Edit: My ...
0
votes
2answers
37 views

Magento 2 - Get Cart Total in Observer

I needed to get the cart total in my observer. Here is the code I have: use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface; use Psr\Log\LoggerInterface; class ...
0
votes
1answer
42 views

Magento 2 customer_address_save_before event is triggering more than 1 time

I'm currently doing an integration with another system by sending data everytime customer_address_save_before frontend event happens. The problem is that this event is doing something weird, when I ...
0
votes
1answer
34 views

How to run CLI Command on the product Save/update in Admin Magento2

How I can run an indexer command after save or update the product in the admin through any observer or any plugin? I want to run bin/magento wyomind:elasticsearchcore:indexer:reindex product command ...
2
votes
1answer
46 views

Magento 2 how to check if customer changes his password?

I'm using an observer that triggers every time customer edit it's account. I'm using customer_address_save_before for some reason this event also triggers when I modify my email, name, or password ...
1
vote
1answer
28 views

Magento 2 how to lock a customer account when it's in an specific group?

I have been searching how to lock a customer account but had no luck. My idea is to create a customer group called Locked, and every customer that is assigned to that group will be locked. I was ...
1
vote
1answer
33 views

Error message not displaying in Observer Magento2

I used below event, <event name="catalog_controller_product_view"> <observer name="custom_product_view_layout" instance="Vendor\Module\Observer\CheckProduct" /> </event> Then ...
0
votes
2answers
29 views

Magento 2 : Event when customer in backend is created and updated

I want to know how to solve this problem: I need to trigger an observer when a customer is created and one different when customer is updated. I was using customer_save_before event which works ...
0
votes
1answer
34 views

Observer not triggered for customer_register_success event

I've read through countless posts with similar issues and have made sure I didn't have the same errors. I'm trying to use the customer_register_success event to trigger an observer that will fetch an ...
0
votes
0answers
13 views

Event for apply discount coupon Magento 2

I want to add custom validation for Discount coupon that it can be used only on first order of any customer. For this i want to create an observer for an event which will trigger when customer ...
0
votes
1answer
59 views

Magento 2 how to get customer data in Observer in customer_account_edited event?

I'm trying to get customer Id, first name, last name , email and Address info after customer_account_edited event is triggered, but I'm getting error 500 and the error is Uncaught Error: Call to a ...
1
vote
1answer
24 views

Magento 2: Get names of all people who ordered the product

Our client would like to have names of all people who ordered a product included into the Out of Stock notification email. I seem to have issue with getting such info ... Code I have to get the ...
2
votes
4answers
85 views

Magento 1.9 : What event used before order placed and get shipping information for the order [closed]

For my condition how to get the shipping methods before order placed My Observer : https://gist.github.com/ZusZus/66da0a7aaeb0db53eff38d8bb89ae941
0
votes
1answer
51 views

Magento 1.9: get data from text area in observer using event?

I need get data from text area in which customer write comment, than that comment I need add to order using sales_order_place_before event and save order to sales_flat_order. Customer comment must add ...
0
votes
2answers
54 views

Magento 1.9: Print variable value in Mage::Log

My observer : public function checkproductinorder($Observer) { $order = $Observer->getEvent()->getOrder(); $items = $order->getAllItems(); foreach ($items as $...
0
votes
0answers
16 views

magento 2 event for out of stock

I would like to know when a product goes out of stock by user purchase. I think there should be an event for this. I am not able to find it though. Also, in general, has Magento 2 published the ...
1
vote
2answers
57 views

Magento 1.9.X: Add customer comment to order using observer

How can I add customer comment from checkout page using observer? Customer comment is introduced from the block with a text area. When I create new order I need to add a comment to this order using ...
0
votes
1answer
50 views

Update Product prices after adding to cart

I am trying to update product prices after adding to cart but the change on prices don't apply on it. I have created an event on checkout_cart_product_add_after while on observer I have written code ...
0
votes
0answers
9 views

Magento 2: Get Raw POST data whenever /shipping-information API is hit

I am using a headless magento 2 for my store, and am having some data consistency problems with shipping addresses. To troubleshoot this, I was thinking about saving the POST body whenever these API ...
0
votes
1answer
31 views

Magento 1.9 : How can i filter specific state inside foreach with Observer

How can I add if the condition for my for each loop, my_observer : <?php class Gta_GetOrderDetails_Model_Observer { public function getdetailsafterorder($Observer) { ...
0
votes
0answers
42 views

Magento 2 : Stock Inventory Save After Observer - Issue

This observer triggered only when Quantity is out of stock or when we save the Quantity. Is there any other Observer event in Magento when the Quantity get Change while creating an order from the ...
0
votes
0answers
9 views

I need to change customer group when user logs in via specific link

I need to link already registered user to the customer group. I'm trying to solve it using event and observer. User will receive a link and logging in using the present link, the customer will be ...
0
votes
1answer
64 views

Magento2 : Product not saving set custom attribute using Observer

I want to set Discount on my product after Save product so I'm using catalog_product_save_after then I am creating an attribute 'discount' and set the calculated value, but when i save the collection ...
0
votes
1answer
34 views

what is the use of _merge_before and _merge_after event in Magento 2

I want to know the difference between following Magento 2 events 1)sales_quote_add_item 2)_merge_before 3) _merge_after and how I can use the event in event.xml sales_quote_add_item and ...
0
votes
1answer
82 views

Magento 1.9 - How to Override/Rewrite Third party Module?

I am using this extension for Extra Fees, I did some override/rewritein this file in magento (app/code/local/Voronoy/ExtraFee/Model/Quote/Address/Total/Fee/Rule.php). FYI -> The override/rewrite ...
0
votes
2answers
109 views

What event should I use for Customer delete observer in Magento 2.3?

I'm very new to Magento 2.3, so I can't find a list of all the events that are related to user accounts. I need to create observers for user deleted, user updated (any information in account) and user ...