Questions tagged [custom-block]
The custom-block tag has no usage guidance, but it has a tag wiki.
173
questions
0
votes
0
answers
36
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.
0
votes
0
answers
31
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:...
1
vote
2
answers
87
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 ...
0
votes
2
answers
269
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 ...
1
vote
0
answers
669
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 ...
1
vote
1
answer
428
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">
...
0
votes
3
answers
520
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-...
0
votes
1
answer
77
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?...
0
votes
1
answer
334
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 ...
0
votes
2
answers
453
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"
...
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.
0
votes
3
answers
971
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 (...
0
votes
1
answer
28
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="...
1
vote
0
answers
107
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-...
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 ...
0
votes
3
answers
2k
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 ...
0
votes
1
answer
558
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 ...
2
votes
0
answers
662
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\...
0
votes
1
answer
695
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:...
0
votes
0
answers
30
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 ...
0
votes
1
answer
693
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 ...
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
0
votes
2
answers
920
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!
0
votes
1
answer
778
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/...
0
votes
1
answer
278
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 ...
0
votes
1
answer
307
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 ...
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....
0
votes
1
answer
352
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=...
1
vote
1
answer
64
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.
1
vote
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
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 ...
0
votes
1
answer
334
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
0
votes
4
answers
701
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/...
0
votes
1
answer
106
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\...
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
<...
0
votes
1
answer
196
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....
1
vote
2
answers
184
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>
<...
0
votes
0
answers
446
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\...
3
votes
2
answers
861
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\...
0
votes
1
answer
399
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 ...
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->...
0
votes
1
answer
69
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,
...
1
vote
1
answer
343
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\...
1
vote
2
answers
309
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->...
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"...
3
votes
0
answers
46
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, ...
0
votes
1
answer
641
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 ?
0
votes
1
answer
107
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 ...
0
votes
1
answer
2k
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 ...
0
votes
1
answer
278
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
...