Questions tagged [override-block]
The override-block tag has no usage guidance.
75 questions
0
votes
1
answer
32
views
Issue in Mobile-View Category--after Overriding Block \Magento\Theme\Block\Html\Topmenu _getHtml() Function
*For adding Images in Top Menu Category,I have Override the _getHtml() Function from Block\Magento\Theme\Block\Html\Topmenu.
*It's Working fine,But the issue is,On Mobile View for every ...
0
votes
2
answers
1k
views
How to override product details page in custom module
I create a module, then create files details.phtml under app/code/Namespace/Module/view/frontend/templates/product/view and create catalog_product_view.xml under app/code/Namespace/Module/view/...
0
votes
1
answer
131
views
override html/skip.phtml template's block file
In layout default.xml, i found this
<block class="Magento\Framework\View\Element\Template" name="skip_to_content" template="Magento_Theme::html/skip.phtml">
So ...
0
votes
2
answers
630
views
How to override the vendor/magento/module-swatches/Block/Product/Renderer/Configurable.php in magento2 app/code/ custom module
How to override the vendor/magento/module-swatches/Block/Product/Renderer/Configurable.php file in magento2 app/code/ custom module
I'm updated the const SWATCH_RENDERER_TEMPLATE = '...
0
votes
2
answers
2k
views
Magento 2 How to override Magento\Catalog\Block\Product\View to add getStoreCode () function
I need to overwrite the block Magento\Catalog\Block\Product\View to add the getStoreCode () function and be able to call it from a phtml file that uses this block.
I have followed a tutorial to create ...
0
votes
1
answer
94
views
Block override issue in Magento2
I am overriding Google analytics block file.
Here is my Vendor/Module/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
0
votes
1
answer
1k
views
Magento 2 : How to Override /vendor/magento/module-quote/Model/Quote/Address/Total/Grand.php
Not able to override grand.php file can anyone help me out.
0
votes
1
answer
24
views
Issue with block override Magento 1
Here is what i have tried
i am trying to override Mage/Adminhtml/Block/Sales/Order/Create/Items/Grid.php
block
Config.xml
<?xml version="1.0"?>
<config>
<modules>
...
1
vote
1
answer
34
views
Override Block & Template File in Magento 1
What is the best way to override the below files theme/module & how one can override it ?
app/code/core/Mage/Adminhtml/Block/Sales/Order/Create/Items/Grid.php
app/design/adminhtml/default/default/...
0
votes
2
answers
2k
views
Magento 2: Add custom field to Admin Store edit
I am trying to add a custom field to Admin Store Edit
I have overridden the block function _prepareStoreFieldset locate in vendor/magento/module-backend/Block/System/Store/Edit/Form/Website.php
This ...
0
votes
0
answers
453
views
Magento 2.3 Change product status to out-of-stock when qty is less than 'Minimum Qty Allowed in Shopping Cart'
I'm running Magento 2.3.5.
Some of my products have Minimum Qty Allowed in Shopping Cart set to greater than one.
For example, product A has Minimum Qty Allowed: 7.
Currently, the QTY of A is: 10.
Now ...
0
votes
0
answers
359
views
Magento 2 bundle block overriding not working
Hi I am trying to override bundle block but it not working created di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
0
votes
1
answer
962
views
Custom catalogsearch layout and template override not displaying custom block content [EDITED]
Edit: Could not having crontab and cron set up affect compiling the layout files and be related at all to the custom layout not loading? I have since moved all my logic out of the app/design/frontend/...
1
vote
1
answer
2k
views
Magento 2.3.* - How to override ViewModel for override block?
Magento 2.3.*
I want to override ViewModel for the override block (custom.block.name). But the issue is my .phtml a file called from the block and it is calling on some condition. Not every time call....
0
votes
2
answers
1k
views
How to Override the block in magento2.3
I want override the block file. I had given the details of the original file path and my overridden file.
My overridden file
app\code\Vendor\Module\etc\di.xml
<?xml version="1.0"?>
<config ...
0
votes
2
answers
151
views
Magento 2 - overriden class extending overriden class not working
I have overriden the class Magento\Catalog\Block\Product\ProductList\Upsell with my own Company\Base\Block\Product\ProductList\Upsell.
The class Magento\Catalog\Block\Product\ProductList\Upsell ...
0
votes
1
answer
349
views
Magento 2 how to override Magento\Directory\Block\Data using preferences?
This is my code but the block is not overrided
My di file :
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:...
2
votes
1
answer
41
views
Overriding an account feature for editing email/username
I found the element that i want to remove here:
vendor/magento/module-customer-custom-attributes/view/frontend/templates/customer/form/edit.phtml
I've created a new edit.phtml file here:
app/design/...
1
vote
0
answers
372
views
Overrided template renders only after reload of page
I override core template
Magento_Sales::order/view/history.phtml
to add new checkbox that will allow to send sms along side emails.
I added in this file:
Vendor_Module::order/view/history.phtml
...
0
votes
0
answers
11
views
Hide a block in an override xml that doesn't have a name? [duplicate]
I have the following block that is added in a 3rd party SSO module. I'm overriding part of the module, and I want to hide this block.
<referenceContainer name="content">
<block class="...
2
votes
2
answers
3k
views
Magento 2 How to override sales.order.items.renderers block in sales_order_view page?
I am trying to override sales_order_view.xml file sales.order.items.renderers block, I have followed below mentioned code but not worked:
overriding sales_order_view.xml in custom module :
Method 1 :...
0
votes
0
answers
470
views
How to Filter Current Category Layer's products colletions by instock and qty greater than zero(0) condition in List Page Magento 2
Please check below Code:
di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/...
2
votes
2
answers
6k
views
Magento 2 Override ListProduct.php Block File
I am trying to override ListProduct.php file in my custom module,
Steps:
File: etc/frontend/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
1
vote
2
answers
3k
views
How to override protected _prepareLayout function in block in Magento 2?
I wanted to make changes in _prepareLayout() in block.
Code is as follow:
Block: Magento\Catalog\Block\Category\View
protected function _prepareLayout()
{
parent::_prepareLayout();
$this-&...
1
vote
0
answers
237
views
Magento 2.2.5 Override sales order item block not working
We are working on Magento 2.2.5, override the \Magento\Sales\Block\Order\Items class method _prepareLayout but it is not working showing error.
File : etc\module.xml
<?xml version="1.0" ?>
<...
1
vote
0
answers
311
views
GoogleAnalytics Block Override
Developer view, please
app/code/YourCompany/YourModule/etc/di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/...
1
vote
2
answers
2k
views
How To Pass A Custom Price Value To Product List Price Renderer In Magento 2?
We have come across an issue that I'm trying to solve. In order to overcome this bug https://github.com/magento/magento2/issues/10009 where discounted prices are not applied per customer group, I've ...
3
votes
3
answers
2k
views
interceptor not generate for \Magento\Catalog\Block\Product\ListProduct
I'm trying to create plugin for getProductPrice but \Magento\Catalog\Block\Product\ListProduct Block Class not generate Interceptor Class like Magento\Catalog\Block\Product\ListProduct\Interceptor.
...
1
vote
2
answers
2k
views
Override admin block file issue in magento2
I am trying to override block file of adminhtml of sales module.
Below is the code of my di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
0
votes
1
answer
156
views
Best practice to add method to core block
Which is teh best way to extend a block with a custom method?
Should I use a preference to override the whole class or is enough to declare the extended class with the new method inside the XML layout ...
7
votes
3
answers
2k
views
Problem in overriding ListProduct on search results
We have overwritten Magento\Catalog\Block\Product\ListProduct to be able to check if displayed products match a certain category.
We have set the preference in our module /etc.di.xml like this:
<...
1
vote
1
answer
626
views
How to override tax Block In magento2
I want to override the order of "Total Excluding Tax" and "Total Including Tax" in the order confirmation email so I tried to use preference to override, but its not working. I want to override this
...
0
votes
1
answer
348
views
Can we rewrite multiple blocks of same core extension?
Can we rewrite multiple blocks of a core extension like catalog ? like this :
<blocks>
<catalog>
<rewrite>
<class_name_here>...
1
vote
1
answer
47
views
Not able to rewrite another extension's block
We are trying to rewrite the 3rd party module's block.
Here is my extension
\app\etc\modules\XXX_GoogleTagManager.xml
<?xml version="1.0"?>
<config>
<modules>
<...
2
votes
2
answers
3k
views
Magento 2 theme override: changes not showing
I am new to Magento 2 and theming and I'm having trouble overriding a particular template. I am running in developer mode.
I have successfully installed my theme and applied it globally in the admin, ...
2
votes
1
answer
2k
views
Overriding a layout file in magento2 is not working
What I want to override:
vendor/magento/module-catalog/view/frontend/layout/catalog_product_view.xml
I copied the file to this location:
app/design/frontend/[Vendor]/[MyCustomTheme]/...
0
votes
1
answer
1k
views
Adding new function in existing class
I want to add a new function in class Magento\CatalogWidget\Block\Product\ProductsList so, that I can use that function in template file of this block.
Can I add a new function without using ...
0
votes
1
answer
118
views
Can't override Mage_Catalog_Block_Product_List_Toolbar
I have a problem to rewrite/override Mage_Catalog_Block_Product_List_Toolbar.
Here is my code:
etc/modules/Codesky_CatalogProduct.xml
<?xml version="1.0"?>
<config>
<modules&...
2
votes
3
answers
2k
views
Overwriting adminhtml block template for a products advanced pricing
---- EDIT #3 :
Please ignore the code in this question. The template tier.phtml is not used by Magento 2.2.x (see edit #2)
The working code can be found here: Extra column in ...
3
votes
2
answers
943
views
Change header label "sign in" to "log in" in magento 2
Can anyone help how to change header's "sign-in" label to "log-in" in Magento 2.
5
votes
0
answers
295
views
Problem with block override in Magento 2
Note: Before marking the question as duplicate or off-topic, please read the question carefully.
Scenario:
I have to show custom column in the admin grid of a custom extension. So I used override ...
0
votes
4
answers
1k
views
Magento 2 : How to Change Form encoding?
I would like add multipart-form/data to Magento2's Admin Form.
Vendor/Module/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
1
vote
3
answers
5k
views
Magento 2 : How to get store information in specific Block
I have Override \Magento\Catalog\Block\Product\View Block in which i can not get store information. I have use \Magento\Store\Model\StoreManagerInterface $storeManager but it throws following error.
...
0
votes
1
answer
739
views
how to override adminhtml block for a function?
Urapidflow has an issue which casued by a security patch and even their new version does not resolve the issue,
the path for module file that I want to write an override is:
app\code\community\Unirgy\...
4
votes
1
answer
2k
views
Magento 2 - How to remove '--Please Select--' option from Custom Option dropdown on Product page
In Magento 2 I am trying to remove first option "--Please Select--". Here is my code. After the rewrite, I am not able to see custom option dropdown itself but the page is loading. Please let me know ...
0
votes
2
answers
92
views
Form Block Override seems to work but is Never Called
This is a very common question, but this one is a little different.
I'm trying to overwrite/rewrite a Form block from another module. I'm already rewriting other blocks from this module without ...
0
votes
4
answers
3k
views
How to override adminhtml block file in Magento 2
How to override module-customer/block/AdminHtml/Group/Edit/Form.php
I have created custom module for that please find my code for that.
etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi=...
0
votes
1
answer
523
views
Magento 2 Not able to override \Magento\Directory\Block\Data Class
I am trying to override Block \Magento\Directory\Block\Data with following method getCountryHtmlSelect() with following script, but it's not executing.
di.xml
<?xml version="1.0"?>
<...
1
vote
1
answer
583
views
Magento 2 overriding Block Class Function
I just want to override vendor/magento/module-backend/Block/Dashboard/Orders/Grid.php
I added this line $collection->addAttributeToFilter("status",["neq"=>"failed"]);
Core overriding is ...
1
vote
0
answers
293
views
Magento2 - How get all prices of all Blocks within HomePage?
I have working a website with others extensions between them the "Ultimo - Fluid Responsive" theme that overwrite much part of website, as well as my own extension.
My question friends:
I how can ...