Questions tagged [custom-block]

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

Filter by
Sorted by
Tagged with
1 vote
0 answers
194 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 ...
user avatar
  • 143
1 vote
1 answer
153 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"> ...
user avatar
  • 135
0 votes
3 answers
128 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-...
user avatar
0 votes
1 answer
44 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?...
user avatar
  • 306
0 votes
1 answer
82 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 ...
user avatar
0 votes
2 answers
188 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" ...
user avatar
0 votes
1 answer
599 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.
user avatar
  • 497
0 votes
3 answers
454 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 (...
user avatar
  • 57
0 votes
1 answer
20 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="...
user avatar
1 vote
0 answers
76 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-...
user avatar
  • 1,389
0 votes
1 answer
1k 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 ...
user avatar
0 votes
3 answers
1k 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 ...
user avatar
0 votes
1 answer
209 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 ...
user avatar
  • 121
1 vote
0 answers
253 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\...
user avatar
  • 782
0 votes
0 answers
282 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:...
user avatar
  • 591
0 votes
0 answers
23 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 ...
user avatar
  • 145
0 votes
1 answer
125 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 ...
user avatar
  • 145
0 votes
1 answer
643 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
user avatar
  • 1,389
0 votes
1 answer
659 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!
user avatar
0 votes
1 answer
284 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/...
user avatar
0 votes
1 answer
162 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 ...
user avatar
  • 103
0 votes
1 answer
204 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 ...
user avatar
2 votes
2 answers
2k 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....
user avatar
  • 176
0 votes
1 answer
296 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=...
user avatar
  • 176
1 vote
1 answer
40 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.
user avatar
1 vote
3 answers
2k 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
user avatar
  • 1,389
0 votes
2 answers
2k 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 ...
user avatar
0 votes
1 answer
235 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
user avatar
0 votes
4 answers
601 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/...
user avatar
  • 75
0 votes
1 answer
99 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\...
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 <...
user avatar
  • 53
0 votes
1 answer
173 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....
user avatar
1 vote
2 answers
169 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> <...
user avatar
0 votes
0 answers
351 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\...
user avatar
  • 1,127
3 votes
2 answers
561 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\...
user avatar
  • 1,127
0 votes
1 answer
373 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 ...
user avatar
  • 1
1 vote
0 answers
26 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->...
user avatar
  • 1,127
0 votes
1 answer
35 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, ...
user avatar
  • 1,127
1 vote
1 answer
227 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\...
user avatar
  • 2,089
1 vote
2 answers
245 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->...
user avatar
  • 1,127
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"...
user avatar
  • 187
3 votes
0 answers
44 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, ...
user avatar
  • 31
0 votes
1 answer
380 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 ?
user avatar
  • 3
0 votes
1 answer
64 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 ...
user avatar
  • 1,668
0 votes
1 answer
1k views

Pass the value from the block class to the phtml file and not working in custom module

Hi all I need your help, I am writing a new module (quote request, when user go to the product details page, they can request a quote for the product) I created a form and display in the product ...
user avatar
  • 109
0 votes
1 answer
154 views

How to get Magento 2 product image on custom phtml by product id Without loading product collection

I need product image on custom phtml in magento 2. Product is collection is a array not object. I just want to product product_base_image , without loading product collection. I tried <?php ...
user avatar
0 votes
1 answer
634 views

Getting "Invalid block type" exception on Magento 1.9.3.7 for custom template inside catalog/product

I am facing a strange issue. I am getting "Invalid block type" exception for a custom block that I have created. I am using the block like this {{block type="example/menu" name="product.menu" ...
user avatar
1 vote
3 answers
5k views

Magento2: How to call custom block in phtml file

I have created a custom block page. I want to call custom block to another phtml file. When I called custom block in xml file is working. But when I called custom block in phtml file is not working. ...
user avatar
  • 1,127
0 votes
1 answer
2k views

Magento 2 Custom Module Controller getLayout , createBlock, getBlock , append Fatal error:

namespace My\Module\Controller\Index; use Magento\Framework\App\Action\Context; class Index extends \Magento\Framework\App\Action\Action { protected $_resultPageFactory; public function ...
user avatar
2 votes
4 answers
1k views

Move Custom tab at top of left sidebar customer dashboard

I want to move my custom tab from bottom to top in customer dashboard left sidebar. I tried below thing <referenceBlock name="customer-account-navigation-account-link" remove="true"/> &...
user avatar
  • 1,539