Questions tagged [preference]

Denotes questions related to Magento 2 preferences

25 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
0answers
536 views

How to override class Virtual Type class

I saw this, but it don't work for me. How to override Virtual Type class in Magento 2 <virtualType name="categoryFilterList" type="Magento\Catalog\Model\Layer\FilterList"> <arguments>...
2
votes
0answers
41 views

Preference for Magento\Setup Classes not working

TLDR - Is there a reason I can't use preference for classes in Magento\Setup namespace, specifically during the setup:upgrade processing, OR is there something I am missing with the following ...
2
votes
0answers
61 views

Is it possible to change/replace the custom function argument in magento 2

I just want to change/replace the custom function arguments, not constructor arguments. This is third party module function, which have wrong argument. public function addAttachment(\Fooman\...
2
votes
0answers
84 views

Why is there a DI preference for ProductInterface?

The ProductInterface has a DI preference leading it the ProductModel. While ProductModel is marked as falling under the Backward Compatibility Standard (it is marked with @api), it is still belonging ...
2
votes
1answer
123 views

How to override UpgradeData.php with Factory?

I need to override the UpgradeData Class from Catalog\Setup\UpgradeData But the constructor has factories in his arguments like CategorySetupFactory When I run setup:di:compile I got an error that ...
2
votes
1answer
620 views

How to Override Payment Helper Data Method Magento 2?

I am trying to override Magento Payment Helper data in my extension but it's not working. I have overriden by using the preference method. I have put below code in app/code/Demo/PaymentTest/etc/di....
1
vote
1answer
19 views

Magento 2 Overide public static method of framwork class

I want to override public static function getCorrectFileName method of Magento\Framework\File\Uploader, I have check with Preference and Plugin but it is not working for me. Anyone have idea about ...
1
vote
1answer
55 views

Magento 2.3 - Swatches Helper override

I'm trying to override a function in the Helper of the Swatches module of Magento 2. The function resides in the Data.php file. As some of you may know in specific versions of Magento 2 the text ...
1
vote
1answer
148 views

Magento 2-Override FinalPriceBox using Preference or Plugin class of Configurable Product module

Anyone has idea how to make preference or plugin on Magento\ConfigurableProduct\Pricing\Render\FinalPriceBox class of Magento\ConfigurableProduct. Basically, new function i wanted to add in the ...
1
vote
2answers
36 views

How to use a preference for only one website when there is multisite functionality magento 2?

I have created a preference to override the functionality of customer save. But the I need to use the core customer save functionality for 1 website and my preference functionality for another ...
1
vote
1answer
49 views

How to override List.phtml and Block as well

I'm trying to override the List.phtml and its block using preference I tried this <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:...
1
vote
3answers
66 views

How to Make Class or module to support M 2.1.7 and M 2.2.4 version in Magento 2

I have one custom module which is working fine for M 2.1.7 in that module, I extend \Magento\Bundle\Model\Product\Type in M 2.2.4 they added a new class for core file and passed to __construct ...
1
vote
0answers
319 views

Custom Module - Cart Page shows only “Estimate Shipping and Tax”

I'm trying to overwrite the function setRequest in /vendor/magento/module-usps/Model/Carrier.php to request "Online" rates from USPS. My complete module code is below. My module is enabled. I ...
1
vote
1answer
344 views

how to intercept PayPal IPN messages

I was trying to understand what's the best way to read incoming IPN messages from PayPal. This need comes from the order workflow we implemented in our website. For example: when a payment is ...
0
votes
2answers
88 views

Magento 2: Preference is not working

I want to override Magento\Catalog\Model\ResourceModel\Product\Collection using preference to modify the _buildClearSelect($select = null) method. For this, I have created di.xml with the following ...
0
votes
1answer
20 views

Is there a way to declare preference for a model or overwrite a model alias in M1?

I'm using Magento 1.9.x EE. I'm looking to overwrite the Mage_Core_Model_Email_Template::send function. I could overwrite the core class, but then my changes would be dependent on code that resides ...
0
votes
1answer
49 views

Some of product detail page error- Element 'reference': This element is not expected

When I tried to change or open product I got next message: 1 exception(s): Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'reference': This element is not expected. Line: 1 ...
0
votes
1answer
119 views

Why preference not working in Magento 2 observer (Custom module)

etc/di.xml <preference for="Custom\Pricerule\Observer\Frontend\Catalog\Catalog\ProductGetFinalPrice" type="Lof\RequestForQuote\Observer\ProductGetFinalPrice2" /> observer/...
0
votes
0answers
57 views

Error Class not found before deleting generated folder

I have created a preference to override a class but constantly getting error "Class not found" before deleting "generated" folder content: Error: Fatal error: Uncaught Error: Class 'Vendor\Module\...
0
votes
1answer
36 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
2answers
46 views

How to call Plugin which already using the preference for vendor file in magento 2

How to call Plugin which already using the preference for vendor file in magento 2. I have already has preference which is overridding the some custom Magento controller, Now how can i use plugin to ...
0
votes
1answer
45 views

magento 2 preferences - what to extend

I have a question about m2 preferences (overwriting core modules). Whenever I overwrite a core module, do I have to inject all the classes the same way original class does? Also what should I extend? ...
0
votes
2answers
565 views

Catalog ProductList not overriding magento2

I have overridden my catalog product listproduct in etc/di.xml as: <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/...
0
votes
0answers
300 views

How to get Email Details from magento 2 using preferences

I need to get Email Details for recipients,Subject,body,header, so i wrote a preference to override a Sendmail class then, get email Details and follow my blow code: di.xml FIle: <?xml version="1....
0
votes
1answer
243 views

Why is my Magento Catalog Block Preference ignored in di.xml?

I am trying to extend the Magento\Catalog\Block\Product\ListProduct block in Magento 2.1 My Vendor_ModuleName module has the registration.php, the etc/module.xml and it's enabled. Then I add an etc/...