Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [di.xml]

The tag has no usage guidance.

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

Create cutom router for redirecting to homepage || Magento 2

In Magento 2, I want to set custom route, like after baseurl/custom-route/any url it should be redirected to homepage or base url. Here, I had tried to create type of RouterList and extend ...
Aayushi Doshi's user avatar
0 votes
1 answer
72 views

Override di.xml OR Exclude a code part to be added in generated\metadata\global.php

Basically I want to make magento default store credit(Magento_CustomerBalance) to be enable/disable at website level scope(by default its global level) I have overirded & made changes in certain ...
GunJan Mehta's user avatar
0 votes
1 answer
65 views

What is the file I have to debug to know how Magento load all file di.xml from all core module and custom module?

I understand that Magento will read all di.xml files and the output will be an array. I want to know where this code is so I can debug and dig deeper into it. Any help? Thanks.
Shou's user avatar
  • 160
2 votes
3 answers
1k views

Override a Vendor's module di.xml : add an argument

I have in some Vendor's Module di.xml file this entry : <type name="Amasty\RequestQuote\Model\Pdf\PdfInformation"> <arguments> <argument name="variables" ...
Paul-Antoine Van Gansbeke's user avatar
3 votes
0 answers
131 views

Magento 2 Console command by using virtualTypes

I tried this solution but the arguments are empty when I debug the command class. It should be possible to create command classes by using a virtualType, no? The constructor arguments are empty in ...
den3988's user avatar
  • 31
0 votes
1 answer
921 views

How to register datasource for admin grid layout

I am new to magento 2 and my magento version is 2.4. I am trying to show my custom grid on magento admin but, I get the following exception: main.CRITICAL: Exception: Not registered handle ...
LosMos's user avatar
  • 121
0 votes
0 answers
336 views

Override third party module customerData class defined in di.xml arguments

I have a third party module that has this class app/code/Vendor/ModuleName/CustomerData/Popup.php and that class is defined in the frontend/di.xml file like this <type name="Magento\...
Korbin's user avatar
  • 298
0 votes
3 answers
216 views

Error when extend vendor wishlist cart file

I am using Magento2.3.5-p2 I want to extend instead of overwriting a Magento class The class that I want to extend is vendor/magento/module-wishlist/Controller/Index/Cart.php so to extend this I ...
Mohd Farhan Bin Ramli's user avatar
0 votes
1 answer
27 views

Blank page when trying use direct injection with ProductRepositoryInterface class

I am fairly new to Magento and following a tutorial on Udemy to learn how to develop on Magento 2. I am attempting to overwrite the ProductRepositoryInterface, however whenever I add the preference ...
Peter Stuart's user avatar
0 votes
2 answers
403 views

Magento 2.4.2 Adminhtml grid error

So I have a custom table and I want to create a grid in admin html to display all the records from my custom table. I created new page using page factory. I created listing.xml and di.xml as well but ...
Shivani Singh's user avatar
1 vote
1 answer
149 views

I can't enable my module with di.xml in magento

My di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/...
Tom Aguilera's user avatar
0 votes
2 answers
2k views

Magento 2 :How to override Magento\Sales\Model\Order\Email\Sender.php model?

Is their any way we can override Magento\Sales\Model\Order\Email\Sender.php model in magento 2 module ? I have created below files di.xml <?xml version="1.0"?> <config xmlns:xsi=&...
devhs's user avatar
  • 507
3 votes
1 answer
499 views

Override Magento\Sales\Model\Order\Email\Sender\CreditmemoSender Magento 2

How to override below file in module ? Magento\Sales\Model\Order\Email\Sender\CreditmemoSender.php
devhs's user avatar
  • 507
0 votes
2 answers
298 views

How can i upload SVG image on Magento 2.3.6?

Please help me. Now i can't upload SVG image on Magento V-2.3.6. I tried with below code but still can't. <type name="Magento\Cms\Model\Wysiwyg\Images\Storage"> <argument name=&...
Nang's user avatar
  • 33
2 votes
1 answer
566 views

Adding a BCC and CC (sales person) to the welcome email Magento 2

I've edited this function below and i'm overriding this method in app/code/FF/Customer/Model/EmailNotification.php natively this file exists in vendor/magento/module-customer/Model/EmailNotification....
Singleton's user avatar
0 votes
0 answers
37 views

Deactivating and reactivating plugins on-the-fly

I am currently developing on a VM with a Ubuntu host machine - it is super slow. I am currently trying to implement a plugin but the magento s:d:c command takes 6 minutes. Within examples for Plugins ...
Scott Anderson's user avatar
2 votes
3 answers
6k views

Magento 2.4.1 Custom Content Security Policy (CSP) whitelist for connect-src not Working

I created a whitelist for content-src CSP like this: <policy id="connect-src"> <values> <value id="cloudflare" type="host">*....
Tiny Dancer's user avatar
0 votes
1 answer
285 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 ...
Rotariu Dan Andrei's user avatar
0 votes
1 answer
416 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 ...
Akhil Gupta's user avatar
  • 1,946
0 votes
1 answer
298 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="...
prabhakaran7's user avatar
  • 1,087
1 vote
1 answer
775 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-...
Attila Naghi's user avatar
  • 4,023
5 votes
2 answers
1k 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\...
Narendra Vyas's user avatar
1 vote
1 answer
688 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 ...
Goose84's user avatar
  • 2,611
1 vote
1 answer
476 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\...
Prasanth's user avatar
  • 147
2 votes
0 answers
269 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 ...
Shweta Danej's user avatar
3 votes
3 answers
5k 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="...
Unknown's user avatar
  • 581
1 vote
1 answer
3k 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.
Chandra Kumar's user avatar
1 vote
0 answers
409 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 ...
RLTcode's user avatar
  • 863
0 votes
1 answer
61 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"> <...
Robot__4's user avatar
  • 119
2 votes
2 answers
2k 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"> ...
Arthur lauck do nascimento's user avatar
0 votes
1 answer
50 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
suresh-vagvala's user avatar
1 vote
2 answers
2k 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&...
Dipak Solanki's user avatar
4 votes
1 answer
1k 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> <...
Kartik Asodariya's user avatar
5 votes
4 answers
5k 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?
Webninja's user avatar
  • 1,593
12 votes
3 answers
35k 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(); } ...
Codrain Technolabs Pvt Ltd's user avatar
0 votes
3 answers
1k 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 ...
Martijn's user avatar
0 votes
1 answer
319 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/...
kyegil's user avatar
  • 21
15 votes
3 answers
25k 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\...
Josh Davenport-Smith's user avatar
1 vote
2 answers
2k 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 ...
vedu's user avatar
  • 867
9 votes
3 answers
3k 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\...
Alana Storm's user avatar
  • 44.4k
1 vote
1 answer
574 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 ...
jstuardo's user avatar
  • 609
0 votes
2 answers
326 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:...
Inna Beschastnaya's user avatar
5 votes
1 answer
638 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 ...
James Anelay - TheExtensionLab's user avatar
1 vote
1 answer
4k 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): ...
Ricky.C's user avatar
  • 2,182
0 votes
1 answer
260 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?
zhartaunik's user avatar
  • 3,846
15 votes
7 answers
16k 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 ...
sivakumar's user avatar
  • 287