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
61 views

Order/Invoice Paid Event

I'm trying to find an event/observer which will fire once an order is paid in Magento (2.2.8). checkout_onepage_controller_success_action - seems limited to frontend orders (ie not called for admin ...
0
votes
0answers
41 views

Observer for event on Checkout button click of Minicart Magento 2

I want to create observer for event which is responsible to send data from minicart to checkout. Please suggest event name. I have already tried: checkout_cart_update_items_before and ...
1
vote
1answer
23 views

When I use “echo” in vendor methods - products not showing, but work fine without it

I got the next code: public function getProductCollection() { if (isset($this->_productCollections[$this->getCurrentCategory()->getId()])) { $collection = $this->...
0
votes
2answers
93 views

Magento 2 - How to call sales_order_save_after Observer manually for testing?

i have a working Observer on the event sales_order_save_after. The Observer looks like this: namespace Company\ExportOrder\Observer; use Magento\Framework\Event\ObserverInterface; class Observer ...
1
vote
1answer
20 views

How to get formatted custom price

I have set my product custom price in an observer.. $item->setOriginalCustomPrice(9.99); $item->setCustomPrice(9.99); I can output the price value correclty like so: echo $item->...
4
votes
1answer
55 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 ...
1
vote
1answer
46 views

Event after remove customer Magento2

How to create an event on customer remove from backend.? what is the name of the event? I need to remove customer's data from my custom table after removing a customer from the backend.
0
votes
1answer
29 views

Magento 2 | event before checkout#payment

is there an event which gets fired before you get to checkout#payment? Thanks!
0
votes
1answer
28 views

Update all quote items with qty 1 in magento2

I am trying to update all the quote item qty as soon as we navigated to the cart page. by using below code. $quote = $this->checkoutSession->getQuote(); $quoteItems = $quote->...
2
votes
2answers
158 views

Magento 2 | Is there an observable event for when the checkout begins?

when the checkout is started I need to modify the quote. Is there an event when the checkout is started? Thanks in Advance!
1
vote
2answers
47 views

Programatically deleting items from cart leaves 'ghost' items;

I am using the observer checkout_cart_save_after to programatically delete some cart items. public function execute(Observer $observer) { $cart = $observer->getCart(); $quote = $cart->...
0
votes
0answers
24 views

Magento 2 :- How to get newly added options id of product attribute & Deleted option id of attribute

I want to get lastly added product attribute options id and also need to deleted option id in the following event: catalog_entity_attribute_save_after Anyone can help me with this?
0
votes
1answer
25 views

When add second product, custom attributes not save data. Using event “ sales_quote_item_set_product ” in Magento 2

I used the sales_quote_item_set_product event to save data to the table when adding to cart product. It works but when I add the next product, it does not save the old data in the old field. My ...
1
vote
2answers
88 views

Magento 2 event observer custom config save given error

I have a custom section tab in configuration my section url is: http://dev.test/admin/admin/system_config/edit/section/vendor_module/key/????????? exception(s): Exception #0 (Magento\Framework\...
1
vote
1answer
80 views

Magento 2.2 - event to detect qty change

I need to detect a change of qty in product (backoffice change after edit is enough for me). I was trying to do it with simple observer <event name="cataloginventory_stock_item_save_after"> ...
0
votes
0answers
11 views

How to save offline custom payment drop-down data in sales order and Display in sales grid

I created one payment method swipe machines. That swipe machine have a master. We are saveing Machine Name,Tid,Mid, Percentage in master. In payment section of swipe machine we are just looping data ...
1
vote
1answer
30 views

How is $this->eventPrefix built?

Mangento has something that is called dynamic events. This are events dispatched as follows $this->eventManager->dispatch($this->eventPrefix . '_load_before') After what rules is the value ...
0
votes
1answer
68 views

Magento 2 checkout_cart_product_add_after not working

here am trying to add custom price during adding product to cart but checkout_cart_product_add_after event is not getting fired. my API to add to cart is http://localhost/magento/rest/V1/carts/636/...
1
vote
1answer
36 views

How I can add custom block to layout using php in Magento 2

I have created a custom block, as I want to add this layout to my current layout. Following is my block: <referenceContainer name="sidebar.main"> <block class="Vendor\ModuleName\...
0
votes
1answer
97 views

Magento 2: Event-Observer for whenever the stock status of product changes

Is there an event for whenever a product goes from In-Stock to Out of Stock and vice-versa. I basically need to programatically set the value of a custom product attribute depending on the stock ...
3
votes
1answer
120 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 ...
0
votes
0answers
29 views

how i can get parameter value in plugin into magento 2 observer

i have plugin for customer account create public function aroundExecute( \Magento\Customer\Controller\Account\Create $subject, \Closure $proceed ) { $getid = $subject-&...
0
votes
1answer
34 views

how i can get parameter value of url parameter in customer registration success observer magento 2

I have set link like this http://localhost/magento/customer/account/create/?param_id=20 how I can get that (param_id) value in customer registration success observer in Magento 2 how I can do ...
0
votes
2answers
76 views

Magento 2 origData null in customer_save_before

I have created an observer on the customer_save_before event. Surprisingly $observer->getEvent()->getCustomer()->getOrigData() is null. Is my expectation wrong? This is also happening for ...
0
votes
0answers
13 views

Magento 1.Logout customer after cart mergen when login

We have the following code which fires when the event sales_quote_merge_before is fired. So a customer adds 1 product to cart, then moves to cart and sees the 1 product. They then click a button [...
0
votes
2answers
57 views

add block in observer magento 1.9

I need to show labels(BACK ON STOCK) on product when they back to stock, for this I have added a observer <global> <events> <catalog_product_save_commit_after> ...
1
vote
1answer
426 views

Magento2: How can call observer function in controller file?

I have created a custom observer below: Observer file public function abc($order,$itemIds) { } Controller file public function aaa($order,$itemIds) { here we want to call abc($order,$itemIds);...
0
votes
0answers
37 views

How to add free product if subtotal is greater than $100 in magento 2.3?

I am very new to magento 2.3 learning. If subtotal of customer product purchase is equal or greater than $100, the free product should be added to their cart when checkout(Not show this product in ...
1
vote
3answers
50 views

how i can get order id and customer name in oberserver magento 2

I have used event <event name="checkout_onepage_controller_success_action"> when I use this code I am getting null $order $order = $observer->getEvent()->getOrder(); // im ...
0
votes
2answers
26 views

Can Magento really handle asynchronous execution of events?

The Swiftotter Magento developer Study guide states concerning Observers: Event data should be able to be stored and then run in a queue at a later time. Is this correct? Do I really have to ...
0
votes
2answers
35 views

Set the if condition to true in PHPUnit test case

I have an if condition inside an observer as follows public function execute(Observer $observer) { if ($observer->getData('status') == Status::REQUIRED) { //implementation ...
0
votes
0answers
52 views

Which Event File on sales_bestsellers_aggregated_daily Table

Which Event is Fire or which method use when sales_bestsellers_aggregated_daily, 'monthly', yearly when best sale product insert in these tables? I want to save the value in custom_attribut(...
0
votes
0answers
19 views

Get number of pages in Oberver Magento 2

I have an Observer and I must get the number of pages (I need to know if there is > 1 page) in it. I tried on both collection and pager but no success : public function __construct( \Magento\...
1
vote
0answers
17 views

checkout_cart_product_add_after fired only once for grouped product

I m observeing checkout_cart_product_add_after event to modify quote item. But it seems it fired only once no matter how many qty or item i have added from detail page. My goal is to change each ...
1
vote
0answers
26 views

How to debug checkout_cart_product_add_after event on exit

I am trying to exit point on observer for checkout_cart_product_add_after event. But it always refresh after item added to cart. Any way to print data when debug this event and not refresh the page. ...
0
votes
2answers
98 views

Custom price in cart not working in Magento 2.3.1 observer

I am developing a magento site for furniture sale. I have some grouped products. If a customer add 1 piece of any product of the group to cart, the special price will be added to cart. If the ...
0
votes
0answers
115 views

how to i set cart subtotal price through program in magento 2 observer

i created observer <event name="sales_quote_add_item"> <observer name="webkul_mpquote_sales_quote_add_item" instance="Webkul\Mpquotesystem\Observer\SalesQuoteAddItem" /> </...
2
votes
2answers
113 views

Get order object inside email_order_set_template_vars_before event observer

I have observer for email_order_set_template_vars_before where i am setting some email template variable to use in order confirmation email. Now i want to find which products customer has ordered in ...
1
vote
2answers
36 views

Cron Failure - Mage_Core_Exception

I get this from the error log all the time. Cron Failure catalog_product alert: ---EXCEPTION--- exception 'Mage_Core_Exception' with message 'Invalid callback: Model for productalert/observer:...
0
votes
0answers
24 views

Not able to set cookie in observer

I am trying to set a cookie on the observer "catalog_controller_category_init_after" but it does not create the cookie but when I do exit after set cookie it will create cookie after I remove exit ...
4
votes
2answers
141 views

Magento 2 : We need to save product two time After generating Custom Option programmatically?

I have work on Custom Module. In Our Module I had use <event name="catalog_product_save_after"> <observer name="add_custom_option" instance="Namespace\Modulename\Observer\...
0
votes
0answers
22 views

I need to add payment method for customer in customer_register_success event, Magento2

I need to add a default payment method for customers, is it possible to do it in time this event customer_register_success ? I added a drop-down list in the registration form and show active payment ...
4
votes
3answers
316 views

Using the same observer class multiple times

I have a piece of custom code that should be executed on different events but the code does not depend on anything the events send to the observer. It's basically a dumb code like: class MyObserver ...
0
votes
0answers
39 views

Send an email upon order status change

I'm trying to find a way to programtically send out an email, that doesn't depend on some front-end or admin behavior. Ideally, this email would be sent when the order status is changed to 'processing'...
1
vote
1answer
43 views

Difference between core_abstract_delete_after and core_abstract_delete_commit_after events in magento 2

Can anyone please explain to me what is the use of core_abstract_delete_after and core_abstract_delete_commit_after events in magento 2. For your information, it is declared in (Magento\Framework\...
1
vote
1answer
60 views

Magento 2 cookie not set when full cache enable

I have created one helper file that get, set and delete cookie. This helper file I called in observer to set cookie. The helper file called but cookie not set when full cache enabled. <?php ...
1
vote
1answer
57 views

Creating custom event observer for after sale

I'm attempting to create a custom observer that will trigger after a successful purchase has been made. I assume that sales_order_save_after is the correct event to use. What the Observer will do is ...
0
votes
1answer
97 views

Override SenderBuilder class to add Bcc when sending invoice

I didn't found an event when invoice email is sent, so i tried to override Magento\Sales\Model\Order\Email\SenderBuilder class, the override is working but getting the customer attribute invoice_email ...
0
votes
0answers
18 views

Magento2 - add sales order custom attribute in checkout with validation in shipping section

I want to add 3-4 custom sales order attribute in checkout page in shipping section with shipping validation, attributes like text,checkbox.
2
votes
4answers
169 views

Magento 2.3.0 How to get request parameters in event observer?

I would like to get a request parameter in the observer file. Below is the observer code. etc/frontend/di.xml <event name="review_save_before"> <observer name="set_customer_data" ...