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

what is the event name for customer sign in form?

Is the event name "customer_login" for the sign-in form? Is the event name different for sign-in form in "proceed to checkout" and a normal sign-in form? I am bit confused about the event name...
1
vote
2answers
17 views

Change price at “checkout_cart_update_items_after”

I have some rules that change the price of product 'Z' if the quantity of products 'X' is 'Y' In the cart, how can I check the quantity of a product in the cart and change the price of that product ...
0
votes
1answer
27 views

This observer is not running at all

This is Observer. <?php namespace SimpleMagento\Custom\Observer; //use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface; class Another implements ...
0
votes
0answers
22 views

Magento 1.9 - how to send custom email if order status pending more than 2 days?

I have event observer for getting order status, How can i send custom email if order status pending more than 2 days. eg: Company Logo:: Dear {{customer name}}, Your order pending more than 2 ...
2
votes
1answer
45 views

How to redirect to custom page after Customer Successfully register..!

I need to redirect to next controller after registering page.
1
vote
0answers
40 views

Need to redirect to given controller

I need to redirect to ('hello/Test/Customer') page but observer is not working. <?php namespace SimpleMagento\Custom\Observer; use Magento\Framework\Event\Observer; use Magento\Framework\Event\...
1
vote
0answers
18 views

Fire JS script in observer

How can i fire this JS with an observer every time a user is adding, updating or deleting a product from the cart ? <script type="text/javascript"> _paq.push(['addEcommerceItem', "{{...
1
vote
1answer
27 views

Magento:2.2.8 Save response in db under custom_column created in sales_order and quote tables

I am using Custom Shipping API where I am getting response from API. Here I want to save this response to my order and quote table, I used event checkout_onepage_controller_success_action Here's code ...
1
vote
0answers
8 views

Magento 2: Set Product final price using catalog_product_get_final_price Event

Using eventcatalog_product_get_final_price, setting the maximum price to be 100, if the price of a product is greater than 100 then it will set automatically to 100 and the product price is below 100 ...
0
votes
0answers
18 views

Magento 2 set custom variable to use in email template on all emails

I want to be able to add a custom variable through an event observer of some sort which enables me to output this variable in any given email template. I know I can make an event observer for example ...
0
votes
1answer
20 views

Saving order PDF when order is placed?

Magento 1.9.3.2 I am trying to save the order PDF right after an order is placed / saved. The event I am using is sales_order_place_after. This is working fine, except for the payment information. ...
0
votes
1answer
35 views

Update item custom quantity and salable quantity value after place order in Magento 2

I need to decrease purchased item saleable quantity with custom value (x* ordered_qty) after place order in Magento 2.Right now I'm using the following observer and class to update the quantity of ...
1
vote
2answers
41 views

Success Event for Order place on Admin side

I want to know which event is used for firing when an order successfully placed by the admin. Right know i am using an event sales_order_save_commit_after. The problem her i am facing is that while i ...
2
votes
2answers
36 views

Where is the event sales_order_save_before dispatched?

I am tring to figure out when sales_order_save_before is dispatched but I do not see it in the source. What class is responsible for dispatching this event?
1
vote
0answers
18 views

Magento 2 How to store quote custom data into sales_invoice

I have created certain custom columns in quote, order, invoice and shipment tables and all the table columns are labeled with the same. Now i am able to store the data in quote and quote->order table ...
0
votes
1answer
20 views

Magento 1.7 : How to use sales_order_payment_capture event?

In Magento 1.7, I want to do like after credit memo create product quantity should be deduct. How to do that? Any help would be appreciated. Thanks.
0
votes
0answers
17 views

Get Order Comment Event Magento 2

I want to get a comment which submits when order view. I use this event sales_order_status_history_save_after and it fire when submitting a comment but I am struggling to get a comment which user adds....
1
vote
0answers
56 views

Redirect to login with add cart button for guest user

I'm trying to redirect guest users to the login page when they click on the Add to Cart button and they are not registered. But I can't do it. I am using an Observer with the following event <...
0
votes
0answers
34 views

Magento 1.9 - What event used for observe Minimum Order Value Condition?

Selected customer able to place an order even minimum order condition applied. Eg: My store Minimum order value: 500 if selected customer order value 200 he should place an order. What event used for ...
0
votes
0answers
13 views

how can I convert an attribute value of type date to php datetime object in Magento 1.9

I have created in the backend a product attribute called estimated_date and I would like to manipulate it in an observer for catalog_product_save_after. So from my catalog/product model I would like ...
0
votes
1answer
37 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
44 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
13 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
71 views

Unable to redirect to cart page from observer?

Here is the code, please review and 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
45 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
24 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
39 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
22 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
31 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
20 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
1answer
33 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
33 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
32 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
22 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
37 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
48 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
48 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
23 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
18 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
139 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
187 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
71 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
0answers
66 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
41 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" ...
2
votes
1answer
49 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
30 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 ...