Questions tagged [event-observer]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
95 views

How to get the shipping address from using sales_order_payment_save_after event

I need to save the shipping address while order is placed in my custom table how to i take the shipping address . I am using the event sales_order_payment_save_after and did the following codes $...
1
vote
2answers
1k views

Magento 2 How to add custom attribute to customer address and how to insert value in that attribute?

I want to add a new custom attribute to "customer_address" that I did with an attribute installer script, now I am able to see that field in "eav_attribute" table. I have created a module and I have ...
0
votes
1answer
44 views

Magento 2 How to get custom field name 'location_id' aded to “customer_address_entity” at frontend, on order place after observer?

I have create one module which add 'location_id' in 'customer_address_entity' table. I also create one observer which called when order placed. Here i got the address id from order, Now i want to ...
0
votes
1answer
113 views

Magento 2.3 - event when catalog price rules are applied

I am working in a module which extends catalogrule feature In this module, we apply some changes to price calculation process. Right now, it is working when a product is saved in admin. We have ...
1
vote
1answer
35 views

How can I capture save/update/delete events of custom extension?

I have one custom extension installed, and I want to capture its save/update/delete action events and I am not sure how can I capture those events. Please help. I have successfully able to capture ...
0
votes
0answers
28 views

How Can I Output Message From Template Method?

Let me prefix this by saying I am brand new to Magento. I am a Laravel developer helping a co-worker out. I am on Magento 1.14.1. I'm trying to output something on a page and I'm not sure where it's ...
0
votes
2answers
288 views

How to get Cart Id and Subtotal in sales_order_save_after observer?

I have to call some API on order status complete. For that I need values for the following. credit card number (16 digits). CVV subtotal and I have already called an API while place order I need to ...
0
votes
1answer
67 views

Magento 2 - what event should I observe to change/intercept the calculation of subtotals on Cart

I am using Magento 2. I made an observer that observes anytime a new item is added to the cart. The observer works properly, I also managed to create a single product discount with this observer, ...
2
votes
1answer
596 views

How to alert in sales_order_save_after observer?

I am triggering sales_order_save_after event after order status has been completed. public function execute(Observer $observer) { $order = $observer->getEvent()->getOrder(); $...
0
votes
0answers
136 views

what is the same event “checkout_controller_onepage_save_shipping_method” of magento 1 in magento 2? [duplicate]

I created a events.xml for my custom module, the following code <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:...
0
votes
1answer
98 views

How to generate Order invoice by capturing “sales_order_save_after” event | Magento 2

This is events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <...
0
votes
2answers
278 views

How to print order details for event observer sales_order_save_after

want to print order details and product details (variants) which are ordered. My xml file <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
0
votes
1answer
105 views

How to know “sales_order_place_after” event is captured in Magento 2?

I have done this so for: app\code\Vendor\Extension\etc\events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:...
0
votes
1answer
81 views

Magento 2: Unable to get item_id while event “sales_order_save_after” is trigger

I need the product item id while sales_order_save_after event call. I try the following code. I am not able to get the item_id $order = $observer->getEvent()->getOrder(); foreach($order->...
0
votes
1answer
306 views

Magento 2 : set custom price in product when add to cart

I see some answers about set custom price in product when add to cart. But, I can't still solve my issue. I used observer for that to set custom price. But, it's not working. Can anyone please help ...
1
vote
1answer
156 views

Magento 2: How to stop event/observer if another already ran

I have 2 events running if subscribe to newsletter is checked on the checkout page. sales_model_service_quote_submit_success newsletter_subscriber_save_after Can i prevent event #2 from happening if ...
0
votes
0answers
49 views

Get order id and product id while order placed using Observer | Magento 2

Hi i need to get the order id and product id while order is generated in magento2 <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
1
vote
0answers
45 views

Add additional shipping fee using observer when customer after chose the shipping method

I'm tyring to add a additional cost to a shipping price after customer picked a shipping option (custom made shipping method), the event is base on checkout_controller_onepage_save_shipping_method, ...
0
votes
1answer
738 views

Customer save after event magento2

I have used this event "customer_save_after_data_object" used this code in events.xml file <event name="customer_save_after_data_object"> <observer name="customer_save_after_observer" ...
0
votes
0answers
47 views

Magento 2 Custom JS Component detect/Observe changes from any form input in the DOM

I have ny Component as so: define(['uiComponent', 'jquery', 'ko', 'jquery/ui', 'mage/translate', 'Magento_Ui/js/modal/modal', '...
0
votes
0answers
93 views

Custom field value is not getting in observer in Magento 2

I have created a custom field in advance inventory in magento 2 product edit but its value is not getting in observer my code is like <fieldset name="stock_data"> <container ...
1
vote
1answer
207 views

How to enable a shipping method for a specific SKU?

I'd like to create a module to enable the Table Rate Shipping Method if a product with a specific SKU is the customer cart. How could I do that?
0
votes
1answer
180 views

Not able to get post data from observer : M2

i want to get form data from checkout page in 2nd step, so i have use event observer. I have use this controller_action_predispatch_checkout event. I want to get post data so i have try this link ...
4
votes
1answer
606 views

Observer for invoice creation after it is saved

I have tried the following events for invoice creation observer: sales_order_invoice_save_after sales_order_invoice_pay sales_order_invoice_register ...
3
votes
3answers
2k views

How to get order event after placing order using observer in admin side?

i want to get the order event and want to use the order object data , tried this but something is missing, here is what i tried and how can i use this data in my helper/block class or controller ...
0
votes
0answers
17 views

How to manage order status/state in observer?

I have a custom shipping method. I am doing some tasks in one event-observer when the order is placed. I need to change the order status (maybe also the order state) if my tasks have failed. It is, ...
0
votes
0answers
42 views

before place order checkout stock by remote api

We are using Magento2.2.6 and we need to update stock when remote ERP also call remote ERP API when placing an order, Currently we are using Magento2's observer pattern and update stock when user ...
0
votes
2answers
101 views

Magento 2: Can't get item ids on sales_order_save_after event

I need something to do using order item ids when order is created. I tried sales_order_place_after and sales_order_save_after events, but unfortunately. Items from $observer->getEvent()->...
1
vote
1answer
293 views

Product edit form issue in admin panel magento2

Here is my etc/adminhtml/events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events....
1
vote
1answer
112 views

How can I get full cart contents from Customer Login observer (Magento 2)

I have created an observer for customer_login event which requests the current cart contents. I have tried to use (as indicated in other posts in this forum): public function __construct( ... ...
1
vote
2answers
376 views

Save custom field value from the quote table to sales order table

I am facing a problem to save custom field value from the quote table to sales order table. I have the custom field in quote table and sales order table, but the value is not saving in the sales order ...
2
votes
2answers
565 views

Add event after user add the product to cart to update quantity

I am beginner in magento 2 and I am trying to create an event and observer that will update the qty of item to 2 from default which is 1 when user add the item to cart. For this I successfully created ...
0
votes
2answers
148 views

How to create plugin for observer Magento 2?

I have one Observer in my custom module. I want to create Plugin for that observer. How can I achieve that ?
0
votes
1answer
43 views

Magento 1.9 - Observer Event redirection issue after placing order

This is my xml : <global> <events> <sales_order_place_after> <observers> <test_magewidget_model_observer> <...
0
votes
1answer
148 views

Magento 2 find observe that fill the table sales_order_item

I want to add data in the table sales_order_item, but for that i need to know what Observer fill this table. If someone know ?
1
vote
1answer
607 views

Magento2: I want to set custom quote price programmatically

I want to set custom quote price programmatically. Without the observer method. The observer method is working fine but it is worked on add to cart button. Please check my observer file below <?...
0
votes
1answer
41 views

Magento 2: Add additional attribute in mincart and checkoutcart after addToCart

I try to add aaditional attribute using below way, but i got error like this Invalid method Magento\Quote\Model\Quote::addOption events.xml <?xml version="1.0"?> <config xmlns:xsi="http:/...
4
votes
3answers
267 views

How can we get stock data in product listing via afterGetList plugin in Magento 2.2.3

Since magento 2.2.3 is displaying out of stock items in product listing, I would like to get the qty attribute in the listing using rest API. I'm using afterGetList plugin. di.xml <type name="...
2
votes
1answer
32 views

Show only products on a new category page which have a certain product attribute enabled

I want to create a new category page which shows all products which have a certain product attribute (speed_delivery) set to yes. I was thinking about to create an empty category, catch its product ...
0
votes
1answer
175 views

How can Save API respond (For each order request - PDF file) with order id in database?

I create event with observer and execute it . In execute function I get API respond (PDF file) for each order request . How can save this pdf link with order id in table I create it (Install schema) ?
1
vote
1answer
105 views

How to get simple product qty via configurable using Observer?

I’m using the observer event called checkout_cart_product_add_after, but when I use this method below to get the quantity in stock I just can get the configurable product stock quantity, my simple ...
2
votes
2answers
162 views

Magento 1.9 Get customer data an products in Observer on invoice save on php 7.1

I want to get on event sales_order_invoice_save_after customer data / products to put on external billing sistem: public function factura(Varien_Event_Observer $observer){ $order = $observer-...
0
votes
1answer
208 views

Magento 2.2.5 checkout page custom field value not getting in Observer

Triggered "checkout_onepage_controller_success_action" event but custom checkout field value not getting in observer. How can I save checkout page custom field data with other checkout details to a ...
1
vote
2answers
31 views

M2.2: On the admin side, when an admin modifies the price, how to get warning message what if he set price below $100

When an admin is about to modify the price and save the modification, he should get warning message which he should set a price over $100 and it must not be saved what if he set the price below $100. ...
0
votes
1answer
248 views

magento 2 exit without placing order sales_order_place_before event observer

In sales_order_place_before event i am loading all order collection which used po_number as the payment method . From the collection I am getting customer id after loading order data using parent id ...
0
votes
1answer
185 views

How to get Order information from event checkout_onepage_controller_success_action?

I am trying to get order information to do some tasks, after the order is placed. I tried with the events "checkout_submit_all_after" and also with "sales_order_place_after" but the only event I am ...
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 ...
0
votes
1answer
322 views

Magento 2 - Admin module - how to SELECT data from database to display in Admin page

I'm building out an Admin module that's intended to SELECT data from a specific table in magento database and display that data on page, it's a custom table called "commission_sales". At this point I ...
0
votes
1answer
29 views

Events when the order is placed is not firing

I am trying to observe an event when the order is placed but is not working for me. I tried with "sales_order_place_after" and "checkout_submit_all_after" events but nothing happens. The "test.log" ...
1
vote
2answers
75 views

How to know if the observer function have executed after an event?

I am trying to observe an event. How can I debug or know if the observer function has been called? I am using the event "checkout_cart_add_product_complete" and trying to do something simple when a ...