All Questions
129 questions
0
votes
2
answers
21
views
How to override form_account layout block in magento2 admin
How to override form_account layout block in magento2 admin. I wanted to add a custom fiield under email field in account information section.
1
vote
1
answer
170
views
How to remove block and block arguments in other XML layout magento 2
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/...
0
votes
2
answers
201
views
Block that doesn't explicitly declare template?
I recently followed a tutorial to add a custom fee to the checkout summary of my Magento store and after getting everything working, I realized that the block I created didn't need to have an ...
0
votes
2
answers
127
views
Unable to display product name in catalog_product_view.xml
I am new at Magento, I would like to render the product name to catalog_product_view.xml (product page) from a custom phtml but it didn't work. May I know where did I go wrong? Thanks!
app/code/...
2
votes
3
answers
2k
views
best practice for get a block by id in *.phtml template in 2022 year?
Can you help me figure out which best practices to use for get block template by id in phtml file?
thanks everyone
if you need some info please send comment
okay, try it:
i created a block in admin ...
1
vote
2
answers
4k
views
How to pass argument from layout to block and how it works Magento 2?
I just wanted to know how to pass argumnet from layout to block and how its work and how its value pass in $data?
Can anyone explain it deeply
0
votes
1
answer
321
views
Magento2 : Layout block what is the difference between acl="" and aclResource"" attribute
I've been trying to figure out the difference between acl and aclResource both attributes available for <block> directive.
I know that aclResource is useful to render the block based on specific ...
0
votes
0
answers
68
views
Extension Layout won't work when using a custom theme
I have built an extension intending it to add a block underneath the Add to Cart button on the catalog product page.
My extension layout file isn't being executed - instead it just executes my custom ...
0
votes
1
answer
140
views
Can't add block below add to cart button
I am new to Magento and would like to add a custom block underneath the 'Add to Cart' button.
Here is my catalog_product_view.xml file:
<?xml version="1.0"?>
<page xmlns:xsi="...
0
votes
0
answers
516
views
Magento 2 : Rearrange Block Argument Items Using ReferenceBlock
I'm using magento 2.4 and trying to customize the items ordered table in admin order detail page via MyVendor\MyModule\view\adminhtml\layout\sales_order_view.xml. Here, if I reference the block to add ...
0
votes
2
answers
973
views
How to add a full width area in the homepage with 2 columns with right bar?
I'd like to add a full-width area (in order to insert a block) in my Magento homepage which is now set to 2 columns with right bar layout.
Should I add a new section before the main content? How? Or ...
0
votes
4
answers
3k
views
Magento 2 - Get name of templates block from .phtml file
Is it possible to get the block name of the current template?
For example I added a block to catalog_product_view.xml:
<block class="Magento\Contact\Block\ContactForm" name="...
0
votes
1
answer
37
views
Product page modification for specific products
I would like to make some product modifcations; change qty position to move in the top, add total price (qte* unit_price) in /vendor/magento/module-catalog/view/base/templates/product/price/amount/...
1
vote
0
answers
58
views
Move block after size atributte of product page [Magento 2]
I want to move a block and put it after size attribute because when I click this button magento detect that I add to cart:
I use this to move after add to cart, but I don´t known to move to the other ...
0
votes
3
answers
1k
views
Error getting Block in controller Magento 2: Element 'block', attribute 'class': [facet 'pattern']
I'm trying to get block in my frontend controller like this:
$resultPage = $this->resultPageFactory->create();
$breadcrumbs = $resultPage->getLayout()->getBlock('breadcrumbs');
this is ...
0
votes
1
answer
594
views
Magento 2 - new container not showing in overriden layout file
I try to change the layout vendor\magento\module-catalog\view\frontend\layout\catalog_product_view.xml in my own theme. I have overriden the layout file completly:
app\design\frontend\company\base\...
0
votes
0
answers
277
views
Add html code to CMS block somehow
I'm extremely new to Magento, I'm using v2, and find the learning curve to be a straight line up. I've created a child theme for Luma and created a page layout called test.xml which I then associated ...
0
votes
0
answers
145
views
Block is not getting called in custom module - Magento 2.3
I created a custom module to list all categories in a custom page. But the associated block is not getting called in the layout file. I can see the controller function is getting executed and page ...
2
votes
1
answer
422
views
Disable cache for particular custom block called in layout xml
I want to disable cache only for particular block which is called in some pages like Home Page, Category Listing page , Product page and Shopping cart page etc.
<block class="Namespace\Module\...
0
votes
2
answers
1k
views
How to get acces to block parameters defined in XML layout in block class
I am wondering how I can get access to parameter for blocks I define in a layout.xml
My cms_index_index.xml is as follows:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/...
0
votes
3
answers
3k
views
How to create an empty container and render it
I want to create an empty container and get it rendered.
Currently my empty container isn't showing up.
<container name="empty-container" htmlTag="div" htmlClass="my-class"/>
0
votes
1
answer
1k
views
Magento 2 : Pass a variable to getChildBlock() in LayeredNavigation view.phtml
I have to pass a variable in layer/view.phtml
/Magento_LayeredNavigation/templates/layer/view.phtml
to its getChildBlock which is renderer/labels.phtml
Amasty_Shopby/templates/layer/filter/...
0
votes
0
answers
501
views
Magento 2 Return Controller data in the same page
I got help to accomplish send data from Controller to a Block, and then display the info from Block in a template.
The thing is that I want to send a form and display the data from that form in the ...
0
votes
1
answer
2k
views
Show Order Details in Order History
Basically I want to show Customer's Order Details information in order History page under Customer Account My Order History Page.
Exactly what I'm did?
I have overridden
vendor/magento/module-...
1
vote
1
answer
502
views
Magento Blocks Positioning
I'm trying to move the social login block to the top of the page but i'm unable to find where to change this. I'v been searching and editing different files without success.
URL for customer login ...
2
votes
1
answer
279
views
Remove container in block class
I want to remove some items from a page when certain conditions apply. I got a solution but I'm wondering if there isn't any better way to do this.
Now the code that I have is for each block that I ...
0
votes
1
answer
631
views
Layout XML Error - Magento 2
I change the deploy mode to developer on Magento 2 and now I see the following error:
1 exception(s):
Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'block': This element is ...
0
votes
0
answers
47
views
Moving language block in footer not getting after reference block in magento2
I want move header language block into footer after copyright but it's display before copyright block
i have tried using
<move destination="footer-container" element="store_language" after="...
3
votes
1
answer
292
views
SOLVED Createblock definition in magento 2
i search around a lot about references of this function. but the documentation have a big lack. does somebody explain me this part of code (deeply) ?
$this->getLayout()->createBlock(...
2
votes
2
answers
736
views
Magento 2: How to add a div in below navigation?
I am trying to get a div displayed directly below the navigation on a theme which extends Luma
I have added the following into my Magento_Theme/layout/default.xml but cannot see any results. The ...
3
votes
2
answers
5k
views
How to Get Layout Name in which is block is placed
I have My block
<block class="Vendor\ModuleName\Block\Frontend\Linked" name="catalog.product.linked" template="Vendor_ModuleName::slide.phtml" />
in this file
app\code\Vendor\ModuleName\...
1
vote
1
answer
902
views
magento 2 createBlock from argument item
My custom module xml file contains the block code. I want to call that block code directly using createBlock method and set template to show in specific template. My block code is adding animated ...
2
votes
1
answer
166
views
Handling templates without a module name specified
I have a 3rd party extension installed and I needed to overwrite on block because I could not use events or plugins on it.
The block is added in the layout file like this:
<block class="Vendor\...
0
votes
0
answers
188
views
How do I create a "floating" widget/block?
I'm trying to create a floating widget/block that can sit over on the left of my website like the attached picture. I want to advertise my catalogue for download.
0
votes
2
answers
1k
views
Magento2 render custom block in adminhtml layout.xml
I can not render my custom block within my custom template,
Point is on newsletter subscriber, I extend newsletter_subscriber_form.xml,
Add container within my block but it says that template is ...
1
vote
3
answers
1k
views
Move block before Tab Magento2
i would like to create a banner on product view page and move this banner
AFTER the short description and before the tab content.
I user this code under catalog_product_view.xml
<move element="...
0
votes
1
answer
26
views
I have an error pointing to this block class but i'm not sure what's wrong with it.. (magento 2.2.5)
A validation error occured in an XML layout file
<block class="Magento\Cms\Block\Block" name="gbp_success_page-block">
<container name="gbp-fullwidth-hero-wrapper" as="heroWrapper" ...
3
votes
1
answer
104
views
Magento 2: How can I use two blocks in my homepage?
How can I use two different blocks in my homepage?
this code doesn't work:
<referenceContainer name="content">
<block class="Magento\Cms\Block\Block" name="test1">
<...
3
votes
2
answers
1k
views
Magento 2 - How can i move the category page title to the top of the catalog nav block on left?
I need to add the page title on the top of sidebar navigation block,
i tired with the following but still it renders below the layered navigation.
<move element="page.main.title" destination="...
0
votes
1
answer
2k
views
Magento 2 : Where is block code located
In the luma theme, in the home block, it starts with the code
div class="blocks-promo".
I would like to learn more these block classes so that I know how to use them going forward. i.e. I need some ...
1
vote
0
answers
2k
views
Magento 2 Add a block to a layout programatically?
public function __construct(
Context $context,
array $data = []
) {
parent::__construct($context, $data);
$block = $this->getLayout()
->createBlock('Magento\Framework\...
0
votes
1
answer
291
views
Magento 2 - Can't add static block to my theme
I use Magento 2.2.4 and I want to add a static block with the name "support" in the right side of the top menu, but what I try not working.
I try to add this in the phtml file
<?php echo $block-&...
0
votes
2
answers
672
views
Add a static block right under the main navigation, not wrapped in a widget, full width
I'm using Magento 2 with Luma theme, and I'm trying to add a block on the home page only, right under the main navigation, and I want to do it without any margin or padding, full width, basically not ...
1
vote
1
answer
340
views
Magento 2 : How Blocks are Displayed?
Why do we call in the list.phtml template
<?php echo $block->getChildBlock('addto')?> if it is already defined in the Layout. Will not it be rendered only because we have already specified it ...
0
votes
1
answer
191
views
Using Turn.js in Magento 2.2.2
I would like to have a section on my product page where customers can view my products using Turn.js (if there are any other similar plugins let me know!). I currently have an empty block setup.
Is ...
2
votes
1
answer
948
views
Why root block render automatically content in Magento 2
In Magento 1 we have the possibility the add a block in a root block so it will not be displayed because root is not a core/text_list block type (structural block), it doesn't render automatically the ...
0
votes
1
answer
34
views
Which of these Magento statements is correct?
I am doing some M2 fundamentals online training, the system is telling me that one of these answers is incorrect...
Question 1: Which of these directives will assign a template to a block in a layout ...
0
votes
1
answer
740
views
404 when submit Forgot password form added in custom theme
I have added a forgot password form to all the pages, by adding the following line in the default.xml of my custom theme:
<block class="Magento\Customer\Block\Account\Forgotpassword" name="...
0
votes
1
answer
324
views
Insert new block for installment information in catalog_product_view
I have two situations that I cant solve and need help.
I'm trying to show installments information in my product page, so I've created a new module, with a block, a helper (to get module configs) and ...
0
votes
1
answer
59
views
The serialization block does not work
I want to create a dynamic menu and link it to the pages. In the tab "Create Link" I create a link for the menu, and in the "Links Grid" tab I have to assign this link to any cms page.
I now need to ...