Questions tagged [di.xml]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
10
votes
6answers
9k views

Delete operation is forbidden for current area

I want to create command for delete operation for simple product by sku. I'm getting following error.how to set admin area? [Magento\Framework\Exception\LocalizedException] Delete operation is ...
9
votes
2answers
15k views

Magento 2 After plugin with parameter

I am trying to implement after plugin to the following method. public function getCategoryUrl($category) { if ($category instanceof ModelCategory) { return $category->getUrl(); } ...
9
votes
3answers
2k views

Correct, Supported way to Add CLI Commands to Magento 2

Is there a correct, and officially supported way, to add your CLI commands to a Magento 2 module? From what I've gathered your options are Add your command class to the commands argument of Magento\...
8
votes
3answers
9k views

Is it possible to disable plugins defined in di.xml programatically?

Given a plugin defined in di.xml such as the following: <type name="\Magento\Catalog\Model\Product"> <plugin name="se_catalog_product_plugin_ample" type="Example\Module\Model\...
5
votes
2answers
300 views

Argument replacement not working for type object

I am trying to replace an object using Argument Replacement but unfortunately I am unable to do so for type:object. Every time I am getting error: 1 exception(s): Exception #0 (Magento\Framework\...
5
votes
1answer
612 views

Swapping Less for Sass / Removing an argument previously added to type via di.xml in Magento2

So I am investigating Ben Mark's claim that is really easy to switch out the PHP Less pre-processor for a Sass one. https://twitter.com/benmarks/status/590219053437833217 (I don't buy it) I have ...
3
votes
2answers
3k views

Magento2: Change in di.xml

After making a change to app/etc/di.xml Am I required to take some additional steps in order for the change to take effect? Like clean cache, deploy static files or compile code?
3
votes
1answer
651 views

How to set ifconfig for di.xml magento 2

I want set ifconfig configuration for below code: First code in di.xml <virtualType name="searchFilterList" type="Magento\Catalog\Model\Layer\FilterList"> <arguments> <...
2
votes
2answers
1k views

How to create custom route in magento2

I have used below code in di.xml <type name="Magento\Framework\App\RouterList"> <arguments> <argument name="routerList" xsi:type="array"> <item name="...
2
votes
2answers
1k views

Magento 2 How to over write route FrontName of a module?

I'm trying to extend Magento 2 default module Magente_Contact, but I can't change the frontName, I tried to put in the di.xml, but nothing happens. <config> <router id="standart"> ...
2
votes
0answers
113 views

di.xml ExtensionPool create/read handlers Conflicts

I am creating extensionpool handlers to save data in multiple tables. There are total 3 tables : 1 : Sliders 2 : SliderItems 3 : SliderSelectedItems When I create/update Slider, list of selected ...
1
vote
1answer
107 views

How to override already override class in magento 2

Hii we need to override Magento\Catalog\Model\ResourceModel\Product\Collection class for our customisation. To do this we added <preference for="Magento\Catalog\Model\ResourceModel\Product\...
1
vote
1answer
999 views

What is the Use of Type and Virtual Types(di.xml) in Magento2?

I want to know clear about Type and Virtual Types in di.xml with examples. When we can use it. Please share simple example to understand concept. Note please go through the practical examples.
1
vote
1answer
438 views

What does this di.xml file have incorrect?

I am implementing a custom payment gateway. To be able to config it, I have created a ConfigProvider this way: <?php /** * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for ...
1
vote
1answer
3k views

Magento 2 class not exist error occurs when overriding a controller

error: a:4:{i:0;s:68:"Class namespace\modulename\Controller\CustomLoginPost does not exist";i:1;s:6711:"#0 C:\xampp2\htdocs\magento2\lib\internal\Magento\Framework\Code\Reader\ClassReader.php(19): ...
1
vote
1answer
48 views

Creating custom M2 grid and rendering data from a custom table issue

I tried to follow these tutorials: https://medium.com/@jhonkelly2016/how-to-create-admin-grid-in-magento-2-9f39d052322d https://www.mageplaza.com/magento-2-module-development/create-admin-grid-...
1
vote
2answers
1k views

Magento 2 : Display multiple grids in admin area

I have displayed my one custom table in a grid format. Now, I want to display one other custom table in a grid format (Under different menu). But I am little bit confused, how to add code in di.xml ...
1
vote
0answers
114 views

ifconfig to disable part of an extension

I have added a Column to the New Order -> Customer Grid. I am having a really tough time getting the system config to disable this code if turned off. I was hoping I could use a simple ifconfig in the ...
1
vote
2answers
939 views

admin grid not working

listing file <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="provider" xsi:type="string">faq_listing.faq_listing_data_source&...
0
votes
3answers
595 views

Overwrite pdf.xml

I want to overwrite pdf.xml in Magento 2.1.3 to change order for the total block, but i can't figure out how i can do that. The totals are ordered in pdf.xml in Magento/sales/pdf Edit: First I had ...
0
votes
1answer
242 views

Magento2 use Plugins (di.xml)

I have created a Plugin. Registered it in di.xml All public methods execute. Can I inject/rewrite/replace (don't know the proper title) protected methods? How?
0
votes
1answer
53 views

Rewriting blocks in admin

di.xml: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <...
0
votes
1answer
41 views

In Magento 2 is there any chance to broke site due to spaces in di.xml file

Is there any chance or any cause to broke the site due to spaces in di.xml file in Magento 2
0
votes
1answer
17 views

how to disable di.xml virtual types from vendor in custom module

I am currently experiencing an issue where a vendor module is using MSI, however we needed to disable it via composer completly ( magento 2.3.4 ) The vendor module in question is the amasty layered ...
0
votes
1answer
31 views

Magento 2 Cron Run throws PHP Fatal error: Uncaught Error: Cannot instantiate interface Magento\Framework\Filesystem\DriverInterface

So when I run the php bin/magento cron:run I get error as PHP Fatal error: Uncaught Error: Cannot instantiate interface Magento\Framework\Filesystem\DriverInterface This error gets disappear after ...
0
votes
0answers
13 views

magento2: I use di.xml to orverwrite vendor function but still run vendor function

It's code in di.xml. <preference for="\Magento\Customer\Model\Address\AbstractAddress" type="Forkel\CustomShipping\Model\Address\AbstractAddress" /> My file Forkel\CustomShipping\Model\...
0
votes
1answer
30 views

how to change the order of aggreation filter in magento 2 in di.xml

Magento/Cataloggraphql/etc/graphql/di.xml <type name="Magento\CatalogGraphQl\DataProvider\Product\LayeredNavigation\LayerBuilder"> <arguments> <argument name="...
0
votes
0answers
68 views

Magento 2 Override a type used in virtual type

So, I'm trying to override a class that is used to create a virtual type, which is used as a preference for another class (see the Core di.xml below). I have posted the excerpt from my di.xml as well....
0
votes
0answers
8 views

calling array from di.xml into fieldset for admin panel

In Magento 2.3 I am trying to set a field to the table from another module. I injected it via the di.xml. <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory"...
0
votes
1answer
132 views

Injecting additional dependencies into a class - Magento 2.3

I am trying to inject additional dependencies into a class. The class in question is: \Magento\Customer\Block\Adminhtml\Edit\Tab\View\PersonalInfo The construct of this class looks like: public ...
0
votes
2answers
196 views

Magento 2 For what secureUrlList at di

What purpose of using secureUrlList at Magento di.xml? It appear at few di.xml base and for frontend: Like an example: <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
0
votes
1answer
262 views

Why is my Magento Catalog Block Preference ignored in di.xml?

I am trying to extend the Magento\Catalog\Block\Product\ListProduct block in Magento 2.1 My Vendor_ModuleName module has the registration.php, the etc/module.xml and it's enabled. Then I add an etc/...