Questions tagged [override-model]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
1answer
54 views

How to Override 3rd party module requirejs-config.js film in my custom module?

The above one is the 3rd party module's require-config.js. It contains the js file inside the adminhtml/web/js. I want to override that. So I created a custom module and made changes in the require-...
0
votes
1answer
23 views

Add custom locale to the allowed locale list variable in Magento\Framework\Locale\Config

I need to update the allowed locale list with my custom language in magento 2.3.3. For that, I have overridden the Magento\Framework\Locale\Config class in my custom module. di.xml: <preference ...
0
votes
1answer
43 views

Magento: How to override vendor/magento/module-quote/Model/Quote.php?

How to override vendor/magento/module-quote/Model/Quote.php in Magento2. Any help would be appreciated.
0
votes
1answer
46 views

Magento 2 , After the override model file give an error

I override block file Form.phpof catalog search module all work fine, but when override model file Advanced.php give an error from Form.php Error filtering template: Type Error occurred when creating ...
1
vote
2answers
66 views

Magento 2.3 Unable to override Model: Magento\Reports\Model\ResourceModel\Report\Collection

Hello I am trying to override below function in below class using di.xml. Below is my code not working: di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-...
0
votes
1answer
26 views

Magento 1.9.4 Third party model override doesn't work

I've been trying for days now to get a rewritten model to function. but it doesn't work, I'm puzzled because all seems to be correct. ___Here's my config file : etek/advancednewslettercoupon/etc/...
1
vote
1answer
121 views

Magento2: How to override customer model file?

I want to override AccountManagement.php in Magento\Customer\Model\AccountManagement.php directory. My di.xml :- <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-...
0
votes
0answers
122 views

Magento 2 - How to call parent function inside the plugin

I have created the plugin for a particular function. That function is also calling another protected function of the core file. public function afterPopulateTaxRateData( \Magento\Tax\Model\...
0
votes
1answer
78 views

How to get Gift Message data on Invoice PDF in Backend Sales Order Grid Magento 2?

I am trying to display Gift Message for individual Item on Invoice PDF Admin Backend Sales Order Grid. Below same code is working for me if you open an order from Sales Order Grid for Individual ...
1
vote
1answer
81 views

magento 2.3 how to override protected function in custom module

I want to override protected method _prepareProduct present in vendor/magento/module-sitemap/Model/ResourceModel/Catalog/Product.php in my custom module. I have overridden the Model file by adding ...
0
votes
2answers
125 views

Model file not overriden in Magento 2

I am trying to override Model file in my custom module like below. Vendor/Module/etc/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
0
votes
2answers
265 views

How to override validate() of module-sales-rule/Model/Rule/Condition/Address.php?

I want to override validate() function of this file vendor/magento/module-sales-rule/Model/Rule/Condition/Address.php in my custom module file app/code/Companyname/Subtotalwithdiscount/Model/Rule/...
1
vote
1answer
136 views

Magento 2: Override di.xml in custom theme

I have a module in vendor/company/module. I have created the following folder to override files. /vendor/theme/theme-frontend-default/Company_Module. I am able to override files in view folder but I ...
2
votes
1answer
26 views

Magento2: unable to override methods in Magento\Catalog\Model\ResourceModel\Product\Collection

I want to override the model class(Magento\Catalog\Model\ResourceModel\Product\Collection.php) Flow the below process to override the addUrlRewrite method but not working. di.xml <config xmlns:...
0
votes
1answer
65 views

Override Magento\Catalog\Model\Product

I would like to add a new function to Product Model which be accessible each time I create Product. Below, my code : src/app/code/Project/Catalog/Model/Product.php : <?php namespace Project\...
1
vote
3answers
81 views

How to override default contact form Model file in Magento 2.2.5?

I want to override default contact form Model file (ie, Mail.php and mailinterface.php) in Magento 2. Struggling to override this file since the last 2days. Any help would be appreciated. /var/www/...
0
votes
1answer
42 views

How to override Quick Order model

I'm working on a Magento 2.2.3 B2B, with the Quick Order feature enabled, and I can't find a way to extend a method of the Magento\QuickOrder\Model\Cart model. So far I tried the usual: MyCompany/...
0
votes
1answer
165 views

Magento 1.9.3 - Can we override Mage_Core_Model_Session_Abstract_Varien class?

I am trying to override Mage_Core_Model_Session_Abstract_Varien class but not getting success. My config.xml file - <models> <coreoverride> <class>...
0
votes
2answers
498 views

Magento 2 override Third party module installed with Composer

I have installed the WebShopApps module with composer hence it is installed in the Vendor folder. Now I want to override model in my custom theme. As we know we can't directly modify in vendor folder ...
0
votes
3answers
2k views

Overriding private method of Model file in Magento 2

I am overriding private method of model file of checkout module below is my di.xml file. <preference for="Magento\Checkout\Model\DefaultConfigProvider" type="Vendor\Module\Model\...
2
votes
3answers
455 views

Customer model file override issue in Magento2

I am trying to override customer model file below is the code of my di.xml <preference for = "Magento\Customer\Model\AccountManagement" type = "Vendor\Module\Model\Rewrite\Customer\...
0
votes
1answer
1k views

Magento 2 Override Private method

I am working with the Magento2, as per my requirement i want to override the private function. In Magento\Checkout\Model\DefaultConfigProvider has a method "getCustomerData()" as private one, this ...
0
votes
1answer
228 views

Magento 2 - Issue on override of Multishipping checkout model

With this question I want to go further and to exactly know if it's possible to override: vendor/magento/module-multishipping/Model/Checkout/Type/Multishipping.php so far I've experienced some ...
2
votes
4answers
245 views

Magento2 override Newsletter Model showing error

I want to do some modifications inside Subscriber.php model file inside Newsletter module with mentioned below 2 methods, so i have override model with my custom module with di.xml with following code:...
1
vote
2answers
360 views

Magento2 : Overriding Model file not working

I want to override Magento\Payment\Model\Info::setAdditionalInformation() function my code is as below <preference for="Magento\Payment\Model\Info" type="Xxx\Yyy\Model\Payment\Info" /> and ...
0
votes
0answers
117 views

How to override ProductRepository model file in Magento2?

I need to override processMediaGallery method from \vendor\magento\module-catalog\Model\ProductRepository.php I used below code in my custom module etc/di.xml. < preference for="\Magento\...
3
votes
3answers
2k views

I want to override vendor\magento\module-email\Model\AbstractTemplate.php

I want to override method setForcedArea() because I'm using Magento 2.2.4 & whenever I tried to save Content->Configration->Design Configuration->Edit I'm getting following error:- ...
1
vote
1answer
267 views

Overriding Product model doesn't work

I need to add a new method to the Product model, those are the files I created: app/etc/modules/Overrides_All.xml <?xml version="1.0"?> <config> <modules> <...
2
votes
1answer
554 views

I want to override model in the Magento 2

I want to override the Magento\Catalog\Model\Layer\Category\FilterableAttributeList model file. I have created the module. This is my di.xml file. <config xmlns:xsi="http://www.w3.org/2001/...
0
votes
1answer
377 views

M2 - Overriding model from core module Customer (EmailNotification)

Can you guys guide me on how to properly do this. I created a module to extend the EmailNotification model but its not working. I'm getting error during compile: Interface '[Namespace]\[Module]\...
0
votes
4answers
742 views

Magento 2 : override model file

I tried so many ways to override the following file: vendor/magento/module-catalog/Model/Product/Gallery/CreateHandler.php but this file always runs from the core file. I also added this file in the ...
2
votes
4answers
2k views

How to override core files into app/code/Magento folder in magento2

How do I override core files in app/code/Magento folder in Magento 2? I want to change core functionality so I need to override core files in the app/code/Magento folder instead of directly changing ...
0
votes
0answers
19 views

Magento2: What's the right/best way to override the getProductsCollection() on category pages?

My goal: I want to create a special category that will display products by different rules (not by associated products), for example: 'products on sale' / 'new products' / 'products from multiple ...
0
votes
2answers
114 views

Magento2 : Can't Override Model File

I'm trying to override Magento\Bundle\Model\Product\Type for that i have add code indi.xml <preference for="Magento\Bundle\Model\Product\Type" type="Tecksky\Catalog\Model\Product\Type" /> ...
0
votes
1answer
283 views

Magento 2 : How to override a source model?

I am trying to override/rewrite Magento\Fedex\Model\Source\Generic by using preference but to no avail. Is there some other way that is used to override source models in Magento 2?
0
votes
1answer
27 views

Magento Module not loading. Codepool local [closed]

I am trying to make a module to hide product types when tryng to create a new product. I have created the files as follows: app\etc\modules\Grando_Producttype.xml <?xml version="1.0"?> <...
0
votes
1answer
105 views

Getting product object inside defaultinvoice.php file for getting custom attribute values

I will tell what i have done till now. I have made a custom module to override the Magento\Sales\Model\Order\Pdf\Items\Invoice\DefaultInvoice file and its working fine. I am able to get sku, ...
0
votes
1answer
116 views

How to override core model in custom module for SOAP & REST API?

I want override Magento\Sales\Model\Order\ShippingAssignmentBuildermodel only for Soap & REST API. I have tried following: SOAP API: app\code\AR\Sales\etc\webapi_soap\di.xml <preference ...
1
vote
1answer
446 views

Override Order PDF Abstract Model From Custom Module

I want to override magento function model which located at app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php Mage_Sales_Model_Order_Pdf_Abstract, how to override the insertOrder function at this ...
1
vote
3answers
2k views

How to override vendor module in magento 2 via code

Following is the code - override is not working app/code/Bensupply/DisplaySupplierName/etc/module.xml <?xml version="1.0"?> <!-- <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-...
2
votes
0answers
153 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, ...
7
votes
2answers
2k views

How can i override the PriceCurrencyInterface in Magento 2?

In \magento\framework\Pricing\PriceCurrencyInterface, I want to change the constant in that php interface file from this: /** * Default precision */ const DEFAULT_PRECISION = 2; to this: /** * ...
1
vote
1answer
43 views

Why are my Magento Model and Helper overrides not being run?

I'm trying to override the core Magento class Mage_Payment_Model_Info in order to solve an error. To be clear, the override I am talking about has been entirely written by me, and is extending a ...
2
votes
1answer
234 views

How to override customer resource module customer.php

I have override customer resource module in custom module. Like : Core_Mage_Model_Resource_Customer Override this module but not succeed. I have follow these steps : Here is config.xml <?xml ...
4
votes
0answers
407 views

Override core model not working

I tried to override Magento core model which located in vendor/magento/module-catalog/Model/Layer.php, but it doesn't work at all, here's my code: app/code/Vendor/Module/etc/di.xml <preference ...
0
votes
2answers
629 views

Override cart price rule functionality

I'm trying to override salesRule module adding a new field customer_id for creating rules based on an unique customer. I've already added the new field, but now, how this module applies the rules if ...
1
vote
1answer
1k views

Replacing the core module search using javascript in magento-2 [duplicate]

Replacing Core module search(form.mini). Run custom module search(form.mini) using javascript. REF:[Replacing Core module javascript magento 2] I don't know what mistake I did. app\code\Custom\...
0
votes
2answers
955 views

How to override a method of abstract file of invoice pdf

I want to override a method insert Totals of this file :- app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php How can I do that? Can anyone please guide? I saw this post : Changing PDF appearance ...
1
vote
1answer
506 views

Magento2 - Get Value of New Column in Tier Price Table

I have added a new column "admin_user" column in catalog_product_entity_tier_price table. This column value needs to come when following method is executed. $p=$productRepo->get('sample'); $tier=$...
1
vote
1answer
413 views

Dependency injection not working on one the the tax collector class

I am trying to override mapItem method from "Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector" using below code. However code written in my local module's class is not invoked. VendorName\Tax\...