Questions tagged [event-observer]

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

456 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
10
votes
1answer
270 views

Is there an event or plugin spot for when cart rule is no longer valid?

Is there an event or place I can plugin for when a shopping cart price rule is no longer valid (such as when it expires or if you change the quantity of other products where it no longer applies)? I ...
8
votes
0answers
297 views

Magento 2: Observer add product to cart?

I've read some other post about adding products to cart, but nothing seems to fit. I've an observer for checkout_cart_update_items_before that adds another product in same qty if specific product is ...
5
votes
2answers
139 views

Magento 2.1 - On reindex start event

I am looking for an observer event that is triggered when any re-index starts. I want to create an observer that sends out an email whenever an index has been initiated for re-indexing.
5
votes
0answers
339 views

Magento2 : How to set custom meta title & meta description by observer?

I want to set meta title , description by the help of observer. But unable to set data here. please see my code: $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $_page_config = $...
5
votes
0answers
450 views

_origData is null for some models in Magento 2 before or after save

Let's get a customer save process from the admin panel as an example. We have an event observer for model_save_before and trying to get a set of values for the model that have been changed upon the ...
5
votes
2answers
4k views

Remove and recreate custom option programatically on product before save event

I m creating custom option programatically using observer with catalog_product_save_before event.Custom option created successfully on product save.but the problem is whenever product save second time ...
4
votes
1answer
911 views

Render Javascript on customer_login event

I'm trying to render some javascript when the customer_login event fires by accessing a block on the layout from within the observer. I've successfully registered my observer to execute with the ...
4
votes
1answer
1k views

Adding custom column into product grid

I have created a custom column for associated products (basically every simple product will have that column under "associated products" tab of configurable product). I store information of this field/...
4
votes
3answers
217 views

Disallow adding products if sku or shipping type exists in cart

As the title says. I need to be able to disable adding to cart if a product sku or shipping type already exists in the cart. Any way this can be done? Created checkout_stop.xml in app/etc/modules ...
4
votes
1answer
1k views

Tracking Ajax Add to Cart Event

I have a problem I've been struggling for a couple of days and I would really like you to point me in the right direction. I am developing a module to track basic stuff like addToCart and ViewContent ...
3
votes
0answers
23 views

Magento 2 - Order status update observer

I am looking for order status update observer In many post I have found this one: sales_order_save_after But, it is not working, I have checked it myself. It is not even listed in these articles: ...
3
votes
0answers
25 views

Save value of custom field in minicart to order Magento 2

I have added one field "Special instructions" (textarea) in mini cart which I want to get saved in order details when customer put the order. In which observer can I get the value of this field? and ...
3
votes
1answer
86 views

Any Observer or plugin event for specific module disable?

I want to perform some action when my custom module gets disable. Is there any observer event or plugin event that being fired when i disable my module? Any help would be appreciated. Thank you,
3
votes
1answer
54 views

Sign up (guest checkout) issue in Magento 2

I have added customer_register_succes event for guest customer account creation during guest checkout. After the successful order when the user sign up by my event and observers call in which I load ...
3
votes
1answer
46 views

How to assign cart data in order Magento 2?

I am successfully save custom data in cart using checkout_cart_product_add_after event in "quote_item_option" table Now i want to save this data in order and display in order section in admin panel.
3
votes
0answers
23 views

Background or concurrent taks in Controllers

I am currently programming an extension for Magento 2. I am developing an observer that is triggered when you make an action inside a controller in the admin section. What I do is to fetch all ...
3
votes
1answer
339 views

Rogue “enterprise_refresh_index” causing excessive Merchandising failures

Thanks in advance for reading, and for any help you can hopefully offer. My company uses Magento for our marketplace, and while we've always had occasional issues with AOE Scheduler unable to kick ...
3
votes
0answers
212 views

Magento2 Product add form custom form values not posting in observer

I am Creating custom product add form in magento2.2.2. I have added a new tab after product details & Loaded My custom phtml File into It, First To Post Data from product form to observer, i ...
3
votes
1answer
2k views

Newsletter subscription at the checkout review

Expected functionality: user checks the "Subscribe" checkbox in the OnePage Checkout's review step and is subscribed to the newsletter. So far I have managed to target the right event (after ...
3
votes
0answers
194 views

Prevent place order using observer in magento 2

Hi I'm trying to prevent placing order with the help of observer i have already trigger the event "sales_order_place_before" with this i got all the details of the order like products in cart ,...
3
votes
0answers
790 views

Magento 2: Same Event with Multiple Observer in Different Module causes redirection issue

Magento 2: Same Event with Multiple Observer in Different Module causes redirection issue To solve: Magento 2: Can we call one observer in another observer? I have followed below code magento\app\...
3
votes
1answer
844 views

Programatically set product attribute defaults - Magento 2

My specific use case is that I want to set the news_from_date and news_to_date for the a thirty day period from when the product is created. I would like this to work so when a user goes into the ...
3
votes
1answer
234 views

Mage_Log visitor observer not triggered

my problem is that viewed products are not working for guest users. After some hours of research I found out that the VisitorId is not generated. Then I found out that Mage_Log is responsible for this....
3
votes
2answers
2k views

Magento event after filling checkout shipping address

Which magento event gets triggered after filling shipping address on checkout one page as I need to pass some information to a third party api just after shipping address.
3
votes
0answers
1k views

Create Event observer which fire when customer create while create order in magento admin

I have create a SMS module which send sms to customer when a new customer create. My config.xml is below : ... <!-- Event for customer register success from frontend --> <global> <...
3
votes
3answers
2k views

checkout_submit_all_after event is not working

In magento i have to get order items in observer I am trying two method sales_order_place_after and checkout_submit_all_after Both event is not working my events.xml <config xmlns:xsi="http://...
2
votes
1answer
58 views

Change quote currency before place order

I want to change my quote currency code to EUR when an order is placed in any other currency. I tried writing event and observer of event sales_order_place_before. In my observer I have this code ...
2
votes
0answers
13 views

Using Split Orders Extension but order confirmation mail is shooting for first order only instead of all

I'm using "order split" extension based on seller,means if there are 6 items in the cart having 3 different seller(have 2 item for each seller) then three orders(let's says order id as 500,501,502) ...
2
votes
1answer
154 views

Magento2 send Order information to Google Analytics when order from admin

Though Magento 2 has the inbuilt implementation to send the transaction/order details placed on webstore or frontend to Google Analytics, it lacks the same ability when orders are being placed from ...
2
votes
0answers
17 views

Set product attribute “comment” from backend

No time for coding actually, so I just want to ask if maybe someone already has a working solution (w/o rewrites) :) I just want to add a text input field to "edit product attribute" page, that show "...
2
votes
0answers
25 views

Apply product offer when subtotal grater or equal 1000 only for specific date

I want to add new product offer when cart subtotal >= 1000 This offer valid only for every month between day 1 to 7 (1-m-yyyy to 7-m-yyyy). Therefore i used below event - <event name="...
2
votes
0answers
21 views

Magento 2 : Which event will trigger when a Navbar Item is clicked?

I've done some searching around and i'm trying to find the observed event for when a particular navbar item is clicked. The goal is to run some code for whenever that navbar item is selected but I do ...
2
votes
2answers
82 views

How to get a form value in order process?

I have created a new small module to add a checkbox on last step of order process: The value will transfer over payment JSON: In the generated PaymentExtensionInterface I have the getter and setter ...
2
votes
1answer
192 views

Magento 2.2.5: how to query in observer best practice

I'm looking for best practice on how to query to database in observer. Ok so this is the idea, i use observer to catch event catalog_product_save_after (which will be fired after product is saved in ...
2
votes
0answers
73 views

Cart observer unit testing

I created a module that has some logic to modify the price of certain items depending on a few conditions pertaining to the other items in the cart. I'm trying to write a unit test to test that the ...
2
votes
0answers
172 views

What is the event observer for system config page load in Magento 2

We know that we can use custom_admin_system_config_changed_section_general for system config page save event. But is there any observer to the config page load event? Thanks.
2
votes
1answer
99 views

event sales_order_invoice_save_commit_after is not being dispatch over REST API

May I know how can I dispatch event sales_order_invoice_save_commit_after when I create invoice via REST api? I noticed there are quite a number of extensions is observing this particular event but ...
2
votes
0answers
553 views

Magento-2 : How to set product custom price after add to cart

I have used checkout_cart_product_add_after event, for change product price. Used observer code like below $item->setCustomPrice($price); $item->setOriginalCustomPrice($price); $item->...
2
votes
0answers
324 views

How can I change grand total when user Clicks on Custom Payment method?

I am using the one-page checkout module. I want to change the grand total when user/customer selects the payment method. If customer/user selects the online payment option then grand total should ...
2
votes
0answers
308 views

Issue in 'catalog_block_product_list_collection' observer event

I need to filter my front end product collection to list product according to a custom attribute value. But the product listing page is not filtering according to my condition. The code used are: ...
2
votes
1answer
34 views

Magento dropshipper e-mails

I am making an extension that filters each order and send out an e-mail to each drop shipper in order. Example Order with 3 products. 2 products from drop shippers A and 1 product from drop shipper ...
2
votes
0answers
391 views

magento2 prepend item into menu tree object (Topmenu)

So I've already hooked the "page_block_html_topmenu_gethtml_before" event with the observer class, I can add items to the menu tree, and it works fine, but I can't prepend items to the menu tree ...
2
votes
0answers
26 views

Redirecting admin user before creating an order in adminpanel issue M1

I have a custom condition for customers . If that condition is satisfied I would like make a redirect with a message that 'the order cannot be created'. I used the sales_order_place_before event to ...
2
votes
0answers
329 views

Magento 2 Enterprise edition, get all custom attributes of product in the observer

My store has many GroupProduct and each one has many virtual products. This virtual products have custom attributes and some are required and some aren't. [MyModule]/Setup/InstallData.php $eavSetup-&...
2
votes
1answer
2k views

How to get quote item id in checkout_cart_product_add_after observer in magento2

I have setting the custom price of the product on adding to cart which I am doing through some observer . Everything is working fine except I am not getting the item id in the observer.I tried ...
2
votes
1answer
291 views

Need help on event and observer in magento 1.9.x.x checkout_onepage_controller_success_action

I need to listen to the events in the checkout onepage with an observer. The goal is to count the number of times that a command is passed by a user and at the end of the tenth command, I offer him/...
2
votes
0answers
460 views

Detect Inventory change on Magento2 triggered by API

I'm working on a module for keeping track of inventory changes on orders, admin variation, api calls. I'm using the event cataloginventory_stock_item_save_after which works fine on 2.2 but it seems ...
2
votes
1answer
87 views

Events not dispatched in frontend / unable to observe a frontend event

I'm trying to observe the catalog_product_collection_load_before event so that I can filter out products with a certain attribute on the frontend (whether a product is discontinued). I am able to ...
2
votes
0answers
120 views

Add customer email to order via observer make export csv error

Here is my observer to add the code to show email in order grid public function coreBlockAbstractToHtmlBefore(Varien_Event_Observer $observer) { /** @var $block Mage_Core_Block_Abstract */ $...
2
votes
0answers
294 views

Change redirect url based on store id

I create an observer for controller_action_predispatch in frontend to redirect site to particular store url like this: public function execute( \Magento\Framework\Event\Observer $observer ...