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
15 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 ...
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" /> ...
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
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 ...
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($...
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 ...
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 ...
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&...
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/...
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 . '- ...
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.
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/...
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:...
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) { $...
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
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
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 ...
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 ...
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 {$...
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?
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 ...
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
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
0answers
41 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?
0
votes
0answers
26 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
49 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
78 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
54 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 ...
1
vote
0answers
16 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 /...
0
votes
2answers
100 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/...
1
vote
1answer
29 views

How to override or extend template and layout files for an extension downloaded by composer?

I have an extension that is downloaded through composer, there are two files i would like to update. How to I override/extend the files? what is the correct paths i need to create in app/design/...
0
votes
1answer
36 views

What happen when two module override same file?

I am coming from Wordpress development & now I started Magento module development. I am following this tutorial. I am just trying to add social sharing buttons to the product edit page. ...
2
votes
2answers
48 views

Magento 2 : How to override a custom module which install via composer?

I have installed one custom module using composer as usually that module was installed in vendor directory is there any way to override phtml file in the same module like name but on app/code module ...
1
vote
2answers
135 views

Magento 2: Override XML file from vendor folder to app folder doesn't work/update

I tried to override the XML file by copying the file from vendor/magento/module-catalog/view/frontend/layout/catalog_category_view_type_default.xml to app/design/frontend/Infortis/base/...
1
vote
1answer
59 views

Magento 2.3 - extending layouts in custom theme

In Magento 2.* we could extend core layouts using custom theme, for instance, (assuming our custom theme is named Custom/our_theme) if we want to remove header & footer in customer login page we ...
0
votes
0answers
27 views

Magento 2 : How to override a Abstract Class? [duplicate]

I made some modification related to magento2 order pdf. I want to know how to override a abstract class AbstractPdf extends \Magento\Framework\DataObject
1
vote
0answers
18 views

New to Magento 2 - Is it possible to change every product price every minute?

I work in -precious metal industry- where item prices change every minute based on markets. At the basic level, UnitPrice=MarketPrice+Premiums per tier. My questions are: If we want to import ...
1
vote
1answer
272 views

How to override Customer registration fields to custom module in magento 2

I want to override Customer registration Fields to my custom module i copied the /public_html/vendor/magento/module-customer/view/frontend/templates/ and Layout to app/design/vendor/child_theme/...
2
votes
1answer
92 views

Magento 2.3 - Overide \magento\zendframework1\library\Zend\Locale\Data\xx.xml

Is there anyway to override and not change directly the \magento\zendframework1\library\Zend\Locale\Data\xx.xml ? This is so that I can change the decimal denoter from "," to "." for stores that ...
2
votes
1answer
45 views

Call to helper of module not change the Mage_ prexif by my module prefix

I have changed my etc/system.xml and my etc/config.xml with the structure which should replace the Mage_JaviNewListProductController_Helper_Data by Lecasa_JaviNewListProductController_Helper_Data. I ...
2
votes
0answers
102 views

How to override Magento_ConfigurableProduct/js/configurable.js

I'm following this instruction to override "Magento_ConfigurableProduct/js/configurable.js" but it doesn't work. I'm following this link: https://magento.stackexchange.com/a/131852/70258 After i ...
1
vote
1answer
29 views

Magento 2 in SEO Checker - “The Accessible Index Page is Configured wrong”

So I run our site (on Magento 2.2.3) thru an SEO checker and it flagged up an interesting issue: The Accessible Index Page is Configured wrong. Search engines see your https://www.xyz.co and https://...
1
vote
0answers
17 views

How many ways are there to create a controller and what are they?

I have been developing with Magento 1.9 for the last two weeks. I have found several problems to develop each project (probably because my first project with magento had a high level...). I come ...
0
votes
0answers
36 views

Payment Method Overwrite [duplicate]

I want to add new field in my payment method. I have added the field in phtml file in module but now I want to rewrite the file in my module. How can I achieve that?? Also let me know how to rewrite ...
1
vote
1answer
32 views

Rewrite phtml file and js file in Magento 2

Currently, I have cc card HTML in MyModule/Testing/view/frontend/web/template/form.html I want to rewrite this to phtml file with my module and js in web/js folder. How can I achieve that?
3
votes
1answer
47 views

Override OnepageController.php Not Working

I'm trying to override the successAction in the app/code/core/Mage/Checkout/controllers/OnepageController.php. I have done the following: I've created my override folder here: app/code/...
2
votes
2answers
26 views

Whats the best way to override a block class in magento2

1) Use preference in di.xml and add new methods or do changes 2) Or create a new class which extends the actual class and attach the new class to your phtml. Lets suppose you want to extend Magento\...
1
vote
1answer
21 views

Magento override Catalog Compare controller doesn't work

for some reason the Compare controller override doesn't work for me, I tried about everything I could find, but it just doesn't happen and I am running out of ideas. Do you see anything I am doing ...
0
votes
2answers
122 views

Modify product collection in M2

I am overriding Magento\Catalog\Block\Product\ListProduct In function _getProductCollection I have added some extra code. public function _getProductCollection() { $collection = parent::...