Questions tagged [custom-block]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
31 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 ...
1
vote
1answer
25 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
1answer
23 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
2answers
1k views

How to create a custom Widget with custom conditions

I need to create a custom widget using custom conditions to show a product list in the home page. I have to show the option to add multiple inputs in the widget form to set conditions that I need. ...
1
vote
1answer
30 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.
11
votes
1answer
971 views

Magento2: Conditionally replace block template and class the right way

This rather trivial requirement turns out be quite a pain for us in recent days, as we couldn't find a satisfying existing solution, yet. The Task We are trying to replace certain blocks with a ...
0
votes
2answers
877 views

Magento 2 Invalid Block Type in Custom Module?

How can I Rectify Invalid Block Type Error in my custom module. I created a custom module in magento 2 for overriding default product list page with separate phtml file I am calling them in category ...
1
vote
3answers
99 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
2answers
710 views

Invalid block type while accessing the custom block (Magento 2)

Error in magento 2.0.11 while accessing custom block Invalid block type: Tomrain\Appcustomizer\Block\Customizepage #0 /var/www/html/appcustomizer-tshirt-M2/vendor/magento/framework/View/Layout/...
0
votes
2answers
65 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 ...
2
votes
1answer
694 views

Add phtml to Customer Account Edit in Adminhtml

I tried to add phtml to customer account edit in backend like this: app/code/Namespace/Module/view/adminhtml/layout/customer_index_edit.xml <?xml version="1.0"?> <page xmlns:xsi="http://...
0
votes
1answer
32 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
1
vote
3answers
732 views

Directory of custom block in magento 2.1

I create a file custom block php. Directory is: app\design\frontend\Vendor\default\Magento_Theme\Block\CustomBlock.php CustomBlock.php: class CustomBlock extends \Magento\Framework\View\Element\...
1
vote
2answers
1k views

Magento2: Calling upsell block from phtml is not working.

I want get up-sell product block. when I am working with XML script block is working. but when I am trying to this in .phtml file it's showing nothing .I do not what is wrong with .phtml and XML data ...
0
votes
1answer
856 views

How to override or extend Product List Page template to show Icon on Product Images in Magento Extension

Consider the Below Image I want to show an Icon on the Image of each product. I am developing an extension and I want to do this task via that extension, independent of theme. How can I achieve this ...
0
votes
0answers
8 views

How to display a custom block inside a group of atributes en Magento 2 backend

I need to display a custom block inside a group of atributes in Magento 2 backend. I follow this guide: magento 2 - How to create a custom "admin" block and display it on an existing Admin ...
0
votes
4answers
145 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
0answers
32 views

Magento 2.3 Alter Custom block title

Trying to alter the text from Custom Block to Shipping & Payment, cant seem to find it anywhere, Using Magento 2.3 Im using etheme-shopy as my template, the static block to alter the text is ...
0
votes
1answer
54 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\...
2
votes
2answers
673 views

Check if customer logged in not working

I have a block to add link at top based on if customer login like this, when i'm at myaccount page the header link show the right one, but when i go to other page it shows the wrong one, here's my ...
0
votes
1answer
204 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
1answer
45 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
2answers
43 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
0answers
65 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
2answers
112 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
1answer
107 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
0answers
23 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
1answer
23 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
1answer
41 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
2answers
49 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->...
0
votes
1answer
78 views

Custom block on product page if product is out of stock / in stock

I want to add two custom blocks on product page - one to be displayed if product is in stock and the other one if product is out of stock.
1
vote
1answer
44 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"...
4
votes
2answers
638 views

Magento1 createBlock method returns “bool(false)” in livehost

I've made a module that, in my localhost works fine.. The block shows up and ok, but in "livehost" the block don't appear, so I created a controller to make some tests and see what is the problem. ...
0
votes
1answer
39 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 ...
3
votes
0answers
34 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
1answer
47 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 ?
1
vote
1answer
386 views

Module not working after namespace magento 2

I used this module https://github.com/sohelrana09/magento2-module-additional-shipping-block to add a custom block to the shipment method, when I moved it to another namespace , it does not work ...
0
votes
1answer
531 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 ...
3
votes
0answers
46 views

Load products page inside phtml page Magento 2

I have a custom .phtml page, and i want to insert products page which contain layered navigation like this: so i already have filtered product collection, is there a chance to do call this products ...
0
votes
0answers
429 views

Magento 2.3 - Extend layout to add new custom block after existing block from another module

What I hope to accomplish is adding a new option to an existing menu of options in category edit page, specifically adding a new option below the "Match products by rule" switch toggle. This menu is ...
1
vote
1answer
3k views

Adding custom block to catalog product view

I'm currently making my own module, but i'm having trouble with just displaying a block in the catalog product view. I've added this line to default/layout/catalog.xml <block type="catalog/...
0
votes
1answer
21 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 ...
0
votes
1answer
334 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" ...
0
votes
3answers
1k 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. ...
0
votes
1answer
445 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 ...
2
votes
4answers
590 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"/> &...
0
votes
1answer
95 views

Magento2: Custom block data not showing on frontend side

I have created a simple module. But block data not display front end. please find the below code Block <?php namespace Codism\Csr\Block\Index; class Additional_Csr extends \Magento\Framework\...
1
vote
1answer
86 views

How to create page with left sidebar In magento 2.1.15?

I want to create page or block with sidebar. if I click customer service then I want to see customer service info etc. 2nd Image : 3rd Image:
3
votes
2answers
73 views

Block fails on (live) server but works on localhost?

I've added a custom block to catalog/product/view.phtml using echo $this->getLayout()->createBlock('colorchart/colorchart')->setTemplate('colorchart/colorchart.phtml')->toHtml(); and it's ...
1
vote
0answers
75 views

Magento 2, Dynamic add or refresh block in sale order page

Using Magento 2, Sale-Order, Block info + history. How to refresh block in sale order page after summit comment successful. In image below I need refresh "block comment preview" after block comment ...