Questions tagged [interceptor]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
28 views

Save cart through backend gives @return type error

I am trying to change some data on a cart through the backend programmatically, i have a grid with a few actions, if i execute the Approve or Reject action it will go to a GET url. Admin Controller &...
0
votes
0answers
142 views

Magento 2 : Class interceptor does not exist

I have a simple module when I save data then this error : Magepow\Importexport\Controller\Adminhtml\Allimports\Save\Interceptor does not exist [] [] here is save file <?php namespace Magepow\...
1
vote
1answer
189 views

Class interceptor does not exist magento 2

Class Vendor\Mymodule\Controller\Adminhtml\Allimports\Save\Interceptor does not exist I have a custom form and when I save data this error message, how to fix it, except usage di: compile. Thank you.
0
votes
1answer
157 views

Type Error occurred when creating Interceptor after Updating to 2.3.2

After updating Magento from 2.1.6 to 2.3.2 and PHP from 5.6.30 to 7.2.20, now running into errors on page load. Have a module called Inquiry, which consists of forms to request things, and there is a ...
0
votes
0answers
45 views

Mass update doesnt work in Magento 2.3.2

I am using bulk action feature in admin, on catalog page when am trying to update attribute am getting below error Got error 'PHP message: PHP Fatal error: Uncaught Error: Cannot instantiate ...
0
votes
4answers
151 views

Wishlist ajax remove

I want to remove product from wishlist from a custom button on detail. I did a plugin for the Magento\Wishlist\Controller\Index\Remove.php with an aroundExecute but for some reason I can't load/create ...
1
vote
2answers
464 views

Magento 2.3 Type Error occurred when creating object: Magecomp\Imageclean\Model\ResourceModel\Imageclean\Grid\Collection\Interceptor

I am using under given module. https://magecomp.com/magento-2-image-clean.html Till Magento 2.3.1 it's working perfectly. After upgrade to 2.3.2 it giving under given error: Type Error occurred ...
6
votes
2answers
4k views

Magento-2:Class Magento\Framework\App\Http\Interceptor does not exist

Exception.log file Error: {"exception":"[object] (ReflectionException(code: -1): Class Magento\Framework\App\Http\Interceptor does not exist
1
vote
1answer
58 views

How do I prevent interceptor classes from being generated so I can debug?

I'm using xdebug to set breakpoints in Magento Commerce, which is installed locally on Ubuntu. I have a breakpoint set in vendor/magento/framework/App/FrontController.php. However, that breakpoint ...
0
votes
0answers
230 views

before plugin parameter magento 2

I am writing a before plugin for below public method. public function setup($user,$pass,$url = null){ $this->username = $user; $this->password = $pass; if ($url) { ...
1
vote
1answer
62 views

Unable to get newly inserted Product's Id using After Plugin for Catalog Product save controller method

I have created interceptor for catalog product controller's save action <type name="Magento\Catalog\Controller\Adminhtml\Product\Save"> <plugin name="ricky_catalog_save_product" ...
0
votes
0answers
43 views

interceptor has wrong interface

Im trying to override a plugin render function with a call to afterRender(); I need part of the existing function but that causes a Fatal error: Fatal error: Uncaught TypeError: Argument 1 passed to ...
2
votes
3answers
638 views

interceptor not generate for \Magento\Catalog\Block\Product\ListProduct

I'm trying to create plugin for getProductPrice but \Magento\Catalog\Block\Product\ListProduct Block Class not generate Interceptor Class like Magento\Catalog\Block\Product\ListProduct\Interceptor. ...
0
votes
1answer
99 views

Create an Interceptor/Observer to trigger action when specific page is loaded

I want to send info to third party services about the views on pages like cart, products, checkout, etc. This info is sent whenever someone visits the respective page or view. For example, when a ...
2
votes
1answer
180 views

Compilation error due to final class Vault in Magento version before 2.2.0

I am writing a plugin on class Magento\Payment\Model\MethodInterface: <type name=“Magento\Payment\Model\MethodInterface”> <plugin name=“mageworx_ordereditor_change_title_print_order” ...
0
votes
1answer
69 views

Where to place magento 2.2.x custom interceptor

I am trying to look for a proper document where it is clearly told about where to place my interceptor code for continuous programming This document https://devdocs.magento.com/guides/v2.2/extension-...
0
votes
1answer
398 views

Magento2 plugin/interceptor not working

I have following action: http://localhost/admin/catalog/product_attribute/edit/attribute_id/135/key/…/ I would like to do some extra things with attribute after saving. I have created and registered ...
1
vote
1answer
321 views

Remove plugin (interceptor)

I want to prevent a certain plugin from loading, namely 'authorization' plugin in module-quote/Model/GuestCartManagement/Plugin/Authorization.php. What i tried to do is to comment lines in di.xml ...
1
vote
1answer
350 views

plugin to stop redirecting to cart from checkout

In M2 if the user tries to go to the checkout without any items in their cart the Magento\Checkout\Controller\Index\Index::execute() function redirects them to the cart. if (!$quote->hasItems() || ...
0
votes
1answer
126 views

How to stop Interceptor class rewriting return annotations

Magento version: 2.2.3 I have a Block class with a method to fetch the designer associated with a product. It is annotated to return a model interface or null. public function getDesigner(): ?...
0
votes
2answers
118 views

Why is Magento 2 creating this Interceptor file?

I've been comparing two versions of a website I'm working on -- one is fine and the other has a broken layout -- and the main difference I've found between them is the following file: generated/code/...
0
votes
0answers
145 views

Interceptor error in Observer

vendor/magento/module-sales/etc/events.xml <event name="sales_order_save_after"> <observer name="sales_order_save_after" instance="Magento\Sales\Observer\SalesOrderSaveAfter" /> </...
2
votes
1answer
45 views

Is it better to use solely around function instead of before+after combined?

The codes below can achieve the same output: Using solely around plugin public function aroundXXX( SomeClass $subject, \Closure $proceed ){ beforeFunctions(); /*Perform XXX*/ $...
1
vote
1answer
282 views

How to stop saving resource model and throw error messages inside _beforeSave function?

I have the following codes inside a custom resourceModel class: protected function _beforeSave( AbstractModel $object ) { //My operations return parent::_beforeSave($object); } I added a ...
0
votes
1answer
44 views

Problem with widgets in Magento 2.1.9

I'm getting the next message when I try to add a widget on a block; Insert Widget... There has been an error processing your request Class Magento\Widget\Controller\Adminhtml\Widget\Index\...
1
vote
2answers
280 views

Magento 2 - Select the interceptor/observer

I want to have products that not require to stay logged and other that need it. So i think the best way is set in the admin "Allow Guest Checkout = Yes" and when the client goes to the checkout and ...
1
vote
1answer
1k views

Magento 2 using around interceptor/plugin to modify exception message

In the Magento\Checkout\Model\PaymentInformationManagement::savePaymentInformationAndPlaceOrder() method all exceptions are caught and CouldNotSaveException is created with a generic message. I ...
4
votes
2answers
1k views

Plugin, get original function parameters in after method

When creating plugin (http://devdocs.magento.com/guides/v2.0/extension-dev-guide/plugins.html) is there a way to get original parameters in after method? I'm not sure what i can find in the first ...
3
votes
1answer
526 views

Where is Magento\Framework\App\FrontController\Interceptor?

I am learning magento 2.1 request flow. I am stuck here: $frontController = $this->_objectManager->get('Magento\Framework\App\FrontControllerInterface'); $result = $frontController->...
2
votes
1answer
302 views

Magento 2 getProductCollection Interceptor everytime

I would like to intercept and modify a product collection every time it is used. However, I am having issues figuring out what functions to create a plugin for. I mostly understand Interceptors, ...
1
vote
0answers
65 views

Has anybody used Plugins(Interceptors) for Magento 1 from SafeMage Team? [closed]

everybody! Could anybody tell me if he use Plugins(Interceptors) from this team? http://www.safemage.com/function-plugins-for-magento-1.html It seems it is similar to the same functionality of ...
2
votes
1answer
2k views

Magento 2 : Use plugin / interceptor on abstract class

I am trying to create a plugin that fires after \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShipment\PrintAction::execute. So I have my plugin setup in di.xml and an afterExecute() method, ...
1
vote
1answer
161 views

Sharing data between interceptor (plugin) and block. How?

I want to use some data from intercepters in a block. To start with I have attempted to use DI to inject a simple custom model but by logging I see that a instance is been used by the interceptor ...
2
votes
1answer
3k views

Interceptor error in Controller magento2

Vendor\Module\etc\di.xml <preference for="Magento\CatalogSearch\Controller\Result\Index" type="Vendor\Module\Controller\Result\Index" /> Vendor\Module\Controller\Result\Index.php namespace ...
2
votes
2answers
147 views

Add same plugin to all public methods of a type

Is there any chance to add a plugin to all public methods of a type without writing a separate method for all of them? I would like to use that to log method calls. The original method is always ...
1
vote
1answer
250 views

Plugin for coupon codes

I have added a plugin which should be triggered when a coupon code is applied. Sadly nothing happens, no errors too. Where did I go wrong? <?php namespace Zygis\TestModule\Plugin; class ...
1
vote
1answer
180 views

How to log Magento2 interceptors (plugins)

I want to get a list of interceptors and the order that they are dispatched. I also need to get the module name of each interceptor. I'm thinking of logging straight from the Magento\Framework\...
24
votes
1answer
5k views

Magento 2: what are the Interceptors file in var/generation?

So I noticed some Interceptor.php files in var/generation I know that this folder contains generated classes created on the fly for the following: Factories Proxies Plugins I assume that ...
3
votes
0answers
351 views

Magento 2 setup:di:compile exclude folders [duplicate]

Is it possible to exclude folders for a Magento 2 extension to be able to support Magento 2 compile command? Currently setup:di:compile throws errors that parent classes not found as they are loaded ...
1
vote
1answer
124 views

Plugins for intercepting methods with a negative sort order?

Within your di.xml you can add plugins to intercept methods of injectable classes. You can also specify a sortOrder. Can this ordering be negative, like -1? We guess so, but would like to know if ...
32
votes
3answers
7k views

Magento 2: Plugin before/around/after Interaction

In Magento 2, when you create an "around" plugin public function aroundRenderResult( \Magento\Framework\Controller\ResultInterface $subject, \Closure $proceed, ResponseHttp $response ) { ...
3
votes
1answer
3k views

Magento 2 - What is file Interceptor.php?

When I overrided file controller of catalog/product and ran this command: php bin/mangento setup:di:compile And then this file "Interceptor.php" was generated in magento_root\var\generation\myPool\...
1
vote
1answer
214 views

Why intercepter files are generator generation\Magento\Framework\View\Result\Layout\interceptor.php?

I have Magento 2 with sample data and I came across this file generation\Magento\Framework\View\Result\Layout\interceptor.php. The Interceptor file is generated only if any module wants to ...
1
vote
1answer
404 views

Plugin for ShippingMethodManagement no longer called when upgrading from Magento 2 beta4 to 2.0.0 release

I upgraded from the beta4 to the Magento 2.0.0 release. Now, I plugin I defined is no longer executed. My app/code/Example/Product/etc/frontend/di.xml looks like this: <?xml version="1.0"?> &...
3
votes
1answer
1k views

Magento 2: Intercept controller's JSON response

I'm trying to intercept a controller returning a JSON object of Magento\Framework\Controller\Result\Json class. The problem is that no matter if I use a plugin or a preference to "catch" the ...
7
votes
1answer
930 views

Magento 2: Why Does My Custom Controller Generate an Interceptor?

I recently created a basic routing configuration for a test module <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/...
17
votes
3answers
1k views

What Classes are “Intercept-able/Plugin-able” in Magento 2

Date: May 30, 2015 (given the changing nature of Magento 2). Magento 2 introduced a plugin concept, implemented via an interceptor pattern. What's not clear from the docs is -- which classes and ...
9
votes
3answers
946 views

Does interception in magento2 replace observers in magento1?

Is interception intended to be the preferred method when dealing with changing the behavior of an original method in Magento2 as observers was in magento1? https://wiki.magento.com/display/MAGE2DOC/...