Questions tagged [overrides]

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

279 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
16
votes
3answers
2k views

Adding a new method to an Abstract Class in Magento 2

Like this thread said: Override abstract class in Magento 2 in Magento 1, I can just create a full new class. In Magento 2, we need to use plugins, but plugins only allow me to modified existent ...
6
votes
0answers
491 views

How to override class Virtual Type class

I saw this, but it don't work for me. How to override Virtual Type class in Magento 2 <virtualType name="categoryFilterList" type="Magento\Catalog\Model\Layer\FilterList"> <arguments>...
5
votes
0answers
804 views

Magento 2 -Override tax functionality to calculate tax on cost instead of price

I have checked below mentioned files to override tax functionality: \vendor\magento\module-tax\Model\Sales\Total\Quote\Tax.php \vendor\magento\module-tax\Model\Sales\Total\Quote\CommonTaxCollector....
5
votes
1answer
170 views

Overriding Magento 2 core js function

I need to override the 'loadArea' and 'loadAreaResponseHandler' magento core js functions in the file module-sales/view/adminhtml/web/order/create/scripts.js. I tried to use mixin property. Following ...
4
votes
3answers
1k views

How to 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="...
4
votes
2answers
1k 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 ...
3
votes
0answers
26 views

I want to rewrite phtml file in module-grouped-product

I am trying to rewrite the phtml file but it's not working my code is : a main file path is public_html/vendor/magento/module-grouped-product/view/frontend/templates/product/view/type/grouped.phtml ...
3
votes
0answers
40 views

Magento 2 Can We override **Add New Product** Page ? in custom_module on frontend area?

I want to make a custom page where vendor can add New Product with all text fields which Magento provide from the backend. I want to override this same page on my custom module on the frontend side. ...
3
votes
0answers
233 views

Magento 2 theme HELP

Not long ago I made my first Magento 2 custom/child theme so that my website changes won't be erased when I upgrade to another version. I now want to override some core Magento 2 files that I need ...
3
votes
1answer
115 views

How to Override custom module Model in custom module Magento 2?

I have two Modules in app/code. Xyz_Xyz - Module that already exists. I can't change its file. Abc_Abc - Module that I creating to override Xyz_Xyz Model. The code I try is here. app/code/Abc/Abc/...
3
votes
0answers
312 views

No Way to Clear/delete a Selected Image using Media Browser on category edit page

With reference to this Q&A there's another question. How do I clear the image selected using the Media Browser on category edit page in the admin Panel? Here's what I tried: in app/code/...
3
votes
1answer
908 views

Magento2 rewrite: product resource collection class does not effect on functions

I have rewrite catalog product resource collection Magento\Catalog\Model\ResourceModel\Product\Collection. Class override successfully but functions override is not working. Suppose, i want ...
3
votes
2answers
1k 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\...
3
votes
0answers
316 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\...
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 ...
3
votes
2answers
626 views

How to rearrange the links available in header in magento 2.0.2?

To Rearrange the Header links(ie to bring the My Wishlist link at last)in magento 2.0.2 (parent-theme:blank) I just overrided the default.xml file in vendor/Magento/module_wishlist/view/frontend/...
3
votes
1answer
235 views

How to avoid duplicate code error while upload extension on Magento marketplace

I have developed a module which extends customer registration feature. In this module, I have overridden two controllers 1. \Magento\Customer\Controller\Account\EditPost I have added custom method ...
2
votes
1answer
37 views

How to add label to street fields in Customer registration in admin panel?

I want to add two more Labels Colony and Area after Street Address.How can I achieve this ?
2
votes
0answers
39 views

How to override lib/web/mage/validation.js in Magento 2.2.8?

In order to override lib/web/mage/validation.js in Magento 2.2.8 ? I have tried this way but not working. app/design/frontend/STORE/THEME/web/mage/validation.js Edited : it was due to custom theme!...
2
votes
3answers
498 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-...
2
votes
1answer
153 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
73 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
235 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 ...
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\...
2
votes
0answers
52 views

ConfigurableProduct: How to get the configurable products out of stock?

I want to show all the attributes from my configurable product on my select. I followed this tutorial: Magento 2.2 How to show out of stock in configurable product, with some changes and fixes. So, I ...
2
votes
0answers
170 views

How to override Magento 2 welcome email upon new customer account creation

I need to customize default Magento welcome email template which is sending upon new customer account creation in my custom module. I'm using the following functions for sending welcome email upon ...
2
votes
0answers
80 views

Magento 2 plugin not working for CommonTaxCollector model

I want to overwrite mapItem function which is under the CommonTaxCollector class. So, I have done this but getting undefined error. Uncaught Error: Call to undefined method Magento\Tax\Api\Data\...
2
votes
2answers
509 views

Magento 2 : override phtml file issue

I faced problem with overriding a phtml file in Magento 2. I want this:- (1) Core Module of phtml Override By Custom Module called - A (2) Same phtml file of Module - A Override By Some Custom ...
2
votes
1answer
476 views

How to override a CLI command?

I'd like to know if I can override a CLI, specifically the bin/magento setup:upgrade. I want to override the class Magento\Setup\Validator\DbValidator, the method checkDatabasePrivileges.
2
votes
1answer
503 views

Magento 2 : AdvancedSalesRule override validate method

I need to validate custom quote item details, So I am overriding module AdvancedSalesRule "\Magento\AdvancedSalesRule\Model\Rule\Condition\Product" file. But Not getting quote item Id in model object. ...
2
votes
0answers
39 views

Override magento 2 default files

How to override default magento 2 file vendor/magento/framework/Reflection/ExtensionAttributesProcessor.php in my custom module.
2
votes
1answer
604 views

“message”: “Property \”Slots\“ does not have corresponding setter in class \”Magento\\Quote\\Api\\Data\\CartItemInterface\“.”

am using Webkul_BookingSystem extension for booking slot in magento2.1.7. The issue what I got here: While I add the product details in to cart through Rest API the Slot class showing does not have ...
2
votes
0answers
196 views

Override class in setup:upgrade command in magento2

I am trying to override the class FilePermissions (magento/framework/Setup/FilePermissions.php) but my changes are not taken in account while I use the bin/magento setup:upgrade I tried : To add a ...
2
votes
0answers
148 views

In Magento2 what is the place to override the quote?

In Magento2, I want to modify the Quote. I want to add some custom attributes to the items and change the order of the items. At what level should it be done, Model, Controller, Block? Please, ...
2
votes
2answers
157 views

Can't override recent order template from custom module

In customer account dashboard there's a recent orders block, i tried to override it like this: app/code/Test/SuccessPage/view/frontend/layout/customer_account_index.xml <?xml version="1.0"?> &...
2
votes
2answers
1k views

Why my overriding of the success.phtml is not working?

I have copied and pasted the file from vendor/magento/module-checkout/view/frontend/templates/success.phtml to app/design/frontend/THEME/THEMENAME/Magento_Checkout/templates/success.phtml ...
2
votes
1answer
173 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 ...
2
votes
1answer
445 views

Override summary.phtml template

I want to override the summary.phtml template (vendor/magento/module-review/view/frontend/templates/helper/summary.phtml) with a custom module. The template is overridden in the catalog_product_view....
2
votes
1answer
889 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 ...
2
votes
1answer
120 views

How to override UpgradeData.php with Factory?

I need to override the UpgradeData Class from Catalog\Setup\UpgradeData But the constructor has factories in his arguments like CategorySetupFactory When I run setup:di:compile I got an error that ...
2
votes
0answers
61 views

How can I get Add products link on Backend Products Information Page

I need to add products from Backend Products Information Page, how can i get add products link on products information page.
2
votes
0answers
396 views

Magento2: Override Vendor Resource Model _afterLoad method

I am trying to override the _afterLoad methods of the vendor class Magento\Catalog\Model\ResourceModel\Product\Collection unsuccessfully. In my custom module I edited the di.xml in this way <?xml ...
2
votes
3answers
205 views

Limitations about override model entity

I thought I was quite familiar now with plugins and preferences to override built-in behavior of Magento 2. However it seems not, and I have a question, is there some particular technical limitations ...
2
votes
1answer
597 views

How to Override Payment Helper Data Method Magento 2?

I am trying to override Magento Payment Helper data in my extension but it's not working. I have overriden by using the preference method. I have put below code in app/code/Demo/PaymentTest/etc/di....
2
votes
1answer
199 views

Override block function

I want to filter wishlist product collection with a unique id. I have tried to override a method _createWishlistItemCollection located at the path /vendor/magento/module-wishlist/Block/AbstractBlock....
2
votes
1answer
73 views

Overriding class Magento 2.1

I'm trying to inject \Magento\Framework\Filter\FilterManager $filterManager Object to be able to use truncate fucnction in list.phtml $this->_filter->truncate($string, ['length' => $...
2
votes
0answers
376 views

How to proper extend variables and override module style?

I am new to Magento and currently developing a child theme inherited from the Magento blank theme. I read the developer documentation and doing okay. I created my own style.less in my web directory ...
2
votes
0answers
133 views

Edit backend in Magento 2

I've been trying to edit my backend, but without any results, does anyone know how, step by step? I've already try How to extend backend template files in Magento 2 Maybe I'm doing something wrong, ...
2
votes
1answer
159 views

Reverting block rewrite, how to set all child block elements

I had a custom page where I had to rewrite page/page.phtml, and inside the template file I needed some methods. So I had to rewrite the base class Mage_Page_Block_Html. This is how my module's layout ...