Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [overrides]

Questions about overriding core features (class rewrites, local code pool, theme overrides). For URL rewrites, use the "url-rewrite" tag instead.

3
votes
0answers
292 views

Magento2 : Override Admin Js file

I am working on Magento 2.1 CE. My current active Theme is the Default LUMA Theme I wish to override the CORE Modules "bundle-input-type.js" located in "vendor\magento\module-bundle\view\adminhtml\...
1
vote
1answer
900 views

Magento2 how to override collection

I've just been working with Magento2 for 1 week. There are many things that made me confuse. I want to build a grid that show information from "directory_country_region" table but show only for "...
0
votes
1answer
24 views

Magento2.3.0 How to overrite Customer this file Magento\Customer\Controller\Account

Please if anyone know how to override this file in our theme please reply me "Magento\Customer\Controller\Account" creatPost.php file This is my Mageplaza/HelloWorld/etc/di.xml <config xmlns:...
0
votes
2answers
614 views

How Can Override Block (\Magento\Catalog\Block\Product\View\Options\Type\Select.php)

<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference ...
1
vote
3answers
65 views

Magento 2: How to override theme LESS styles within custom module

I am running Magento 2.3 on Ubuntu 18.04 server with Apache 2.4, MariaDB and PHP 7.2. Magento is running in developer mode. I have created a custom theme which inherits from the Magento/blank theme. ...
1
vote
2answers
22 views

Declaration of overridden method should be compatible with parent class

This is my custom class: class Collection extends \Magento\CatalogSearch\Model\ResourceModel\Search\Collection { public function _getSelectCountSql($select = null, $resetLeftJoins = true) { $...
2
votes
5answers
321 views

Magento 2: How to override the model?

How to override the model: vendor/magento/module-Customer/Model/Address/AbstractAddress.php For removing the validation of the last name. What can I do? I have already overriden this file using the ...
0
votes
1answer
29 views

In magento 2 how to override stock availability in product detail page in custom module

In magento 2 how to override stock availability in product detail page in custom module app/code/Vendor/Module/view/frontend/layout/catalog_product_view.xml <?xml version="1.0"?> <page ...
1
vote
1answer
18 views

Are there any restrictions on classes you can override with preference in di.xml

When overriding a class with a custom one using the di.xml, are there any restrictions on what class you can override? I have tried overriding a class of a third party module, but it does not appear ...
3
votes
2answers
964 views

Override method in LayoutProcessor

I want to make changes(PHP code) to the method processPaymentConfiguration, but I don't know how I can override the method so my changes have a higher priority. I can alter the LayoutProcessor file ...
4
votes
1answer
1k views

Magento2.1: How to override the template in custom module?

I want to create an extension that will give shop owners ability to edit their product image. So I understand I need this template Magento/ProductVideo/view/adminhtml/templates/helper/gallery.phtml I ...
11
votes
0answers
339 views

How to override a static method in Magento2

Plugin Interceptors and overriding with preference does not work on static methods. Need to override getOptionArray method in Magento\Catalog\Model\Product\Visibility to return a custom visibility ...
2
votes
1answer
119 views

override base template file in adminhtml [Magento-Ui backend]

I created custom grid module using ui component layout In that i want to add new button near to filter button. That new button should functions like action drop down function i.e capture all ...
1
vote
1answer
595 views

Magento 2.2.5: Overriding Admin Controller sales/order

I need to override Admin sales/order/index controller, but still getting 404. Below the Steps I take to override - Created My Custom Module app/code/A2bizz/Order/registration.php <?php \Magento\...
2
votes
1answer
759 views

Magento 2 : Override front-end router

I try to override a router, and I encounter some difficulties. I try an override in the following way: In my module2 DI : namespace2/module2/etc/di.xml <?xml version="1.0"?> <config xmlns:...
0
votes
1answer
1k views

Override base/ui_component/customer_form.xml

I'm trying to override the following file and I need the changes to show in adminhtml. vendor/magento/module-customer/view/base/ui_component/customer_form.xml I have copied the file to the location ...
0
votes
1answer
22 views

Override SenderBuilder class to add Bcc when sending invoice

I didn't found an event when invoice email is sent, so i tried to override Magento\Sales\Model\Order\Email\SenderBuilder class, the override is working but getting the customer attribute invoice_email ...
3
votes
2answers
2k views

How to override cart\addcontroller in magento 2?

I want this function in \code \StwBuyXGetY \BuyXGetY \Controller\Checkout\Cart\Add.php(this is written in magento 1.9, I want to convert it into magento 2). But I cant add any new function in add ...
0
votes
1answer
1k views

Override Newsletter Subscriber Controller - not working

I realise, there are several Questions that are basically the same - with solutions. Sadly, I still can't figure out what is wrong. Problem: I'd like to extend the ...
2
votes
2answers
71 views

Magento 2 - Override a helper using plugin

What is the best practice to override a helper? is it through Preference or Plugin? And how can I override a helper using Plugin?
0
votes
0answers
17 views

Not able to rewrite file BaseFinalPrice.php from vendor dir

I want to rewrite getQuery() from vendor\magento\module-catalog\Model\ResourceModel\Product\Indexer\Price\Query\BaseFinalPrice.php i want to change "{$specialPrice} IS NOT NULL AND {$...
1
vote
2answers
42 views

How to override post-code.js which is in vendor/module-ui?

For testing purpose, we have modified the core file post-code.js which is in the path /vendor/Magento/module-ui/view/base/web/js/form/element and see it's working fine. So we have decided to override ...
0
votes
3answers
1k views

Magento 2, minicart, change “Go to Checkout” text to “Checkout” only

I have been trying to change Go to Checkout text to Checkout in mini cart in Magento 2. I have new theme applied and placed override file as follows: app/design/frontend/Darkmage/newtheme/...
1
vote
1answer
36 views

third party module controller overriding not working in magento 1

my config.xml <?xml version="1.0"?> <config> <modules> <Mindtwo_Formbuildercrfprotection> <version>0.0.1</version> <depends&...
1
vote
2answers
1k views

In a custom module I override the cart item template

How do I correct my code to fix this? In my custom module I have the file app/code/MyCompany/MyModule/view/frontend/layout/checkout_cart_item_renderers.xml with the following code: <?xml version="...
2
votes
3answers
54 views

How to override Magento 2 framework file?

I try to override this file : vendor/magento/framework/View/Element/Html/Link/Current.php I create a module.xml, registration.php and di.xml <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-...
0
votes
2answers
2k views

Magento 2 : Override layout.xml File Within Custom Module

Looking at the Magento 2 docs, you can override a base/core layout.xml file - http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/layout-override.html Is it possible, to overide within ...
0
votes
0answers
27 views

Magento2: unable to call catalog_product_view_type_downloadable.xml in magento2?

I have override the catalog_product_view_type_downloadable.xml in my module as MyVendor/Downloadable/view/frontend/layout/catalog_product_view_type_downloadable.xml But unable to call the changes ...
0
votes
1answer
31 views

Magento 2 how to override the admin user's grid

I am trying to add new custom field in admin user's grid but it's not in UI components. They are generating grid with data object in Magento\User\Block\User. Can any one please provide the solution to ...
0
votes
2answers
190 views

Magento 2.2 Override Sales Invoice attachment files

We need to override following files in custom module. /data/magento2/vendor/magento/module-sales/Model/Order/Pdf/AbstractPdf.php /data/magento2/vendor/magento/module-sales/Model/Order/Pdf/Invoice.php ...
0
votes
2answers
211 views
2
votes
2answers
49 views

Best pratices to update the module-checkout

I want to add some custom text test to my mini top cart in my theme header section. I see it is located here: public_html/m2/vendor/magento/module-checkout/view/frontend/templates/cart/minicart.phtml ...
0
votes
0answers
37 views

How to override app/code/core/Mage/Core/Controller/Varien/Router/Admin.php?

I want to override core class of Magento 1: app/code/core/Mage/Core/Controller/Varien/Router/Admin.php How I can do that?
1
vote
1answer
76 views

Magento 2 - Override template files in module

What is the correct way to override a template file ? I need to display custom text in place of In Stock and Price on the product page. I want to override the template - Magento_Catalog/view/...
0
votes
0answers
25 views

Unable to override model class, only this file has problem

I am overriding Worldpay Model class that create xml request file. <?xml version="1.0" encoding="UTF-8"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
1
vote
2answers
48 views

How to remove the action of a menu.xml item?

I have a menu.xml like this: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu....
1
vote
1answer
227 views

How to override JS with my custom theme?

I am trying to overwrite the module-catalog/view/frontend/web/js/catalog-add-to-cart.js file, I have added the file to app/design/frontend/Magento/theme_fresh/Magento_Catalog/web/js/catalog-add-to-...
1
vote
1answer
150 views

Override form.phtml in own module

I want to override following file in my custom module: module-sales/view/adminhtml/templates/order/create/shipping/method What I did so far: magento/app/code/view/adminhtml/layout/...
1
vote
1answer
580 views

magento 2 how i override the config save controller adminhtl?

magento\vendor\magento\module-config\Controller\Adminhtml\System\Config\Save.php how i override this controller in the magento 2
1
vote
1answer
1k views

How can override shipping API interface in Magento2

I need to override below two core file of vendor folder : vendor/magento/module-quote/Api/Data/ShippingMethodInterface.php vendor/magento/module-quote/Model/Cart/ShippingMethod.php file to my code ...
2
votes
2answers
1k views

Magento 2 override the product collection(Magento\Catalog\Model\ResourceModel\Product\Collection.php)

We want to override the product collection model class(Magento\Catalog\Model\ResourceModel\Product\Collection.php) We flow the below process to override the addAttributeToSort method but not working. ...
0
votes
1answer
614 views

Rewrite customer API not working

I can't get this small extension for rewriting Mage_Customer_Model_Customer_Api to work. My files: /app/etc/modules/EnaDva_CustomerInfoApi.xml <?xml version="1.0"?> <config> <...
0
votes
0answers
39 views

Override __construct Magento\Catalog\Model\Product

I have overrided the Magento\Catalog\Model\Product. When I create a new function, I can access it with $this->_currentProduct->myNewFunction() in my code. But, in my new function, I need to ...
4
votes
1answer
622 views

Override Wishlist view.phtml from custom module not working

I tried to override wishlist view.phtml which loaded at customer account page like this: app/code/Test/Salesman/view/frontend/layout/wishlist_index_index.xml <?xml version="1.0"?> <page ...
3
votes
3answers
705 views

Magento 2 : Override crontab.xml

I need to override a crontab.xml from: vendor/magento/module-integration/etc/crontab.xml <job name="expired_tokens_cleanup" instance="Magento\Integration\Cron\CleanExpiredTokens" method="...
3
votes
1answer
588 views

[Solved]Cannot override Pdf/Total/Default.php model

Good morning everybody! I have a problem trying to override the model app/code/core/Mage/Sales/Model/Order/Pdf/Total/Default.php with app/code/local/Mycompany/Sales/Model/Order/Pdf/Total/Default.php. ...
1
vote
0answers
14 views

Product page (Related.php) error in Magento 2.1.16

I override the page Related.php and add my extra custom function in this class it works perfectly on 2.2.X but in 2.1.16 it shows me this error Warning: Invalid argument supplied for foreach() in /...
3
votes
1answer
646 views

Magento 2 override Pricing\Price\ConfigurablePriceResolver how to solve?

Hi I'm using Magento 2. I'm trying to override Pricing\Price\ConfigurablePriceResolver by adding a plugin or preference in the app/code folder but I can't make it work. I need to replace the ...
0
votes
2answers
83 views

How to rename the product detail tab title, and display as the last tab?

How to rename the product detail tab title, and display as the last tab? This is what i added, but didn't make any effect. the file is at the following location: /app/design/frontend/Infortis/...
3
votes
2answers
3k views

How to modify/update cart success message in Magento 2?

I want to modify/update the success message added by cart controller (Magento\Checkout\Controller\Cart\Add). As described here and here, I can use preference to override controller to update success ...