Questions tagged [override-model]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
31 views

Getting error after overwrite core file of sitemap module. magento2

I have successfully overwrite core file: Magento\Sitemap\Model\ResourceModel\Catalog\Product but getting error in public function getCollection($storeId) for this: $this->scopeConfig->isSetFlag ...
Jimit Bhavsar's user avatar
1 vote
0 answers
158 views

Error: Cannot instantiate abstract class Magento\Framework\Model\ResourceModel\AbstractResource

I have Magento enterprise version 2.4.5-p1, I am getting following error in the system.log Error:- .CRITICAL: Error: Cannot instantiate abstract class Magento\Framework\Model\ResourceModel\...
Mitul Vadalia's user avatar
0 votes
0 answers
801 views

Error: Cannot instantiate interface

I am override the file sender.php this is not a normal class is abstract class may be that's the reason to display the error Could anyone suggest regarding this so i can proceed forward. error
Mohit Thakur's user avatar
0 votes
2 answers
65 views

How to override an abstract class in magento 2

I know how override the normal class but now i try to override the abstract class [ Magento\Sales\Model\Order\Email\Sender.php ] . i have override the Sender.php file in custom module but its not ...
Mohit Thakur's user avatar
0 votes
2 answers
49 views

Magento 2 : How to override the abstract class [ sender.php] in custom module

I create a custom module to send email to customer and admin separately if i try to override the core file in my custom module its shown error .Error come when i override the [ sender.php ] file in my ...
Mohit Thakur's user avatar
0 votes
3 answers
476 views

Magento 2 : How to overwrite Magento\Quote\Model\ShippingMethodManagement

I want to make changes in function estimateByAddressId() which is public method. I tried following : app/etc/di.xml also tried in app/etc/frontend/di.xml <preference for="Magento\Quote\Model\...
Jayshree's user avatar
1 vote
0 answers
92 views

Incompatible argument type: Required type: \Magento\Framework\EntityManager\MetadataPool. Actual type: string; when trying to override resource model

I am trying to override the Resource model for the cms page file in the sitemap module my code is <?php namespace MyModule\SiteMap\Model\ResourceModel\Cms; use Magento\Cms\Api\Data\PageInterface; ...
nickcobb's user avatar
0 votes
1 answer
214 views

Magento 2: Override model not working

I am trying to override the vendor/magento/module-inventory-in-store-pickup/Model/GetPickupLocations.php file I have copied it to app/design/frontend/Magento/child_theme/Magento_InventoryInStorePickup/...
miller75's user avatar
  • 409
0 votes
1 answer
23 views

Override a function inside a model

I want to override a function inside the model, but it doesn't work. I just want to make correction on existing function, not adding a new function. I did some google, some suggestion ask to use ...
Paul Fan's user avatar
  • 614
0 votes
1 answer
245 views

Override DefaultInvoice.php file to render custom row in magento 2.4.4

I need to override Magento\Sales\Model\Order\Pdf\Items\Invoice\DefaultInvoice.php file to render a custom row in Magento 2.4.4 I tried with preferences like <preference for="Magento\Sales\...
Monark Bhawani's user avatar
0 votes
2 answers
137 views

Override private function of Magento\ConfigurableProduct\Model\ResourceModel\Product\Indexer\Price\Configurable

I want to override updateTemporaryTable() of Magento\ConfigurableProduct\Model\ResourceModel\Product\Indexer\Price\Configurable.php which is private method. please help me in overriding private method....
Pradeep Sanku's user avatar
1 vote
0 answers
178 views

Override PHP-sdk file in vendor

I want to override the (PHP sdk)file which is found in the vendor path the path is vendor/tamara-solution/php-sdk/src/Tamara/Model/Order/Order.php I am attaching my that specific php sdk composer....
Muhammad Abdullah's user avatar
0 votes
1 answer
448 views

How to override Model file ConvertToCsv in custom module

Here am trying to override a vendor file that is vendor/magento/module-ui/Model/Export/ConvertToCsv.php etc/di.xml file <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
Praveen Negimani's user avatar
0 votes
0 answers
177 views

Magento 2 : How to Override \Magento\NegotiableQuote\Model\CompanyQuoteConfigRepository.php

di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/...
Gaurav Daware's user avatar
0 votes
3 answers
453 views

How to override class Magento\Sales\Model\Order\Pdf\Total\DefaultTotal?

I am trying to override getFullTaxInfo() of class Magento\Sales\Model\Order\Pdf\Total\DefaultTotal using preference but this is not working. Can anyone help to do it? di.xml <?xml version="1....
Vinod Kumar's user avatar
  • 2,045
0 votes
1 answer
134 views

How to override OrderRepositry - save function | API

I need to add some custom functionalities in the Order save function when some API request comes. To be exact need to override the core OrderRepository class vendor/magento/module-sales/Model/...
Sathya's user avatar
  • 508
0 votes
1 answer
317 views

_initSelect override with Plugin in Magento2.4.1

Need a help in this issue. I am trying to remove a MySQL condition from _initSelect from this Collection "Magento\SalesRule\Model\ResourceModel\Rule\Collection". This Collection has the ...
Nithin's user avatar
  • 23
1 vote
1 answer
236 views

Magento 2 : Prevent "payment method" based on country ID

I have override "Magento\Checkout\Model\PaymentInformationManagement" file in custom module I want to prevent some "afterpay" payment method to be displayed for some country. So i ...
devhs's user avatar
  • 497
0 votes
2 answers
780 views

Magento 2 - preference override not working for method sendConfirmationRequestEmail of module-newsletter

I try to override the method sendConfirmationRequestEmail from the module-newsletter Module in vendor\magento\module-newsletter\Model\Subscriber.php. Attempt: app\code\Company\Newsletter2Go\etc\di.xml ...
Black's user avatar
  • 3,150
0 votes
0 answers
23 views

Suddenly Sitemap model stopped working after 4month

I have used the preference to override the Sitemap model. Working fine for 4 months. I have also tried to find other module is overriding the same but didn't get anything. Can somebody help me to find ...
Mahendra's user avatar
  • 716
0 votes
1 answer
48 views

How to override a class in magento 2.1 [closed]

hello everyone i am using magento 2.1 in my case i want to override a model class in my custom module , but the override didn't toke correctly
coding mv's user avatar
  • 129
0 votes
2 answers
763 views

Overriding Model Not working : Magento2

I am Using a third party Module and going to customize a model file in it. I have tried by overriding the model class but it is not showing any effect. What i am doing is, just taking one method that ...
Shoaib Fareed's user avatar
0 votes
1 answer
40 views

Errors during compilation: in Magento 2.3

I am overriding Magento\Sales\Model\Order\Pdf\Items\Shipment\DefaultShipment due to some custom work in pdf shipment by using preference Below is the di.xml file <?xml version="1.0"?> &...
akgola's user avatar
  • 2,897
1 vote
1 answer
232 views

Magento2: Failed Override Magento_Tax module Class with protected method

I am trying to override class Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector I tried everything and checked the implementation is correct in di.xml The method I am trying to override is a ...
Ahsan Horani's user avatar
0 votes
2 answers
59 views

What is the error in this Preference?

Due to PayPal Error, i am updating the following function in app/code/Magento/Paypal/Model/Api/Nvp.php, not edit the entire code just update a single function. Function Name : function ...
zus's user avatar
  • 155
-1 votes
2 answers
2k views

How can I override Magento/Customer/Model/AccountManagement?

I need to override below from AccountManagement: public function authenticate($username, $password) { try { $customer = $this->customerRepository->get($username); } catch (...
TIM's user avatar
  • 13
1 vote
2 answers
370 views

how to override AbstractCarrierOnline class function in Magento 2

I want to override "proccessAdditionalValidation" function of app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php file in custom module. Please help me and thanks in advance.
bhagwandernase's user avatar
1 vote
0 answers
39 views

How to add extra amount to individual tax total?

I have two tax rules in my online shop. Tax 1 Tax 2 The tax calculation is based on the subtotal. But now I want to add custom amount with the above tax . i.e., Tax 1 = Tax 1 + custom amount Tax 2 =...
skm's user avatar
  • 174
1 vote
1 answer
590 views

How to override magento2 product tierprice?

I want to override magento2 product tier price calcualtion logic for price type 'Percentage'. I would like to calculate the percentage amount in my own way. Please let me know which file I have to ...
skm's user avatar
  • 174
0 votes
2 answers
495 views

Magento 2: Model Override not working

I want to modify the code of Magento\Sales\Model\Service\PaymentFailuresService.php. So I'm overriding Model file using the below code but it's not working. etc/di.xml <?xml version="1.0"?> &...
m2dev's user avatar
  • 63
0 votes
2 answers
546 views

Overriding \Magento\Catalog\Model\Product\Type\Price

I'm implementing product price calculation based on a formula that uses customizible options in Magento 2 (ver. 2.3.1). I added some code to _applyOptionsPrice() to "Magento/Catalog/Model/Product/Type/...
Armando Baños Pascual's user avatar
3 votes
1 answer
2k views

How to Override 3rd party module requirejs-config.js file 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-...
Kowsigan Atsayam's user avatar
0 votes
2 answers
771 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 ...
Magento Developer's user avatar
0 votes
1 answer
1k 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.
Amy's user avatar
  • 935
0 votes
1 answer
573 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 ...
Robinio's user avatar
  • 771
1 vote
3 answers
566 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-...
Dinesh Rajput's user avatar
0 votes
1 answer
52 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/...
Anass Hl's user avatar
1 vote
1 answer
1k 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-...
Purushotam Sharma's user avatar
1 vote
0 answers
2k views

Magento 2 - How to call a protected function from the subject inside a plugin

I have created a plugin for a particular function. That function is also calling another protected function of the core file. public function afterPopulateTaxRateData( \Magento\Tax\Model\...
Mahi M's user avatar
  • 2,540
0 votes
1 answer
866 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 ...
Hitesh Balpande's user avatar
1 vote
1 answer
764 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 ...
chanchal's user avatar
  • 407
0 votes
2 answers
491 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:...
Jafar Pinjar's user avatar
  • 1,929
0 votes
2 answers
1k 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/...
Arjun's user avatar
  • 3,556
1 vote
1 answer
1k 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 ...
mysterious's user avatar
2 votes
1 answer
278 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:...
Unknown's user avatar
  • 581
0 votes
1 answer
454 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\...
Kozame's user avatar
  • 964
1 vote
3 answers
363 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/...
Amy's user avatar
  • 935
0 votes
1 answer
165 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/...
pinicio's user avatar
  • 766
0 votes
1 answer
287 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>...
Md Amanullah's user avatar
1 vote
2 answers
1k 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 ...
akgola's user avatar
  • 2,897