Questions tagged [event-observer]
Event/observer is used to work dynamically with Magento without altering the core code.
2,153
questions
0
votes
1
answer
867
views
magento event not fireing with graphql
i create a custom module in Magento 2.4 .
I create an observer on the event "customer_register_success" . when i use graphql(i use pwa in frontend) the event is not firing but it work ...
1
vote
1
answer
147
views
Magento 2: Data printed in Controller but display null in observer
Controller file
$collection = $this->investmentFactory->create()->load($id);
$collection->getData();
// echo '<pre/>';
// print_r($collection->getData());
...
0
votes
3
answers
1k
views
Magento 2 Place Order Programmatically Using Event Observer
Created a custom form where customer and product details filled with status of Active/Not active
So for now I want to create an event and observer to place order programmatically when status is Active ...
0
votes
1
answer
1k
views
magento 2 - different email template based on order status
I have multiple status like
1: Pending
2: Processing
3: cancelled
4: completed
When order is cancelled used get defualt status notification email, instead i want to use different template when order ...
0
votes
2
answers
2k
views
Magento2 Addtocart before plugin not working
I have created before plugin for Add to cart functionality to check if product's custom attribute called My Tshirt(which is text field type) value "Jack" or "Jill".
Plugin work ...
0
votes
1
answer
83
views
Get target url in layout before observer
I'm inside an observer
<event name="layout_load_before">
<observer name="add_robot" instance="FranceTombale\Robot\Observer\NoindexfollowOnProduct" />
</...
0
votes
1
answer
114
views
Quantity Change Event is inventory killer
Such unattended automatic quantity change events are a big hit on the SB inventories. Say you have handles 1,000 e. and your magento is synced to Quick Books for daily sales reporting. Magento ...
1
vote
0
answers
196
views
How to detect product quantity change using observer in Magento 2.4.1?
We are using Magento 2.4.1 and we want to update the values of some custom attributes in the product whenever the product quantity is changed in the admin. Which events can be used to detect the ...
0
votes
1
answer
462
views
Magento 2: Class instance
When i printed this print_r(get_class($this->getOrder()));
I got this class name
Magento\Sales\Model\Order\Interceptor
What does this actually mean ?
Where is this "Magento\Sales\Model\Order\...
1
vote
2
answers
541
views
Magento 2 : How to pass custom data in existing event
I am trying to pass
$pagedata = new \Magento\Framework\DataObject(array('name' => 'customdata'));
$this->eventManager->dispatch('customer_login', ['customer' => $...
1
vote
2
answers
558
views
getFullActionName() returns empty results for product pages inside predispatch observer
I have created an observer listening to the event controller_action_predispatch on a clean Magento 2.4.2 instance, and I tried to get the module name and full action name from within the observer. It ...
0
votes
2
answers
44
views
Magento 2 : Get ordered item
I have used sales_order_place_after observer .
i am trying to get product items but i get more items in data
for exg. i have ordered 2 items but i am getting 4 items in data
foreach ($order->...
0
votes
3
answers
155
views
Magento 2 : Get ordered products in sales_order_after observer
Is their any way i can get the product names in sales_order_place_after observer ?
I get the order object but not sure how to fetch the products.
Any thoughts ?
0
votes
1
answer
79
views
How to set phtml file in specific area Magento 1.9 using an Observer
I'm trying to set/ display a template file instead of the default messaging in Magento 1.9 using an Observer when the checkout loads but I cannot get the phtml file to show up and I don't know why??
...
0
votes
1
answer
588
views
Observer checkout_submit_all_after not called on magento 2.3.3
This is my app/code/Nadine/Campaign/etc/events.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="...
1
vote
1
answer
760
views
Create observer on "email_shipment_set_template_vars_before" and set template vars
I have created a observer on "email_shipment_set_template_vars_before"
& trying to set some template var but its not working.
any thoughts ?
<?php
/**
* Copyright © Magento, Inc. All ...
0
votes
1
answer
330
views
How to get customerId on sales_order_place_after observer?
I'm trying to get the CustomerId when an order is placed so that I can manipulate it before the order is saved to the DB.
Vendor/Module/etc/frontend/events.xml
<?xml version="1.0"?>
&...
0
votes
1
answer
401
views
Magento 2: Customer Account Reorder button not showing
I have activated reorder in my magento 2 website. Now I wanted to build the functionality where if the customer click on the reorder button it will add all the products in the cart except for disabled ...
0
votes
1
answer
224
views
Magento2 not able to get customer data in observer
I am using Magento 2.4.1, made observer. Event name is checkout_submit_all_after. I want to
update order data, customer data, customer address data. Updating Order data is succeeded, but Other data ...
0
votes
1
answer
369
views
Magento 2: Cancel order email sent to customer if admin cancel order
I am very beginner to magento and i am looking for answer,
if i cancel order from admin panel but cancel email order is not sent to customer.
If i want to sent email to customer what should i need to ...
1
vote
1
answer
81
views
How to get ordered items in observer for "sales_order_place_after" event?
I am trying to get ordered items in sales_order_place_after event,
but i am not able to log the ordered items.
Here is the code which i have used.
<?php
namespace Vendor\Module\Helper;
use ...
0
votes
2
answers
299
views
How to determine if customer is new or existing from "customer_save_after_data_object" event ? Magento 2
Here is my events.xml file
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:...
0
votes
1
answer
448
views
Customer Logout event not triggering
I am using magento 2 + react (frontend).
I have setup grapql to interconnect with frontend-backend functionality
I have Customer Logout event in module which is not triggering,
i do not see any error ...
0
votes
1
answer
267
views
How to pass some data to observer data?
I have a popup for login in custom page
when user login from custom page i want to trigger an event "log in"
& in that event i am trying to pass the "location" property.
I am ...
0
votes
1
answer
935
views
How to change the price of a product on the category page?
I am building a module for customer specific pricing. Here is psuedocode for altering the price for a specific product. This works on the product page and through the checkout journey.
$_product = $...
4
votes
1
answer
314
views
Issues with the `sales_order_item_cancel` event in Magento 2.4.1
I have made an API which cancel and order. This is part of the code:
// \Magento\Sales\Api\OrderManagementInterface
$this->orderManagement->cancel($order->getId());
The above code will ...
0
votes
0
answers
286
views
Magento 2 - Using observer how to Set CMS block to category description block programmatically
Using observer how to set catalog categories content Add CMS Block (category.description) programmatically
My observer:
<?php
namespace Zero\DescBlock\Observer;
use Magento\Framework\Event\...
0
votes
1
answer
155
views
How to check PLP page layered navigation attributes selected or not using Observer?
I am using event ( catalog_product_collection_load_before )for check PLP page layered navigation attributes selected or not, my observer,
app\code\Zero\DescBlock\Observer\Data.php
<?php
namespace ...
0
votes
1
answer
84
views
Magento 2 - What is the error in my observer - catalog_product_collection_load_before
I want to get selected attributes in product listing page using observer,
app\code\Zero\DescBlock\registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\...
0
votes
1
answer
74
views
M2 - How to get active fitters using observer
How to get active filters using observer on product listing page, what is the procedure to get that?
0
votes
1
answer
559
views
Magento 2: Skip specific products from adding into cart on reorder?
When I am clicking on reorder from customer account I want to remove specific products from adding into my cart. For this I am using "controller_action_predispatch_sales_order_reorder" event ...
0
votes
0
answers
54
views
Magento 2: which event fires before a product gets added into cart on the admin side?
When an admin wants to reorder an item I want to check whether that item is enabled or disabled and if its disabled I want to skip that product based on its SKUs from adding into my cart. Which event ...
0
votes
3
answers
552
views
Magento 2: Which event fires when I reorder from admin side?
I have activated reorder on my magento 2 site. Now I want a event which can catch reorder both in frontend and backend (admin). I am using "controller_action_predispatch_sales_order_reorder" ...
0
votes
2
answers
568
views
How do i get the order ID and Order Subtotal in the credit memo page?
Im currently trying to write a piece of code that refunds an order and attach it to the "refund" button in the credit memo page using the "sales_order_payment_refund" event.
But, ...
2
votes
1
answer
879
views
how to get custom attributes in rest search api?
In order rest api http://127.0.0.1/mag/index.php/rest/V1/orders/1
it shows custom attributes
"payment_additional_info": [
{
"key": "method_title",
...
0
votes
1
answer
259
views
How can i add a custom input filed (not attribute) using phtml in product edit page in magneto 2.4
I want to add a custom checkbox list filed (not attribute)in product edit page. Therefore I call a phtml file in product admin and set checkbox input filed (which is dynamic).But when i am using ...
0
votes
1
answer
86
views
Any event available for backend to run a function in every page- Magento 2?
In Magento2,is there an event-observer available for the backend to run a function on every page?
1
vote
1
answer
52
views
M1 - How to set different tax class IDs on different instances of the same product in a cart based on custom options
I'm using the latest version of Magento 1.9 and I'm stuck trying to make a change. I checked all the related questions and couldn't find a solution. I figured I should see if someone can help before I ...
1
vote
1
answer
135
views
Magento - Create observer that sends email
How can I write an observer that sends email which tracks an eav_attribute yes or no value?
The email get's sent, if value is set to yes.
I already created the attribute and the email template.
I only ...
0
votes
1
answer
203
views
Magento 2 How to hide free shipping method at checkout?
We are using this plugin -
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:...
0
votes
1
answer
132
views
Set Product Custom Options From Observer Magento 1.9
I am trying to add custom options to products on save. I want to add or update custom options (not additional options) on before_product save. I am able to access the observer and it is working on ...
1
vote
3
answers
799
views
What event should i trigger that works when a customer places an order?
I'm new to Magento and the next step I want to learn is to listen to an event. So, I'm trying to find which event should I trigger that works after a customer has placed an order that also carries ...
1
vote
3
answers
928
views
Add JS on condition
I'm want to add a dynamic js remote file in my website. So far, I've added CSS file thanks to this, but I can't achieve to add CSS files.
I've an observer with that.
<event name="...
0
votes
0
answers
226
views
Magento 2 Available Qty Check Before Taking Customers to Payment Gateway
When customer tried to place an order , In my website i have only one Qty for each SKU. When two different customers tried to place an order on same time for same SKU one customer got an order number ...
0
votes
1
answer
1k
views
Magento 2 coupon apply and remove event
I want to redirect to /checkout if a coupon is applied and it is valid. I have tried this event controller_action_predispatch_checkout_cart_couponPost this only works on coupon cancel and /cart page. ...
0
votes
2
answers
442
views
Using the right event observer name issue in the admin area
I would like to some custom things when you are on the create a new website in the admin area page.
This is the exact controller used to render that page:
\Magento\Backend\Controller\Adminhtml\System\...
0
votes
2
answers
41
views
Unable to save product attribute issue
I have an observer, using this event: catalog_product_save_after , where I would like to assign some website ids to my product. This is my code:
public function execute(Observer $observer)
{
$...
0
votes
1
answer
548
views
How to set custom_field value from product page to quote after a product added to cart in magento 2?
I have a custom_field on the product details page( Like a hidden field ). Which is not a product attribute.
I can get this field value using checkout_cart_product_add_after event using an observer ...
1
vote
1
answer
808
views
Magento 2 - cant modify quote before placing order
I try to delete all items with a custom product type from the quote before the order is placed. So I created an observer for the event sales_order_place_before. In this observer I am collection all ...
-1
votes
2
answers
318
views
Magento 2 - Can you replace any observer with plugin?
I am using a observer for the event sales_order_place_before.
It does not work as expected, so I try to replace it with a plugin to see if it does make a difference.
The event sales_order_place_before ...