Linked Questions

5
votes
1answer
19k views

magento2 how to override model file? [duplicate]

I would like to override (call the below model file from my custom module called Demo_Customprice /vendor/magento/module-catalog/Model/Product/Option/Value.php How could we achieve this?
0
votes
1answer
730 views

What is override preference, block, model and preference? [duplicate]

I want to edit Magento 2 core function: /** * Build category URL path * * @param \Magento\Catalog\Api\Data\CategoryInterface|\Magento\Framework\Model\AbstractModel $category * @...
1
vote
1answer
63 views

Overriding core blocks with backend logic for specific theme [duplicate]

Im having trouble of understading not the override itself but how to override from theme with backend logic. so here is my question do i have to override Blocks in app/code or can do it from app/...
0
votes
1answer
87 views

What will be the best way to overwrite the core functionality in Magento 2? [duplicate]

It will be great if someone provides me a small example of any core functionality overwrite.
17
votes
3answers
14k views

Magento 2: rewrite controller

how can i rewrite a controller (that's actually an action) in Magento 2? I tried, as instructed here like this: I have my own module called Namespace_Module with a di.xml file, that is taken into ...
7
votes
3answers
13k views

Read input csv file and convert it to array

I have an input file form in phtml to import data from csv file type like this: <div class="import-shipping"> <div class="header"> <h4>CSV File:</h4> </div> &...
8
votes
2answers
16k views

Magento 2: Override Magento\Catalog\Block\Product\View Block

I have developed one custom module and i have tried to override product view block by following these two links Overriding Block in Magento 2 and DI & Extending a Block on Magento 2 but when i hit ...
3
votes
2answers
4k views

How to modify/update cart success message in Magento 2?

I want to modify/update the success message added by cart controller (Magento\Checkout\Controller\Cart\Add). As described here and here, I can use preference to override controller to update success ...
4
votes
2answers
900 views

Magento 2.1: <preference> doesn't work with block

I try to override getSelectionTitlePrice() - function. (vendor/magento/module-bundle/Block/Catalog/Product/View/Type/Bundle/Option.php) if i have understood right the best way to do it is use ...
1
vote
2answers
2k views

Magento 2 override core Model class with psr-4 by replacing in app/code/Magento

"autoload": { "psr-4": { "Magento\\Framework\\": "lib/internal/Magento/Framework/", "Magento\\Setup\\": "setup/src/Magento/Setup/", "Magento\\": "app/code/...
3
votes
2answers
2k views

Magento 2 error occurs when using <preference> to override a model class

I'm trying to override a model class Customer.php, maybe I've configure it wrongly, this error occurs: a:4:{i:0;s:316:"Recoverable Error: Argument 21 passed to Magento\Customer\Model\...
3
votes
3answers
1k views

How to make Changes (Edit Core Block) in a Block in Magento 2

I want to override Magento core block how can I do that vendor\magento\module-catalog\view\frontend\templates\product\view\options\type\Select.php. I want to remove -- before and after Please Select ...
1
vote
2answers
1k views

How can I override the Vendor with Custom module in magento 2 [duplicate]

How can i override this path: vendor/magento/framework/View/Element/Html/Select.php with my custom module file?
0
votes
2answers
2k views

How to get Custom Model in a block that extends Block \Magento\Catalog\Block\Product\View?

I have block named custom.product namespace Myaddon\CustomProduct\Block\Product; use Magento\Framework\View\Element\Template; class Custom extends \Magento\Catalog\Block\Product\View { ...
0
votes
2answers
597 views

Magento 2 - How to save custom filed data of registration page?

Please see this screenshot, I try with Install Data <?php namespace CP\Customerattribute\Setup; use Magento\Customer\Setup\CustomerSetupFactory; use Magento\Customer\Model\Customer; use Magento\...

15 30 50 per page