All Questions

Tagged with
Filter by
Sorted by
Tagged with
3
votes
3answers
119 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
2answers
46 views

Magento 2 :- how to get email address in sales_quote_address_collect_totals_before events

How to get email address in sales_quote_address_collect_totals_before events guest user email address. <?php namespace xxxxxx\xxxx\Observer; use Magento\Framework\Event\ObserverInterface; ...
0
votes
0answers
20 views

how to get guest email address in CollectTotalsObserver page in magento 2

how to get a guest email address in CollectTotalsObserver page in Magento 2. public function execute(\Magento\Framework\Event\Observer $observer) { /** @var \Magento\Quote\Api\Data\...
0
votes
1answer
36 views

Error when observer is executed after order is placed

I created a module in order to save order data to a custom table: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="...
0
votes
1answer
31 views

Magento Observer to block spam orders not working

I'm facing some issues with orders placed by bots. I noticed that all orders are made by a specific phone number and also by a specific street. So I looked for a way to block orders that are made ...
0
votes
0answers
76 views

Newsletter subscribe/unsubscribe email notification event observer

I am writing my own admin email notifications module. So far it has New Order and Low Stock observers set up and working just fine. I want to add the Newsletter subscribe/unsubscribe observer to it ...
2
votes
4answers
171 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" ...
0
votes
0answers
49 views

how to get the custom page event happened data to observer in magento 2?

I have custom module observer in Magento 2 <event name="controller_action_postdispatch_mpquotesystem_sellerquote_quoteedit"> <observer name="...
0
votes
3answers
204 views

how i can override the observer of other modules in magento 2

how i can override observer of other module(custom module) to my another custom modules in magento 2 is it possible ??? Does anyone have an idea? ex : custom module 1: the observer for ...
3
votes
1answer
157 views

Magento 1.9 observer on only new product added ( no updated product )

I need an observer when a new product is added, I don't need one when a product already exists and it is updated. I found catalog_product_save_after and _before but this is triggered when a product is ...
0
votes
2answers
420 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:...
1
vote
1answer
222 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
1answer
222 views

magento 1.9 observer on quantity product change

I can't find the event for quantity product change for magento 1.9. I need to do something after a quantity product is updated from backend and frontend, when a user buy a product and decrease ...
1
vote
1answer
184 views

I want to run an Event Observer once after my custom module is installed

Is there a way to run a function (to call an api) once after a module is installed? It could be during admin page load or in the install script. But i wish to run only once. Thanks
1
vote
1answer
52 views

Getting error when show “out of stock” products in last [duplicate]

I have developed Magento module that shows out of stock products in last of catalog page list and I test it in my test website and it works correctly but in other websites (Magento 1.9.3.7) I got ...
3
votes
2answers
176 views

unable to get order status in sales_order_place_after event in magento 1.9

Hello I am unable to get the order status in the observer sales_order_place_after I also tried other events like checkout_onepage_controller_success_action, checkout_type_onepage_save_order_after. ...
3
votes
2answers
1k views

Magento2 : How to add Observer for catch when new order placed

I wanted to save the orders from magento2 to my local Database. I am planning to Create a module and add Observer to catch once a order is placed. I don't know much about the Events & observer, ...
1
vote
1answer
238 views

Magento 1.9 - automatically add comment with module / observer

I just started to write a module which adds a specific comment to all orders. Therefore im hooking into sales_order_place_after The code below unfortunaley not works... app/etc/modules/...
0
votes
1answer
87 views

Magento2 Event interception not working

I want to intercept sales_order_place_before event, so I created a new module named app\code\Giulio\CheckoutExtention, created aregistration.php` file where I put this code below: <?php \Magento\...
0
votes
1answer
187 views

Magento 2 Programatically create a product on the checkout_cart_product_add_after event

I'm currently working on a module that adds specific products to the cart when the customer adds a normal product. I created an observer for the checkout_cart_product_add_after. The user will select a ...
0
votes
2answers
100 views

Slow code in custom observer

I have this code in a custom observer to check current products in quote for stockstatusses etc. But this code adds like 4 to 6 seconds to loading the checkout. I guess the way the data is retrieved ...
0
votes
1answer
382 views

Observer for Admin while creating an order

Is it possible to have an observer while making an order in the admin panel? I'm trying to change the 'purchased from' depending on which customer group the customer is in. So if a customer is in ...
2
votes
1answer
744 views

How to add default header and footer to a custom mail on magento 2.2

I have created a module where I send a custom mail. For this, I have a custom email template. Now what I want to do is to include the default header and footer that appears in all my Magento emails, ...
0
votes
2answers
116 views

Magento looks for my custom local module under namespace Mage

I've created a custom module with an Observer to log every product change on a log file. The Observer is listening on the event catalog_product_save_after. I've created the folder for my namespace ...
2
votes
1answer
43 views

Downloadable product event if someone click on the document (pdf) included

I need to trigger an event if an user click a downloadable product, i mean the document (pdf, word, etc...) included because i need my customer read those documents, and after that i need to do some ...
4
votes
1answer
868 views

Magento2 - Creating my first custom module and observer

this is my first project with Magento and my first question here. I'm trying to create an Observer, but I can't figure it out. The error in var/log/system.log is: main.CRITICAL: Exception message: ...
1
vote
0answers
320 views

How to Hide Add to cart button in Magento 2 front end without editing phtml file

I created a custom module which has option to enable / disable Add to cart button in front end , I'm trying to hide button without editing the core templates files , is there any way to implement it . ...
3
votes
1answer
637 views

Magento2 Catalog - Record the product change and changer

In Magento2.1, I want to make a module to record the product change and changer in database. I think I can use events and observers to achieve it. The catalog_product_save_after event maybe is a good ...
1
vote
1answer
241 views

Magento2 Why I can't get POST data from .\Magento\Framework\App\RequestInterface $request?

This is my code in my module observer namespace Customtest\Customlogin\Observer; use \Magento\Framework\Event\Observer; use \Magento\Framework\Event\ObserverInterface; class CustomerLogin ...
0
votes
0answers
402 views

How to use cron in custom module

in observer.php public function sendProductAlert() { Mage::log('cron working'); $connectionresource = Mage::getSingleton('core/resource'); $readconnection = $connectionresource->...
0
votes
1answer
937 views

Magento 2 - Prevent form submit on page reload when Product add from sample script to Magento Shopping Cart

Below sample PHP script will list simple/configurable product with add to cart button. When user clicks on submit button, it will redirect to Magento shopping cart page and selected product will be ...
1
vote
0answers
103 views

Shipping observer module breaks payment option

I made an observer module to limit the possible payment options for certain shipping methods. The most notable is to only allow cash payment with an in-store pickup. This is my Observer.php: public ...
0
votes
2answers
414 views

Observer on customer_register_success event, not called

I've created a custom module, that looks like this: config.xml <config> <modules> <Mycode_GroupRegister> <version>0.1.0</version> </...
1
vote
1answer
229 views

Is there any observer like 'cataloginventory_stock_item_save_commit_after' in magento 2?

I need to trigger the inventory changes in Magento 2.0 I have an observer cataloginventory_stock_item_save_commit_after in Magento 1.9 and its working fine. But I can't find the same observer in ...
0
votes
1answer
595 views

How to call an observer from custom module: Magento 2

I built a custom module which has a custom observer OrderSaveAfter.php. How can I call any function inside the custom observer from another custom code ?
0
votes
1answer
2k views

Change the price in quote while adding product to cart: magento2

I want to apply custom price for the current order. I read that I should use sales_quote_add_item, But its look like I am doing something Wrong. I found some tutorial for magento1 but not for Magento ...
1
vote
2answers
341 views

How to add function to modify sitemap

I currently created an extension which does a series of works to the category and product url. Then I need to tell Magento not to include some of the categories and products if they have certain ...
1
vote
1answer
138 views

Retrieve product custom option

I have a custom option for a product. I would like to retrieve that data after add to cart is pressed but before the product is actually added to the cart. I want the data '12345'. I used the ...
1
vote
1answer
109 views

How to set products in stock after import

I managed to create a module to update the product set to in stock when an import is done. The only problem I see now is that the cache is invalidated afterwards and I also need to update the cache ...
0
votes
1answer
87 views

Call cms page from custom module

I have created an event observer in a module. Observer is called after checkout_card_add event. I want to call a cms page from the module if a certain condition is met. My observer.php file <?...
7
votes
5answers
1k views

Magento 1: model rewrite vs event dispatching, best strategy?

I'm working on a module where I need to modify the behavior of the getTracking() method in a shipping method carrier model. For example let's take this default one: ...
0
votes
1answer
2k views

controller action name of module is displaying in frontend

I am trying to find controller action of module for below Observer code, so that i can see those action names in log file : called_action_names.log , its displaying those names in log files. issue : ...
0
votes
1answer
552 views

Magento 2: Can we call one observer in another observer?

I already have 1 observer on checkout_cart_product_add_after . Before end of $this I woule like to call another observer which is located in different module magento\app\code\Custom\Module\Observer\...
1
vote
2answers
93 views

Magento : Replace Discontinued Product with New Product

I making observer, that detects when someone reorders a discontinued product and should replace that product with a new product. My question is: How do I retrieve a product object with a specific ...
0
votes
1answer
3k views

sales_order_save_after Observer is preventing the order from saving

I created a module that changes a customer's group if their order is completed. I'm using magento 1.9.3.1 and my module is causing some problems when checking out as a guest. In one example, checking ...
0
votes
1answer
101 views

Magento 1.9 custom module observer is not getting called

This is my config code of custom module : <controller_action_predispatch_cms_index_index> <observers> <mage_homepage_model_observer> <...
1
vote
0answers
238 views

oberserver event for filter shipment method

can you please tell me which observer event i have to use for filter shipment method before shipment method load on onpage checkout ? and also code for how to acces a shipment method or return true or ...
1
vote
1answer
342 views

Add an event observer after customer enters his shipping adress in checkout

I want to add an event when a customer enters his shipping adress in checkout I tried to create a module but it goes back to the cart here is as follows Observer.php: class ...
1
vote
2answers
548 views

Custom module, checking variable in observer

I'm new in making modules, considering below code wondering how would be possible to verify if the checkbox has been selected: my observer.php: public function execute(\Magento\Framework\Event\...
1
vote
3answers
3k views

Magento 1.9 how to create custom events

I am trying to create a custom event and get it to fire in my custom module. How can I do this?