Questions tagged [overrides]

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

Filter by
Sorted by
Tagged with
49
votes
8answers
37k views

How to Override Core Block, Model and controller in Magento2

I'm stuck in overriding core model Blocks and controllers in Magento2. Can any one help on this? Let's take list toolbar as example where I need to add a new sort option called sort by most popular. ...
34
votes
2answers
45k views

Extending / Overriding JS in Magento 2

As Magento2 is using RequireJS for loading scripts, and there's no more skin folder, I've stuck with a problem: How can I replace Magento's module JS file by my modified version? For example — the ...
12
votes
4answers
10k views

Override abstract class in Magento 2

In Magento 1 I could copy abstract class to local or community directory and Magento used it, when autoload load this class. Is there some solution to make to Magento loads my class instead vendor/...
23
votes
5answers
9k views

How do I get a list of all class rewrites?

Is there a way to list all rewrites and maybe other potential conflicts besides reviewing all configuration files? I have to analyse some projects with lots of extensions and custom modifications and ...
13
votes
6answers
32k views

How to override .phtml files in Magento 2

I want to customize product details page, So it required to override some .phtml files in following locations. So I want to know, how to override .phtml files in vendor\magento\module-catalog\view\...
17
votes
3answers
13k views

Magento 2: rewrite controller

how can i rewrite a controller (that's actually an action) in Magento 2? I tried, as instructed here like this: I have my own module called Namespace_Module with a di.xml file, that is taken into ...
11
votes
3answers
13k views

How do I override/rewrite a block class in Magento 1?

Note: This is intended as a canonical question that fully explains how block rewrites work and can be used as duplicate target for more specific "How do I override block X" or "Why does my rewrite not ...
10
votes
1answer
7k views

Where do you put modified WSDL files for the API to override the core definitions?

We've updated the standard WSDL definitions to support bundled product attributes for sku_type and price_type. I've tried putting the updated WSDL and WSI files in app/code/local/Mage/Catalog/etc/, ...
11
votes
5answers
24k views

Magento 2: How to override mini-cart default template html file?

How to override /var/www/html/magento2/vendor/magento/module-checkout/view/frontend/web/template/minicart/content.html file in our custom theme?
12
votes
1answer
16k views

How to override the controller AccountController

I need to override a method Controller Core/Mage/Customer/controllers/AccountController.php and add a new method. Since this controller to edit is wrong - it should be overridden. According to ...
9
votes
3answers
9k views

Magento 2: How to override Luma Theme Home Page

I'm using Magento 2 CE Version 2.1.0 on WAMP Windows 10 I already referred Magento 2: How to override mini-cart default template html file? Would like to override Magento 2 Default Luma Theme I ...
5
votes
3answers
11k views

How to override an admin theme template?

I would like to override app/design/adminhtml/default/default/template/page.phtml i'm currently using an extension that overrides app/design/adminhtml/default/default/template/page/header.phtml with ...
4
votes
1answer
3k views

How to override adminhtml phtml in magento 2?

Does anyone know how to override the below template? vendor\magento\module-backend\view\adminhtml\templates\media\uploader.phtml.
9
votes
2answers
13k views

Overriding Blank Theme Styles in Magento 2

How would you go about overriding the navigation styles for a custom theme when inheriting from the blank theme in Magento 2? I have a theme.css file in my app/design/frontend/<Vendor>/<...
15
votes
1answer
15k views

How to override config.xml

I need to change contact us page email template type from "text" to "HTML". I found it is in the config.xml <email> <contacts_email_email_template translate="label" module="contacts">...
5
votes
3answers
12k views

Trying to override a controller

I am trying to override a Mage controller which is in Mage/Catalog/controllers/CategoryController.php. The folder structure which I created in trying to override the above controller is as follows: -...
4
votes
2answers
3k views

Magento 2 - How do I programmatically remove payment method?

I've followed the guide on the selected answer here: Payment method only admin Magento 2? But still no luck. What I want is to be able to show the Cash On Delivery method only to certain customers. ...
6
votes
3answers
7k views

Magento 2 : Override core Interface and Model

I am trying to override core interface of Customer Group. I add my custom get and set methods to core Api interface. Vendor\magento\customer-module\Api\Data\GroupInterface.php Where its working ...
12
votes
7answers
9k views

Changing “Add to cart” button text in Magento 2.1.0 ( Overriding js file )

I have changed "Add to cart" text to "I want this" by overriding "vendor\magento\module-catalog\view\frontend\templates\product\list.phtml". But, when I click on "I want this" (i.e. "Add to cart" ) ...
6
votes
2answers
2k views

How to override a Zend class?

I want to override a Zend class (Zend_Date). In Magento 1, I used to put Date.php in app/code/community/Zend and Magento itself used to do the rest. But now, there is no such directory. How can I ...
2
votes
2answers
4k views

Overriding Block in Magento 2

I'm playing overriding the blocks in magento 2, extended block constructor is calling but inside method is not working? my code is di.xml <?xml version="1.0"?> <config xmlns:xsi="http://...
13
votes
2answers
6k views

How to override or disable core Plugins in Magento2?

I am building a marketplace using Magento2. For that reason I need to be able to load the order of the customer using the vendor's customer credentials. The problem with this is that Magento2 uses a ...
3
votes
1answer
6k views

How to Override or Extend protected or parent function in Magento 2 using Plugin

I need to override protected function or parent function ex Magento\Checkout\Controller\Cart\Add is extended from Magento\Checkout\Controller\Cart and getBackUrl() is a Magento\Checkout\Controller\...
19
votes
4answers
13k views

How to override a HTML file using a custom module?

I'm developing a custom module for payment method in Magento 2. Currently, I'm using cc-form.html from vendor directory and module working fine. See below path: vendor/magento/module-payment/view/...
7
votes
2answers
5k views

Magento 1 : how to override/rewrite a core controller class?

Note: This is intended as a canonical question that fully explains how controller rewrites work and can be used as duplicate target for more specific "How do I override controller X" or "Why does my ...
6
votes
2answers
5k views

How to override observers in Magento 2?

I was trying to override execute function of Magento\CatalogUrlRewrite\Observer\ProductProcessUrlRewriteSavingObserver using preference in di.xml <preference for="Magento\CatalogUrlRewrite\...
10
votes
3answers
2k views

Magento 2 add new theme without changing core files. Grunt

How to extend default Magento 2 Grunt configuration without touching/editing core files like Gruntfile.js and dev/tools/grunt/configs/themes.js?
8
votes
4answers
17k views

Magento 2 : Override block file Magento\ConfigurableProduct\Block\Product\View\Type\Configurable.php

How to override function getAllowProducts() from Magento\ConfigurableProduct\Block\Product\View\Type\Configurable.php in magento 2. I want to override above function but not getting changes of ...
5
votes
2answers
967 views

How to exclude products being added to cart based on products attributes?

How can i set a condition, if pre-ordered products are purchased, no other products can be added to cart? How can I set a condition like, if some of the "non-pre-order" products is in the cart, ...
12
votes
3answers
17k views

Rewrite controller magento

I need to overwrite action called _initAction from Controller: /app/code/core/Mage/Adminhtml/controllers/Catalog/Product/AttributeController.php into my own module and controller: /app/code/local/...
7
votes
2answers
8k views

Overriding a core controller's preDispatch method

I need to override a core controller's preDispatch method. The core controller inherits from Mage_Checkout_Controller_Action, which itself has a preDispatch method that needs to be called. Since I'm ...
6
votes
2answers
5k views

How to override core class which is already overrided by other custom module in Magento 2

How to override core class which is already overrided by other custom module I have module1 and module2 overriding CatalogSearch module. in Module1 etc/di <preference for="Magento\CatalogSearch\...
5
votes
1answer
6k views

How to Override Mage_Checkout_Block_Links

What is the proper way to override a method, for example, the Mage_Checkout_Block_Links::addCartLink() method. My goal is to add some HTML before the Mage_Checkout_Block_Links::addCartLink() method. ...
3
votes
2answers
3k views

Override model function Magento 2

I want to override one of the function in Magento core model which is located in vendor\magento\module-sales\Model\Order\Email\Sender\OrderSender.php <?php /** * Copyright © 2016 Magento. All ...
0
votes
1answer
1k views

Magento 2 : Override Releted.php class file under Ui DataProvider folder

I just want to rewrite modifyMeta method on vendor/magento/module-catalog/Ui/DataProvider/Product/Form/Modifier/Related.php file and I have done following things in file but not succeeded. I have ...
8
votes
2answers
3k views

How to handle deprecated “Mysql4” classes when rewriting resource models

I have to rewrite Mage_Catalog_Model_Resource_Category_Flat. The old resource class Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Flat is still there in Magento 1.7 for backwards compatibility and ...
7
votes
2answers
2k views

AccountController override not working on new Action and doing 302 redirection

I am try add new action on AccountController Now: AccountController is override properly But it is whenever hit new Action (ajaxLoginPostAction) is redirect to 302. I add ajaxLoginPost() as open ...
4
votes
1answer
821 views

Magento 2: How to enable newly created admin theme & override module?

I'm using Magento 2 CE Version 2.1.2. I have followed Magento StackExchange Questions/Answer for this. Still having issues. I would like to Override Magento 2: How to override Adminhtml "...
3
votes
2answers
3k views

How to override html file in magento 2.1

I need to customize Magento_Checkout module. I have tried to copied that html files into my theme path but the override is not working Override path mentioned in below /app/design/frontend/Vendor/...
1
vote
2answers
510 views

Core/Local which is better?

I recently fell into an interesting argument. My question is when should we use the local codepool to completely overwrite a class and when should we use Magento class overrides extending a class. ...
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 ...
10
votes
2answers
18k views

How to overwrite core template files from a custom module?

I want to overwrite two files. Namely the view.phtml and print.phtml of sales orders. (path: app/design/frontend/base/default/template/sales/order/) I am creating a module in which I want to create a ...
17
votes
2answers
2k views

Rewriting Magento 2 classes vs Plugins

Magento 2 has the concept of Plugins/Interception/Interceptors opposed to Magento 1. These act like a before|after the event for every public method. Which is nice. You can also use the around plugin ...
9
votes
1answer
9k views

How to prevent module rewrite class conflict in Magento

I have a class rewrite problem in Magento Onepage Checkout as I have a custom module in the local code pool and a third party extension in the community code pool both extending the same class... I'...
6
votes
3answers
7k views

Magento2 - Override Magento/Checkout/view/frontend/web/js/view/shipping.js

How can we override Magento/Checkout/view/frontend/web/js/view/shipping.js file? I need to add some custom code to selectShippingMethod function so i can hide/show a block if a specific shipping ...
3
votes
1answer
3k views

Payment method only admin Magento 2?

When working with Magento 2, sometimes we want to disable Payment methods on the Front page and use it only for Admin. Or, if we want to set more rules for Payment methods to check whether payment ...
9
votes
2answers
4k views

Magento 2: How to override gallery.css?

I want to override lib/web/mage/gallery/gallery.less and some module files in lib/web/mage/gallery/module/*.less I need to override them because I want to change the style of product gallery images....
4
votes
2answers
3k views

Copy core file to app/code/local/Mage can't overload!

I have 2 files need to be overload core/Mage/Admin/Model/Session.php and core/Mage/Adminhtml/controllers/IndexController.php I already copy it to local with same structure, but the bad news is it ...
3
votes
1answer
3k views

How to overwrite lib template file - Magento 2

How can the HTML files from the library be overwritten? I need to overwrite this template: lib/web/mage/gallery/gallery.html I have tried placing the file in my own theme in the below locations, I'...
2
votes
1answer
2k views

Can not override Sales Resource Model Collection class

I am trying to override Mage_Sales_Model_Resource_Order_Collection My custom module's config: <?xml version="1.0" encoding="UTF-8"?> <config> <modules> <...