Questions tagged [override-model]

The tag has no usage guidance.

25 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
2answers
455 views

How to override class which extends Abstract Class

I want to override a class Magento\Catalog\Model\Product\Type\Simple di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
4
votes
0answers
416 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 ...
2
votes
1answer
44 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:...
2
votes
0answers
166 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
0answers
537 views

Magento2 Overriding Block and Model Working Only For Direct Called Class

It seems like Overriding Block and Model in magento2 work only if the class is directly being called. For Example i want to override model file vendor/magento/module-catalog/Model/Layer/Filter/...
1
vote
0answers
19 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 =...
1
vote
2answers
187 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-...
1
vote
1answer
46 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 ...
1
vote
1answer
645 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=$...
0
votes
0answers
13 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 ...
0
votes
2answers
33 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 ...
0
votes
0answers
22 views

Create Module to display stock status on Product listing Page

I want to develop module which is able to display custom stock status on product list page when we can enable X-threshold option from admin side and that much quantity will be displayed with the ...
0
votes
2answers
90 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"?> &...
0
votes
2answers
162 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/...
0
votes
1answer
245 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 ...
0
votes
0answers
656 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
2answers
294 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
610 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/...
0
votes
1answer
70 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
398 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 ...
0
votes
0answers
174 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\...
0
votes
1answer
508 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
0answers
20 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
1answer
124 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
365 views

After clicking on add to cart Lotus Breath - One Step Checkout hanges. It keep loading for a long time

To Bypass cart and go to checkout i used these files app/etc/modules/Maddy_Cart.xml <?xml version="1.0"?> <config> <modules> <Maddy_Cart> <...