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.

1
vote
1answer
19 views

How to show Recently Searched Products without using Widget on HomePage (Luma). Magento2

I want to show recently searched products on homepage without using Recently Viewed Products Widget I want to get this in my custom block and also want to show this in my custom phtml file how it ...
4
votes
3answers
3k views

Magento 2: How to add Custom CSS/JS that will load last among other CSS/JS files

I need to override CSS/JS that will override the styling and I need it to load the last part among other CSS files link like: <head> <title>Home page</title> <link rel="...
0
votes
2answers
742 views

Overriding Magento Sitemap Model Class

I try to override Mage_Sitemap_Model_Resource_Catalog_Product class. Here is my files: File \magento\app\etc\modules\Own_Sitemap.xml <?xml version="1.0" encoding="UTF-8"?> <config&...
0
votes
0answers
18 views

Edit a phtml file exists in adminhtml

I want to edit the invoice from adminhtml, so what is the best way to edit a phtml file in adminhtml folder?
3
votes
1answer
29 views

Magento 2 - Argument 2 missing error on overriding file

I am trying to override Magento\Catalog\Block\Category\View added this code in di.xml <preference for="Magento\Catalog\Block\Category\View" type="Naheed\AllProducts\Block\Category\View" /> ...
2
votes
1answer
805 views

Overriding Magento\Catalog\Model\Layer class not working in Magento 2

Overriding Magento\Catalog\Model\Layer class not working in Magento 2. I'm trying to create a custom module for showing custom product collection with layered navigation. here i added di.xml file to ...
11
votes
1answer
374 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 ...
1
vote
1answer
25 views

Magento 2: Overriding a protected function that implements another interface

I want to override the addDefaultAttributes function in /vendor/magento/framework/View/Page/Config/Renderer.php to remove the type="text/javascript" it inserts into the js meta tags. I have tried to ...
0
votes
3answers
39 views

How to override protected function Magento 2?

i want to edit this function in Magento\Eav\Model\ResourceModel\Entity\Attribute.php protected function _updateDefaultValue($object, $optionId, $intOptionId, &$defaultValue) { if (in_array($...
0
votes
0answers
10 views

How do I override an html file located in the admin seccion? [duplicate]

I'm using the new Magento 2.3 pagebuilder and i'm trying to add a "span" tag inside a button of the banner/poster of the pagebuilder. I found out where I can change the pagabuilder view on my ...
2
votes
2answers
810 views

Custom Contact Form - Override Controller

I am trying to add a contacts form on multiple cms/products pages. I copied the default contacts form phtml and pasted it into a new phtml file. However, submitting the form redirects to the contacts ...
2
votes
1answer
57 views

Override abstract class

I have to override Sender.php which path is Magento\Sales\Model\Order\Email I try but its not work my code is : di.xml <type name="Magento\Sales\Model\Order\Email\Sender"> <plugin ...
2
votes
2answers
597 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. ...
7
votes
1answer
90 views

Magento 2.3.1 override view.xsd Using Plugin Not working before 2.3.1 it's Working

I am trying to override view.xsd using Plugin and it's working on magento 2.1.x and 2.2.x but not working in 2.3.1. I Add Same code To describe Here. Extending the complexType named "imageType&...
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/...
3
votes
1answer
23 views

Magento 2 override /lib html file [duplicate]

I am trying to override an html file in the lib folder, but I cant get it to work. Here is what I have so far: Path to file I want to override: /lib/web/mage/gallery/gallery.html Path to file I want ...
1
vote
1answer
25 views

Captcha Helper method override not working in Magento2

Need to override method getImgUrl() from vendor\magento\module-captcha\Helper\Data.php but not success app/code/YourCompany/YourModule/etc/di.xml <config xmlns:xsi="http://www.w3.org/2001/...
3
votes
2answers
930 views

How to override layout file, which is already override by other theme - layout\override\base\somel_ayout.xml

How to override layout file, which is already override by other theme. For example, we have existing theme. app\design\frontend\<Vendor>\<themeone>\Module_Vendor\layout\override\base\...
1
vote
0answers
16 views

Incompatible argument type: Required type: \Magento\Framework\Stdlib\StringUtils

I want to override below block file /var/www/html/dg/vendor/magento/module-gift-card/Block/Sales/Order/Item/Renderer.php I made this file /var/www/html/dg/app/code/Drummondgolf/Orderemail/Block/...
1
vote
1answer
70 views

Magento 2 Seo title product override not working

I overrided the Magento\Catalog\Block\Product\View.php adding this code protected function _prepareLayout() { parent::_prepareLayout(); $this->pageConfig->getTitle()->set($title . '- ...
7
votes
5answers
4k views

How to override final_price.phtml in magento 2?

I want to override final_price.phtml, I have tried following in my module but it is not working. I have created app/code/MyVendor/MyModule/view/frontend/layout/catalog_product_prices.xml <layout ...
0
votes
0answers
18 views

How to add custom method in product interface.And how to overide productinterface and product model

I want to add custom method in product interface and override product interface and product model.
3
votes
0answers
297 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
910 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
0answers
37 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
639 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
72 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
24 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
347 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
34 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
20 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
992 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 ...
2
votes
1answer
123 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
638 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
787 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
2k 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
28 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
79 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
19 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
46 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 ...
1
vote
1answer
41 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
69 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
28 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
36 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
204 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 ...