The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [event-observer]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
19 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
17 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
0answers
18 views

Magento 2 : Event to change order collection [on hold]

here are two orders I did get via rest API how can I catch an event, observer to change the value in API.
0
votes
2answers
35 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
26 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
44 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
41 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
16 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
19 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
14 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
15 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
56 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
123 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
30 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
36 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
32 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
45 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
25 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
31 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
26 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
30 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
11 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
31 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 ...
0
votes
1answer
23 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
80 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
39 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
51 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 ...
0
votes
2answers
41 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
48 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
8 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
30 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
41 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
54 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
27 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
64 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
96 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 ...
0
votes
3answers
60 views

Magento 1.9 Obsever testing failed - Mage::log not generated

My observer : <?xml version="1.0"?> <config> <modules> <Gta_ExtraFeesRemove> <codePool>local</codePool> <active>true</...
0
votes
1answer
67 views

How to get the name of the triggered event? [closed]

How to self check what event i am using, my event : <checkout_cart_product_add_after> how to print, i tried : $event = $observer->getEvent()->getName(); Mage::log($event, null, '...
3
votes
2answers
146 views

How do I create an events observer that only calls when the REST API dispatches events?

I just want to call an event observer when the event is dispatched via the REST API. Like if an order is placed from a mobile application, only then the sales_order_save_afterObserver should be called....
0
votes
0answers
30 views

Magento 2 : Change product price while moving to cart event and observer

I have created a custom module but moving to cart I want to add a custom price which event i can use to change the price how to change product price while moving to cart event and ...
0
votes
0answers
30 views

How to Restrict product add-to-cart if cart has specified category of products?

If my cart consists category id = 4 products, no other products eligible to add-to-cart, how to restrict by using anything, i tried using observer it not work.Please any one help.
0
votes
1answer
32 views

How can i call editPost controller after an observer(checkout_onepage_controller_success_action) Magento 2

I have to save the account edit with customer default shipping address details. After the successful order placement. I have created the observer but not sure how to call editPost of the customer ...
0
votes
1answer
47 views

Magento 2 : Separate home page for logged in and guest user [closed]

I want to show different home page for logged in user, Which event/plugin I can use for this ? Whenever logged in customer clicks on homepage he should be redirected to different url Logged-in ...
0
votes
1answer
41 views

Observer throw Exception message without loading logic

Observer : public function cartevent(Varien_Event_Observer $observer) { // Load product $product = $observer->getProduct(); $prodID = $product->getId(); $...
0
votes
2answers
47 views

Magento 2 :- how to get email address in sales_quote_address_collect_totals_before events

How to get email address in sales_quote_address_collect_totals_before events guest user email address. <?php namespace xxxxxx\xxxx\Observer; use Magento\Framework\Event\ObserverInterface; ...
1
vote
1answer
66 views

Magento 2 How to notify user when it's customer group has changed?

I want to find a solution for sending an email to the customer when the administrator in backend changes its customer group. I have 3 customer groups, each one has different discounts in the store, so ...
0
votes
2answers
110 views

Observer Mage::throwException error - status 503 error

I just want to restrict some of the category of products to purchase with other category products, Workout : If customer click add to cart using observer compare current add-to-cart product ...