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
65 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
17 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
11 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
30 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
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) { $...
0
votes
1answer
31 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
68 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
19 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
23 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
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 {$...
2
votes
2answers
75 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
45 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
61 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
39 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
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
77 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
40 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
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 /...
0
votes
2answers
88 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
26 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
47 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
125 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
55 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
26 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
197 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
85 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
44 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
84 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
27 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
16 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
31 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
44 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
20 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
91 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::...
1
vote
4answers
110 views

Need to override edit.phtml on cart page to add new button near it

I need to add new button near edit button on cart page. I want o override edit.phtml in my custom module. Can someone guide me how to achieve this? vendor/magento/module-checkout/view/frontend/...
0
votes
0answers
43 views

Magento 2. How to Override Search (CatalogSearch)

I want to hide the specific product which I select from Configuration using Categories in the Search. e.g if I select Gear Category in configuration then If I search the Product of the Gear I want to ...
4
votes
2answers
62 views

Magento 2 : How to override files from Magento core framework?

Actually I'm refering to #19247 for PHP 7.2 specific issue. that partially solved my issue but can't able to override that file. I tried using preference here's what I tried. <preference for="...
0
votes
1answer
28 views

Override javascript with self-minified versions

We tried enabling the built-in minification and javascript merge functions, but some functionality of third-party modules/plugins stopped working. So something is in conflict between how magento is ...
0
votes
1answer
65 views

Override core files in Magento 1.9.4 (Varien.php)

What would be the most appropriate structure of the module in order to rewrite function validate() at app/code/core/Mage/Core/Model/Session/Abstract/Varien.php The idea is to rewrite that block ...
1
vote
2answers
54 views

Magento 2: Layout override sequence custom theme vs extensions

I created a custom storefront theme and override the catalog_product_view.xml file in my custom theme. Below is the path. app\design\frontend\Akhilg\custom\Magento_Catalog\layout\catalog_product_view....
0
votes
1answer
22 views

Magento 1.9 overwrite core

Is it possible to overwrite Magento core functionality in this way? - Mage_Sales_Block_Order_Total { protected function _initTotals(){ //this is core } } and overwrite it with this - ...
0
votes
0answers
11 views

Magento 2 Override Unit.phtml and Row.phtml in Magento_Checkout

I am trying to override both unit.phtml and row.phtml within my Magento_Checkout module. I am doing everything that I would normally do but it doesn't seem to be overriding like the other phtml files. ...
1
vote
1answer
145 views

Magento 2 Override Gallery.php file

I would like to override /vendor/magento/module-catalog/Block/Product/View/Gallery.php file getGalleryImagesJson function In result I would like to get - public function getGalleryImagesJson() { ...
1
vote
1answer
64 views

How to add sub-menus to Magento admin dashboard in Magento2.2.5?

How to add sub-menu to Magento admin dashboard in Magento 2.2.5? I need to override the vendor file. Refer my Screenshot. Any help would be appreciated.