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
4
votes
2answers
3k views

How to override customerData folder's file in magento 2?

I want to override app/code/Magento/Checkout/CustomerData/DefaultItem.php file. Becuase i have to change in this file. So how can i override this file
4
votes
1answer
2k views

Magento 2: How to override Block file Configurable.php?

In magento 2, using Preference Configurable.php file is not simply override, Is this is magento 2 bug? I have override simply using preference method inside di.xml file but its not override. I want ...
4
votes
2answers
5k views

Rewrite a local Extension Module doesn't work

I want to rewrite a model from an extension in the "local"-folder. My Extension is also in the "local"-folder but it doesn't work and i have no clue what I'm doing wrong. The relevant part of the ...
3
votes
1answer
319 views

M2.1.9 : How to override the magento default .phtml file under vendor\magento\module-sales\view\frontent\templates\email\items.phtml

There. After success migration work, i need to handle devlopment work,ugh. I'm a mad newbie about Magento2 so could you let me know how to overwrite the default phtml file under vendor/magento .. ...
3
votes
2answers
417 views

Override vendor/magento/module-ui/view/base/web/js/modal/confirm.js Magento2

Can anyone help how to over ride vendor/magento/module-ui/view/base/web/js/modal/confirm.js file in theme. Thanks
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
2answers
3k views

Overriding Contact Controller - No difference

After running through every tutorial on the internet about overriding core controllers I resort to posting here. Magento: 1.9.1.1 community Namespace: Tft Module Name: Customcontact Files: /app/...
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
1answer
2k views

Magento 2 : Overide Magento\Catalog\Block\Product\View\Gallery Block

I am working on custom extension and need to override Magento\Catalog\Block\Product\View\Gallery block. I have followed this method. In di.xml, <preference for="Magento\Catalog\Block\Product\...
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
2answers
516 views

Rewriting resource model

I am trying to follow the answer of this question Avoiding memory exhaustion when updating product stock? to rewrite a resource model. I created a custom module and is activated in the back-office. ...
2
votes
1answer
3k views

How to override magento-checkout CustomerData/Cart.php?

I need some changes in CustomerData/Cart.php to have child products added to cart displayed in minicart. Can I make this overrides inside my Theme Folder. I would not like to have my changes smashed ...
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
1answer
2k views

Overwrite community Model file?

I use the extension by raveinfosys to export orders from Magento. I changed some stuff in the ordering of the items, but I do not want to do this in the extension itself. I want to do it with an own ...
2
votes
1answer
71 views

Overwrite admin controller in version 1.6

I am trying to overwrite the controller located at: app/core/code/Mage/Adminhtml/controllers/Catalog/ProductController.php First of all I tried just making a copy in my local code directory app/local/...
2
votes
1answer
2k views

Extending an abstract block class

I'm modifying getCountryHtmlSelect() through a custom class that extends another core class that extends Mage_Checkout_Block_Onepage_Abstract. Here's the class with the customized code: local/...
2
votes
1answer
118 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
1answer
3k views

How to override cartcontroller in magento 2?

I want to override cartcontroller(checkout/controller/cart.php) by my module controller. Can anyone help me please? Any help will be appreciated. I just tried, But it is not working. My files are, \...
2
votes
1answer
1k views

Rewrite Admin Newsletter Grid

I am trying to rewrite Grid in Magento Admin for Newsletter Subscribers. I am using code below to rewrite Grid in Custom module: config.xml (only required part is added) <global> <...
1
vote
2answers
1k views

Overriding Block issues?

I want override Block Magento\Catalog\Block\Product\View\Gallery this is code in file di.xml Edited <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...
1
vote
1answer
640 views

Rewrite catalog_product_review controller does nothing

I tried rewrite catalog_product_review controller in admin but failed. I'm not aware of problem. Does anyone know problem maybe help me? Thanks config.xml: <config> <modules> ...
1
vote
1answer
1k views

How can you override Mage_Adminhtml_Controller_Action

Specifically I'm interested in potentially overriding _isAllowed() so that it defaults to false instead of true. Most of the things I've found related to overriding controllers deal with how to ...
1
vote
1answer
2k views

Class rewrite extends block but without access to it's private functions

I've had to re-write a block of a third party module, I only want to re-write one function in the class but my re-write won't work unless I copy across the private functions from the class I extended. ...
1
vote
2answers
2k views

Adding custom method to product collection

What is the best way to add some method to for example product collection? I would like to add method which can be called on loaded collection (in fact it will be a filtering one for products that ...
1
vote
4answers
1k views

Overriding Mage_Catalog_Model_Product_Type

I am trying to override a model file. The file location is: core/Mage/Catalog/Model/Product/Type.php I am trying to show only simple products when creating a new product but it is not working. ...
1
vote
3answers
2k views

Overriding Block class from extension

I need to override a Block from an external extension. This is my setup with the necessary files: The module file (app/etc/modules/Mynamespace_Mymodulename.xml): <?xml version="1.0"?> <...
1
vote
1answer
2k views

Magento 2: How to override Product View Attributes block?

How to override Product View Attributes block: vendor/magento/module-catalog/Block/Product/View/Attributes.php in Magento 2? Jsp/Attributes/etc/module.xml <?xml version="1.0"?> <config ...
1
vote
2answers
15k views

How to override product view page in magento 2

I want to override product view page and add my custom code over that. So please help me on how can I override template of product view page. Thank you.
1
vote
1answer
2k views

Adding new fonts to Pdf invoice Magento 2?

When working with Pdf invoice, I meet a problem about encoding Japanese font. I'm going to add a Japanese font(Gothic) to Pdf invoice, creditmemo, etc. What should I do? We may rewrite abstract \...
1
vote
1answer
1k views

How to Override Mage_Sales_Model_Quote_Address::requestShippingRates Method

In my attempt to fetching shipping rates, I want to override/rewrite this core file Mage_Sales_Model_Quote_Address to put my custom code. So that, I can call the original method using PHP's parent:: ...
1
vote
2answers
1k views

How to override getSectionData() method of magento-checkout CustomerData/Cart.php?

Is it possible to overwrite "public function getSectionData()" of class magento-checkout/CustomerData/Cart.php only with the help of Plugin My di.xml <?xml version="1.0"?> <config ...
1
vote
2answers
85 views

Rewrite function , when should I use local/mage and when shouldI use the rewrite by a module

I'm working on Magento 1.9 I can see I have 2 options to rewrite a mage file . First, I just copy the file with the same path in local/mage/.... Second, I use a module and rewrite my method using etc/...
1
vote
2answers
6k views

In magento 2 how to edit the phtml file?

In magento 2 I need to edit topmenu.phtml file. So I copied the topmenu.phtml file from: vendor/magento/module_theme/view/frontend/templates/html/topmenu.phtml into: app/design/frontend/<...
1
vote
5answers
305 views

Override Adminhtml Core Controller not working (EE 1.14)

I would like to override the core Controller. Path: app\code\core\Mage\Adminhtml\controllers\Sales\OrderController.php And then, I create the custom extension for overriding this controller. Here ...
1
vote
1answer
688 views

rewrite ` Magento\Catalog\Model\ResourceModel\Product\Collection` showing error `Select' not found`

I am trying to override the class Magento\Catalog\Model\ResourceModel\Product\Collection On overwrite class, i got the error Fatal error: Class 'AmitBera\CoreRewrite\Model\Rewrite\Catalog\...
1
vote
1answer
1k views

Magento 2: How to override Zend library files function only?

I would like to override below file magento\vendor\magento\zendframework1\library\Zend\Captcha\Image.php Can we do with magento\app\code\zendframework1\library\Zend\Captcha\Image.php ? What will ...
0
votes
2answers
929 views

Rewriting Adminhtml Block - To add custom validation to coupons (shopping cart rule)

I have extended the Block Mage_Adminhtml_Block_Promo_Quote_Edit_Tab_Main and added the changed code in the new class Acer_Coupon_Block_Adminhtml_Promo_Quote_Edit_Tab_Main. For some reason, the Block ...
0
votes
2answers
827 views

Class not found error while extending core helper

I am trying to extend the core helper class But found the below error.. Fatal error: Class 'Mage_Kishore_Kp_Helper_Data' not found Below are the path of my files.. 1. app/etc/modules/Kishore_Kp....
0
votes
1answer
2k views

Magento 2 Override third party module block file

I am working a Magento2 project and I have installed a third party module magefan/module-blog which is used for manage Blog/post.This module is installed in Magento Vendor folder. path is magento/...
0
votes
2answers
738 views

How to Override the ProductRepository class

I want to override the ProductRepository.php class need to do some changes in the Save function File Path : vendor/magento/module-catalog/Model/ProductRepository.php Fucntion Name: Save How can I ...
0
votes
0answers
85 views

How to override Add to cart functionality in Magento 2.2

How to override Add to cart functionality in Magento 2.2 using custom extension?
0
votes
2answers
499 views

Override customer method in magento issue?

So this is my modules/Namespace_Module.xml content: <?xml version="1.0"?> <config> <modules> <Namespace_Module> <active>true</active> ...
0
votes
2answers
4k views

Can't override Magento Adminhtml Block

Sysnopsis I am trying to change a tab on the admin products page (grouped); However for some obscure reason I cannot get my module to work. The problem seems to be my module is completely ignored. ...
0
votes
2answers
875 views

How to override magento theme layout file

I am a newbie to Magento 2.2.4 and i want to get bootstrap 4 css and my own js files.. As a first step trying to override the theme layout file. I created a theme and enabled it successfully. (All js ...
0
votes
2answers
2k views

Magento 1.9: How to override core payment model

I want to override the default payment model class in a custom magento extension, as placing the file in local pool with same directory structure working fine but my hosting providers are telling that ...
0
votes
1answer
44 views

Magento 1.x: Is it possible to rewrite classes in website level?

I need to rewrite some classes per website level in Magento 1.x. Is it possible? Basically looking some way as If website is "A" then rewrite this class & its method. But if website is "B" then ...
0
votes
1answer
4k views

How to “override” default Magento2 “Luma” Theme with a Custom Theme

I created a custom Theme with "Luma" as its parent. Now I want to override .less / css stylings. (for example "header" background color) Thats the Folder structure I have: I did copy "_module.less" ...
0
votes
1answer
3k views

Magento 2 Override minicart.phtml template?

This is the Magento core template path: vendor/magento/module-checkout/view/frontend/templates/cart/minicart.phtml I would like know how to override this template with my theme.
0
votes
2answers
3k views

Magento 2: How to override Ui & Component folder files

How to override these below files: vendor/magento/module-configurable-product/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php vendor/magento/module-ui/Component/Form.php ...
0
votes
1answer
49 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 ...