Questions tagged [custom-block]

The tag has no usage guidance, but it has a tag wiki.

Filter by
Sorted by
Tagged with
0 votes
0 answers
44 views

how to block/disable words in the search field?

I'm having a search with inappropriate words in Magento, how can I block it?
Bruno Depieri Barduchi's user avatar
0 votes
0 answers
18 views

Arguments shared between multiple instances of same block

I have created a custom block and tried to insert it multiple times in the same page: <block class="MyCompany\MyModule\Block\Producttabs\CategoryProducts" name="category.products....
zekia's user avatar
  • 620
0 votes
1 answer
185 views

Magento 2 Add Dynamic Row in admin form using Block

i have created one form in backend using block now i want to add dynamic row field in my custom form using block. how can i achieve that. Thank you in advance.
quickshiftin's user avatar
0 votes
0 answers
39 views

Child block is not loaded when the main block is called in a CMS page

I made a custom module block with the following layout: <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:...
mugnozzo's user avatar
  • 103
1 vote
2 answers
326 views

Insert a custom block into the $block->getChildHtml('customer.form.register.extra') placeholder in register.phtml

I want to insert a custom block into the $block->getChildHtml('customer.form.register.extra') placeholder in the customer registration form - called in the Magento_Customer::form/register.phtml ...
David Lightman's user avatar
0 votes
2 answers
299 views

How to insert custom block below product name on checkout_cart_index.xml?

I want to insert my custom block in checkout_cart_index.xml page below the product name. But I do not know the name of that referenceContainer. What I want to achieve is, if any product is added in ...
Muhammad Muiz Ather's user avatar
1 vote
0 answers
786 views

magento 2.4 show product options in custom template

On the frontend, I have a custom template with some tabs: when the user switches among tabs, he can load a simple product. Each tab loads a different product. This works fine with normal products but ...
Lou Nik's user avatar
  • 443
1 vote
1 answer
476 views

Disable specific Block is getting cached in Magento2

I am trying to disable cache for specific block, Have used below code. app\code\Vendor\Module\view\frontend\layout\default.xml <referenceContainer name="header.panel"> ...
Manjunath's user avatar
  • 177
0 votes
3 answers
647 views

Magento 2, How to call Controller custom function?

I have a controller with custom function getPost(). I want to call this function from my phtml My phtml code: <form id="my-form" method="POST" action="<?php echo $block-...
Alok Kumar's user avatar
0 votes
1 answer
103 views

What is Custom Block and Custom Block 2 for on the Product page?

Magento 2.4.2 Smartwave Porto theme I see the Short Description and Description is in the Content tab on the Product page (in Admin). What exactly would we use the Custom Block and Custom Block 2 for?...
Allysin's user avatar
  • 260
0 votes
1 answer
391 views

how to add a block that only shows on home page

I have created a block within my new theme, but it is showing on all pages, I need it to only show on the home page and when logging in or going to another page it does not show create it inside ...
geracros's user avatar
0 votes
2 answers
532 views

$block->getNameInLayout returns block's name but for configurable product returns alias

I'm trying to add a custom template just after ADD To Cart Button in product's page. In catalog_product_view.xml its defined as bellow: <block class="Magento\Catalog\Block\Product\View" ...
jefferson's user avatar
0 votes
2 answers
1k views

How to add country code dynamically in telephone field on Checkout in Magento 2

I want to develop custom module that is used for adding country code field before telephone field on checkout page in magento 2.3.4.
Deep Shah's user avatar
  • 565
0 votes
3 answers
1k views

Header and Footer in Luma theme

I want some customization theme luma in my magento 2 website, so I need add in header for all pages banner - custom blocki created - (banner-section) below menu and in footer I need add custom block (...
Lerry's user avatar
  • 69
0 votes
1 answer
29 views

Magento 2: full page Mechanism

I have a question. If full page is enable and If I do not metioned below code in my block declareation layout xml file <arguments> <argument name="cache_lifetime" xsi:type="...
Niraj Patel's user avatar
1 vote
0 answers
114 views

When select a particular payment method how to add a custom block in order summary block in checkout page in magento 2

When selecting a particular payment method how to add a custom block in the order summary block in checkout page in Magento 2 I used this extension https://github.com/bragento/magento2-cash-on-...
Divya Sekar's user avatar
  • 1,475
0 votes
1 answer
2k views

How to get a custom product attribute in the sales order view?

I am trying to fetch the values from a custom attribute (multiselect attribute) of the ordered products, and display them in the order view in a new section. In order to do that, my plan was to create ...
audio-engineer's user avatar
0 votes
3 answers
3k views

Magento 2 Add custom block to Product Detail Page, between product gallery and detail tab

I want to add a custom block to show some text between the product gallery and the description. What is the best practice to do this, do I need to create my own module? and how do I override the ...
Magento Learner's user avatar
0 votes
1 answer
637 views

Add custom block in transnational email

I am using Magneto 2.3.5-p1, I want to add some custom values in my New Order Transactional email template using block, for that, I have created a custom template from Marketing->Eamil Template and ...
ishaq's user avatar
  • 195
2 votes
0 answers
739 views

Block class does not exist

I've been failing, trying to add a custom block to my module. I got the error message : Exception #0 (Magento\Framework\Exception\LocalizedException): Invalid type of block: Cpy\...
Claims's user avatar
  • 1,164
0 votes
1 answer
826 views

Set current product for custom block in category list

I have added a custom block in each product item, in category list page: catalog_category_view.xml <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:...
zekia's user avatar
  • 620
0 votes
0 answers
35 views

How to show only Product Name and price in specific category magento 2

I am working on specific category so I need to show some customized changes in that for that I need to show only product Name and price and by clicking on that I have continued button I am confused ...
Jaymin's user avatar
  • 155
0 votes
1 answer
809 views

Add Custom block and changes for specific category

I have created the category and added my custom code in that, I have also my custom block which I created for that I have used catalog_category_view.xml file but it affects in all other my category ...
Jaymin's user avatar
  • 155
0 votes
1 answer
1k views

How to add a custom block in sales order page frontend in magento 2

How to add a custom block in sales order page frontend in magento 2
Divya Sekar's user avatar
  • 1,475
0 votes
2 answers
984 views

Magento 2.3 show Block only when customer not logged in

I need to show a Block on my product detail page when the customer is not logged in only. What is the best way to achieve that in Magento 2.3? Thanks in advance!
Th. Schott's user avatar
0 votes
1 answer
932 views

Get list of products on current category page in custom block magento 2.3

I want to get the list of products currently visible on category page in a custom block. I tried using <?xml version="1.0"?> <page layout="1column" xmlns:xsi="http://www.w3.org/2001/...
Arpit Gupta's user avatar
0 votes
1 answer
319 views

Place custom block below cart table?

I need to place a custom block below the cart table on the cart page in magento 2. At the moment I'm only able to place it above, so it's displayed above the table AND the cart summary sidebar. Any ...
trnc's user avatar
  • 103
0 votes
1 answer
327 views

$block is not working in override phtml file

I override totals.phtml, but when I am calling my custom block in it, its not working. File path: Magento/vendor/magento/module-sales/view/adminhtml/templates/order/totals.phtml Override File ...
Sagar Parikh's user avatar
2 votes
2 answers
3k views

Exception in Magento log: the element can't have a child

I found the following errors in the exception.log and debug.log files in /var/log folder: [2019-12-17 16:23:05] main.CRITICAL: The element "product.info.options" can't have a child because "product....
Max's user avatar
  • 176
0 votes
1 answer
376 views

How to call displayProductStockStatus() method from a custom block?

in catalog_product_view.xml of my theme I have a block like this `<block class="Magento\Catalog\Block\Product\View" name="extra.product.info" template="product/view/extra-product-info.phtml" after=...
Max's user avatar
  • 176
1 vote
1 answer
74 views

How to add custom fee block in total block checkout?

I have two custom modules. One is onestepcheckout and another is for a custom fee. I need to add a customs fee block into the onestepcheckout. Thanks in advance.
Mayur Sisodiya's user avatar
2 votes
3 answers
3k views

How to add a custom block within checkout cart summary in magento 2

How to add a custom block within checkout cart summary in magento 2
Divya Sekar's user avatar
  • 1,475
0 votes
2 answers
3k views

Magento 2: How to add PHP code into CMS Block using .phtml file

I have followed the below links to try and get PHP code into CMS Block which links to a .phtml file, with no avail. Show content of phtml file on static block Magento 2 PHP code in Block Currently ...
Barry Hughes's user avatar
0 votes
1 answer
360 views

Magento2: Add Custom table next to Product attribute in Product Detail Page

How to add Custom table next to product attribute in a product detail page
Dev Space's user avatar
0 votes
4 answers
749 views

Magento 2 Custom query to display selected product in Custom block

I have some product ids . Currently I can display products in category using {{block . But now I am developing a custom block in app/design/frontend/Alothemes/bencher6/Magento_Theme/templates/myphp/...
John's user avatar
  • 75
0 votes
1 answer
109 views

Magento 2 : Face Error while create a custom block

I got the below error when create the Custom Block for the HTML sitemap. Error filtering template: Warning: Declaration of Vapor\Sitemap\Block\Sitemap\Category::_getHtml(Magento\Framework\Data\...
AKM's user avatar
  • 87
0 votes
1 answer
2k views

Magento 2.3 add custom block under each product in category page

I need to overwrite the product listing (category) page, a custom form needs to show after that product information. So I have found that already an extension is overwriting that page as below <...
Antony's user avatar
  • 63
0 votes
1 answer
198 views

Convert Magento 1 Script to Magento 2 (Get Order ID by custom Block)

I am trying to get the ORDER ID, BaseSubtotalInclTax, BaseShippingInclTax, and TaxAmount on the success.phtml page by using custom block. On Magento 1 I had to put the following script in the success....
Γκρεβένης Παναγιώτης's user avatar
1 vote
2 answers
188 views

Display custom block on Homepage

I have a problem with custom module and displaying custom block template on homepage. I create a custom module to show product form specified category. my config.xml file: <config> <...
SebastianT's user avatar
0 votes
0 answers
485 views

Magento2: Custom module block rendered twice

I have made a custom module. But block rendered twice. My local system is working fine. But on Production is getting the error. Anyone help me with this. Controller <?php namespace Codism\...
Masud Shaikh's user avatar
  • 1,189
3 votes
2 answers
937 views

Magento2: Custom module not working

I have created new module but it is not working.Please Help me on this. registration <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\...
Masud Shaikh's user avatar
  • 1,189
0 votes
1 answer
411 views

Not able to disable block cache without affecting Magento FPC

I have created a custom block where I am showing the number of items in the cart and also loggedin the customer name. I am getting correct count and customer name on checkout page.But not on any other ...
Sameer's user avatar
  • 1
1 vote
0 answers
27 views

Magento2: Block Controller Issue

When I call to controller first time showing my data on page after some seconds data not showing on page. page is showing blank. Controller public function execute() { $itemid = $this->...
Masud Shaikh's user avatar
  • 1,189
0 votes
1 answer
70 views

Magento2 How can i create block on popup with product details?

I want to show product details on popup using controller. So how is it possible? $htmlCatInfo = $layout->createBlock( \Tigren\Ajaxcart\Block\BuildProductInfo::class, ...
Masud Shaikh's user avatar
  • 1,189
1 vote
1 answer
372 views

How I can add custom block to layout using php in Magento 2

I have created a custom block, as I want to add this layout to my current layout. Following is my block: <referenceContainer name="sidebar.main"> <block class="Vendor\ModuleName\...
Waqar Ali's user avatar
  • 2,319
1 vote
2 answers
328 views

Magento2: Block not created from controller

How to create block from controller by ajax method? $result = $this->resultJsonFactory->create(); $resultPage = $this->_resultPageFactory->create(); $block = $resultPage->...
Masud Shaikh's user avatar
  • 1,189
1 vote
1 answer
67 views

Block not appearing when giving custom type

I am trying to nest one block inside another block but the child block isn't showing when I set custom block type. If I set both blocks as page/html then both blocks show fine: <?xml version="1.0"...
Guerrilla's user avatar
  • 187
3 votes
0 answers
47 views

How to show full product page on home (but show different custom block than product page)

I have a one product store in Magento 2, and want to make it easy to order as soon as possible. So i want to have on the homepage everything that there is on the product page, like order button, ...
Niels's user avatar
  • 31
0 votes
1 answer
693 views

How to add custom block with image

Add custom images div like this sample app block. How can we create it for our custom theme ?
patel's user avatar
  • 3
0 votes
1 answer
109 views

Add custom block to layered navigation - best to Price

Is anyone know how I can add custom block to price filter in layered navigation? I curently moved my block with jQuery, but what if someone add more attributes? Maybe I could add class to price ...
BartZalas's user avatar
  • 1,757