Questions tagged [override-model]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
1answer
22 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
27 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
61 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
24 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
118 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
197 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
471 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
222 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
613 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
98 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
150 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
189 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
86 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
161 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
340 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
259 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
2answers
426 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
1k 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
82 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
203 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
26 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
65 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
58 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
370 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 ...
0
votes
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
116 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
1k 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
40 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
193 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
1answer
362 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
466 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
767 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
817 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
376 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
353 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\...
0
votes
1answer
203 views

Magento 2: Get product ID in override getTierPriceList from TierPrice

I'm extending \Magento\Catalog\Pricing\Price\TierPrice to return a custom list of tier prices for products. But I can't seem to figure out how to get the product id that is calling the ...
0
votes
2answers
512 views

Magento 2 product model override not working correctly

I've created a model override for Magento\Catalog\Model\Product. My override functions for getName() and getPrice() are working. But getTierPrices() and getTierPrice() in the same class are not being ...
2
votes
2answers
1k views

Magento 2 - Can't override pdf invoice class

I'm trying to customize the pdf invoice template, so I want to override the class that generate the pdf. I found that these class create the pdf: Magento\Sales\Model\Order\Pdf\Invoice.php Magento\...
5
votes
2answers
287 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:...
2
votes
2answers
552 views

magento 2 rewrite model is not working

I am using magento 2.1.5 I want to rewrite Magento\Tax\Model\Sales\Total\Quote\CommonTaxCollector model but it is not working. my module di.xml at vendor\module\etc\frontend\di.xml code as below <...
0
votes
1answer
288 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> <...
0
votes
1answer
549 views

Magento 2, extending sales module's Model, getting error Required type: \Magento\Framework\ObjectManagerInterface

I'm trying to override \Magento\Sales\Model\AdminOrder\Create, during the compilation I'm getting below, but I'm not making any changes, simply extending it! Incompatible argument type: Required type:...
2
votes
0answers
449 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/...