Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [custom-block]

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

1
vote
1answer
23 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
0answers
33 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
29 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
1answer
36 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
1answer
71 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
0answers
223 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 ...
0
votes
1answer
18 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
149 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
0answers
316 views

Magento 2: How to show review form in a custom block

I have removed the review tab. I wish to add review form in custom block. Please provide me a solution to show review form in a custom block. Please provide me a solution in magento 2
0
votes
3answers
408 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
132 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
314 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
51 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
46 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:
1
vote
0answers
50 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 ...
3
votes
2answers
62 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 ...
3
votes
1answer
423 views

Magento2 not getting post data from ui component phtml file

I have implemented admin form using UI component. In that, I have 3 separate tabs. Among 3, I have displayed one tab using custom phtml file by using following code in ui component form xml file <...
1
vote
3answers
648 views

How to add a custom block after product info in product view page magento2?

How to add a custom block in product view page after product info. I have created a custom block via admin and its id is category-block-1 I have a custom them and i tried override catalog_product_view....
0
votes
2answers
607 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
2answers
194 views

Magento2 - accessing helper in controller

I have helper class that has constructor that takes following parameters: Context, Cart, Session, CollectionFactory. It derives from \Magento\Framework\App\Helper\AbstractHelper. I would like to use ...
2
votes
1answer
48 views

Block is not shown on custom page

I am a new in Magento. I have installed Magento 2.2. and created 1 module with custom page. There is 1 block on this page, which has to be shown on it. But it is not shown. Please, help me to resolve ...
2
votes
1answer
160 views

Pass multiple variables to view

We can pass a variable to a .phtml view file like this: $currentTime = date("H:i", time()); $someValue = 123; $this->loadLayout(); $this->getLayout() ->getBlock('newsletter_popup') ...
0
votes
1answer
219 views

How to display the current time in .phtml with caching enabled?

I created a really simple block in my child theme: /Magento_Theme/layout/default.xml: <referenceContainer name="content"> <block class="Magento\Framework\View\Element\Template" name="...
0
votes
1answer
62 views

Error in getting block in a template

I am a magento beginner and need help with creating a new custom block. Basically, I just want the block to show "hello" if it is called. Module installation xml file, app/etc/modules/...
0
votes
2answers
333 views

Magento custom block not showing on frontend

I'm trying to create custom block to show some info on the page, but got some weird issue that this block not showing. Already broke my brain by trying to debug why. There are some code snippets: ...
2
votes
3answers
84 views

Create block between header and main

I am facing issue with creating a block between header.container and main. so that I can put the banner over there. And I need the banner in home page only please help me for the same.
2
votes
1answer
467 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://...
1
vote
1answer
33 views

Adding a preview product section on the product page

I am fairly new to the Magento platform so excuse my lack of knowledge! I'm working on a Magento 2 project. I need to add a preview section for my products. Ideally, it would be between the product-...
0
votes
1answer
62 views

Setting custom data for block in layout

I'm trying to set some custom data for my block in local.xml: <cms_index_index> <reference name="after_body_start"> <block type="core/template" template="custom.phtml"> ...
1
vote
1answer
835 views

Add custom block in Magento 2 admin dashboard

Is there any way to add a custom block in magento 2 admin dashboard? I have a requirement to add custom table in dashboard. Can anyone help me? My current magento version 2.2.1
0
votes
0answers
31 views

Magento 2, adding block to a template which does not have xml file

I need to add below block (my custom moudule) to <referenceContainer name="content"></referenceContainer>strictly, but the target template (third-party module) is created via plugin and ...
1
vote
1answer
898 views

Add block to cart summary in magento 2

How can i add custom text block into cart summary?
1
vote
1answer
798 views

Adding a new block to a Product detail page above Add to Cart block

So I'm trying to add a block to the product page. The block will simply output an attribute if it exists for that particular product. In this case it is outputting the bottle size. Now I've got the ...
0
votes
1answer
3k views

how to set custom template in custom block file in magento 2 [duplicate]

How to set custom template in custom block file. I have created a template which contains paragaraph. I need to set this template in my block file . So What is the syntax to set template. I have ...
3
votes
1answer
685 views

How can I insert block before breadcrumbs or just after menu on every page?

I would like to add block to the website (in general on every page) just below menu but not into header, "root" eventually "content". I managed to add it into content but it's not what I wanted. => ...
2
votes
1answer
2k views

Programmatically create and append a block to another block

I've declared a plugin that creates and adds a block programmatically if a condition is true. However, my code outputs nothing, it's like if the created block is not rendered at all. etc/di.xml <...
0
votes
2answers
397 views

Magento 1.9.3 calling a custom block in cart page unsuccessful

I have a very basic module: app/code/local/Demo/Custom/Block/Giftproducts.php class Demo_Custom_Block_Giftproducts extends Mage_Core_Block_Template { public function getGiftProducts() { //...
1
vote
1answer
85 views

Magento Irregular caching of my custom block

I have created a custom block to display 10 random products on my homepage, and for load time etc, it is a bad idea to request random products from the database each load. Thus, have incorporated the ...
1
vote
1answer
370 views

Block is not calling properly in magento 2 custom module

I have a custom theme in magento 2 website. In home page i called a banner slider(Banner_slider is a custom module) I called the slider like this in home_content.phtml(design/frontend/company/...
0
votes
1answer
412 views

Magento 2 - controller block not displaying template

I want my module controller to show content inside of store layout (eg show header, then my controller data, then footer, so it will look like being part of the store, not on a blank page). I created ...
0
votes
1answer
394 views

Call third party module block in CMS page in magento 2

Is there any way to insert custom block in CMS page in Magento 2.2 alike inserting CMS block in CMS page?
1
vote
2answers
607 views

Where is Content block for <reference name=“content” tag

if I use a layout such as: <layout> <{handle}> <reference name="content"> ... {blocks} ... According to docs and tutorial the reference's name attribute points ...
0
votes
2answers
365 views

How to insert block from custom module into home page?

How can I insert custom block into the Home Page using custom layout.xml ?
3
votes
0answers
44 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
1answer
72 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.
2
votes
1answer
501 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
365 views

How to override an extension admin template

There is an extension which I want to add a little more features on. To achieve that I need to modify two .phtml files in app/design/adminhtml/default/default/template/Orderpreparation/Packing/...
1
vote
1answer
408 views

Display Polls with a custom template shows only empty results

Meta Magento 1.9.2.1 Custom Template Poll works fine when in sidebar Poll works fine when loaded by layout xml History Based on this information: http://inchoo.net/magento/magento-frontend/...
1
vote
1answer
2k views

Magento 2: How to add custom form on category page?

I am using Magento 2.1 and I am trying to add one custom form in catalog page. I override the catalog_category_view to my custom module and use this code <referenceContainer name="columns.top"&...
1
vote
2answers
913 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 ...