Questions tagged [blocks]

denotes questions about the `Block` classes.

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

Magento 2.3 Add/Update Block

In Magento 2.3 EE, If we are going to add or update block, there we can get the Row and inside that we have to place HTML Code. But this row makes my page layout which is different than the previous ...
0
votes
0answers
10 views

Magento 2.3.1 in multi shipping overview Post controller page not working go to Success page

Magento2.3.1 in multi shipping overview Post controller page not working go to Success page Page Redirect is not working how to solve this issues ? Payment id is not showing on this page ???? vendor/...
1
vote
2answers
27 views

How to add block html content display in particular div or any particular place by xml file?

I created customer_account_login.xml to add block. <?xml version="1.0"?> <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:...
0
votes
0answers
16 views

Error on Category Page

I am getting error on Category Page Magento 2.2.6 ( Element 'block', attribute 'remove': The attribute 'remove' is not allowed) 1 exception(s): Exception #0 (Magento\Framework\Config\Dom\...
0
votes
0answers
26 views

Magento Captcha in checkout page

I have implemented a custom block in Magento 2. The block contains a form, which will be called in onepage.phtml. I am able to retrieve block contents in onepage.phtml using: $this->getLayout()-&...
2
votes
1answer
25 views

Remove container in block class

I want to remove some items from a page when certain conditions apply. I got a solution but I'm wondering if there isn't any better way to do this. Now the code that I have is for each block that I ...
1
vote
0answers
24 views

template is not working magento 2 admin customer_index_edit

I am calling a js function form this file current.phtml like this <script type="text/javascript"> require([ 'jquery', 'jquery/ui'], function($){ $(document).ready(function($) { updateAjax()...
2
votes
0answers
26 views

ReferenceError: {var} is not defined

I have a problem with the frontend_model of the system.xml This is the system.xml <field id="words" translate="label" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="1"> ...
0
votes
1answer
28 views

Layout XML Error - Magento 2

I change the deploy mode to developer on Magento 2 and now I see the following error: 1 exception(s): Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'block': This element is ...
0
votes
0answers
14 views

Get configValue in _prepareToRender function of a block

I want to get the configValue of system.xml in this block <?php namespace Module\Vendor\Block\Adminhtml\Menu\Field; use Magento\Config\Block\System\Config\Form\Field\FieldArray\...
1
vote
2answers
35 views

How to get block from controller in magento 2

I want to get block Magento\Catalog\Block\Product\ProductList\Toolbar, I tried this code but it not work and show error Type Error occurred when creating the object: `Vendor/Module/Block/Search` My ...
0
votes
0answers
30 views

Moving language block in footer not getting after reference block in magento2

I want move header language block into footer after copyright but it's display before copyright block i have tried using <move destination="footer-container" element="store_language" after="...
0
votes
2answers
45 views

Template filter error: Type Error occurred when creating object

I am facing following exception Template filter error: Type Error occurred when creating object I am getting this exception when I am injecting block \Magento\Catalog\Block\Product\ListProduct in ...
2
votes
0answers
32 views

Take value of a field in a block and place it in another field

I have a problem taking values from a system.xml field to show them in another field. This is the system.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-...
2
votes
0answers
22 views

Cache life time with varnish

Magento Magento\Framework\View\Element\AbstractBlock has method getCacheFiletime, it return lifetime of cache in seconds. How it will work with varnish?
3
votes
1answer
17 views

Magento2: Phtml file not visible on PDP

I have create a module which consists an extra button on the product description page . For this I have added a layout catalog_product_view.xml which is below. <?xml version="1.0"?> <page ...
0
votes
0answers
22 views

Overwrite block layout inside text_list (content) blocks

I re-developed the whole category page in a layout.xml file included in my custom module, trying to reuse the block names. I needed to change many block (type) classes. I had read that by redefining ...
3
votes
1answer
26 views

SOLVED Createblock definition in magento 2

i search around a lot about references of this function. but the documentation have a big lack. does somebody explain me this part of code (deeply) ? $this->getLayout()->createBlock(...
0
votes
1answer
27 views

How to remove side bar of best seller in my account page of Magento 2

I want to remove sidebar of best seller in My account page of magento 2
3
votes
1answer
32 views

Magento 2 - Argument 2 missing error on overriding file

I am trying to override Magento\Catalog\Block\Category\View added this code in di.xml <preference for="Magento\Catalog\Block\Category\View" type="Naheed\AllProducts\Block\Category\View" /> ...
3
votes
0answers
22 views

insert different block in the middle of block content

I have a phtml for a block like this : app/code/Vendor/Modul/view/frontend/templates/main.phtml <div class="business-container"> <nav class="mini-head"> </nav> <div class="...
0
votes
1answer
29 views

Magento 2 | is it possible to set block class by referencing a block?

I'm currently rewriting a layout file: <referenceBlock name="checkout.cart.totals> <!-- some stuff --> </referenceBlock> Is it possible to set the block class here? Thanks in ...
0
votes
1answer
24 views

Magento 2. Magento\Framework\View\Element\Text is not rendering

I'm trying to use the Magento\Framework\View\Element\Text block, in a custom view but the output is not rendering. This is my layout file <?xml version="1.0"?> <page xmlns:xsi="http://www....
2
votes
2answers
30 views

Magento 2: How to add a div in below navigation?

I am trying to get a div displayed directly below the navigation on a theme which extends Luma I have added the following into my Magento_Theme/layout/default.xml but cannot see any results. The ...
1
vote
1answer
17 views

how to move the custom block middle of the page in Magento 2

I added custom block in home page Magento 2, but it's showing in the top of the page I want to move to after banners how can I achieve this? cms_index_index.xml <?xml version="1.0"?> &...
0
votes
1answer
25 views

How can i extend magento 2 ListProduct Block class in any Php class and how can i used that?

class My_Catalog_Block_Product_List extends \Magento\Catalog\Block\Product\ListProduct { } productTemplate = 'product.phtml'; $productList = new My_Catalog_Block_Product_List(); $productList->...
1
vote
1answer
47 views

Magento 2 blocks and templates

Following are the 4 conditions. Single block and multiple templates - I think this is possible and we use it frequently while customizing Magento. Multiple blocks and single template - Never seen ...
2
votes
0answers
55 views

main.ERROR: Unable to resolve the source file for

if we do any modifications or if we add any image in tm_slider block and click on save button it is taking much time and getting 504 gateway time error and website is also not working 10 t0 15 mins at ...
1
vote
2answers
29 views

Adding Magento_Catalog to Custom Module

I wanted to override the content of addtocart.phtml which is located in vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml Now I want to modify the content of this ...
0
votes
1answer
26 views

create block inside transactional emails to solve {{if}} problem

I'm new to magento. The problem that I have is that I want to modify the template of a transactional email. It's basically a return that I want the customer to receive a different email if the ...
0
votes
1answer
18 views

How to center a block on a page?

I have a block with a visual menu in it and I want to show up centered on the page. This is my css within the block: .container{ margin: 0 auto; text-align:center; } I've also tried to put the ...
0
votes
0answers
9 views

Add custom widget to created block in install magento

I wanted to add my custom widget to a block that I will be creating under install function. But I can't find any tutorial on this. Right now I have copied the code from here so it creates a block. But ...
1
vote
1answer
30 views

Magento local version doesn't load extensions properly

I have a running live instance of Magento 1.7. I am trying to setup a local dev env. Below is what I've done so far: Copy the project from server Import a dump of the database Edit local.xml with ...
2
votes
2answers
70 views

How to get root category using store id in magento 2 block file?

How to get root category using store id. we get store id using $storeId = $this->getStoreId(); We use below code for get root category using store id; but we get wrong. $rootCat = $this->...
0
votes
2answers
51 views

add block in observer magento 1.9

I need to show labels(BACK ON STOCK) on product when they back to stock, for this I have added a observer <global> <events> <catalog_product_save_commit_after> ...
0
votes
3answers
35 views

Layout - Pass variables from parent to child

How can I access variables defined in the parent template inside a child template? Example -> I added a new block with name product.info.grouped.news_flag as child of the block with name product.info....
1
vote
0answers
28 views

Incompatible argument type: Required type: \Magento\Framework\Stdlib\StringUtils

I want to override below block file /var/www/html/dg/vendor/magento/module-gift-card/Block/Sales/Order/Item/Renderer.php I made this file /var/www/html/dg/app/code/Drummondgolf/Orderemail/Block/...
4
votes
1answer
40 views

Magento 2 - Call different module block function in my custom phtml

I have custom module in which there is custom block and it's associated phtml which call my custom block functions using $block object. I want to call other module block function in my custom module ...
2
votes
0answers
25 views

How to pass variable value from phtml JS to block.php?

I have a phtml (system.phtml) with <script> in it and a variable like console.log(data). <?php $checkcustomer = $block->Customerlogin(); ?> <script src="https://d3js.org/d3.v3.min....
2
votes
1answer
11 views

Cannot put an element on the top Footer

Dear Magento developers, Currently I am trying to put an element block on the top of Footer, here is my wanted result: Here is my default.xml <referenceContainer name="page.bottom.container"> ...
3
votes
2answers
101 views

How to add block near a product image in a product detail page in Magento 2

How to add block near a product image in a product detail page in Magento 2
2
votes
0answers
26 views

Magento sampledata sales banners

I have some questions regarding the sales banners on sample data Magento sites. For example the below banner In the blocks editor, the html code for this block looks like this: <a class="block-...
0
votes
1answer
32 views

Magento2 routeId_controller_action make landing page

I make a Block in my custom module and there a logic exist . I have also make controller ,xml file(for define block class and template file) ,template in Controller nothing custom code exist just ...
2
votes
1answer
60 views

Magento 2 - Add meta detail on frontend page using Block

I have custom block in my custom module, which call my frontend custom phtml file. let's say file path: app\code\Vendor\Module\Block\Index\Index.php I need to figure out the way to set meta title, ...
2
votes
2answers
71 views

How to Get Layout Name in which is block is placed

I have My block <block class="Vendor\ModuleName\Block\Frontend\Linked" name="catalog.product.linked" template="Vendor_ModuleName::slide.phtml" /> in this file app\code\Vendor\ModuleName\...
1
vote
1answer
56 views

Get Product Image custom use Helper and Block in Magento 2

How can I put the below code into the module's files like helper/data.php or block/product.php, and how to use it to call Helper and Block into file.phtml . $objectManager = \Magento\Framework\App\...
2
votes
1answer
29 views

Magento 2 - Multiple collection on same block

I have a block where I want 3 different collections with different category filters. I have created collection object in constructor like this: protected $collection; public function __construct( ...
1
vote
1answer
27 views

Get block in phtml file not working - Please help me? [closed]

Get block in phtml file not working - Please help me ! When clicking on the button, it shows popup fancybox but does not show content in it. My phtml <div id="contact-popup"> <?php echo $...
0
votes
0answers
9 views

Block remove from Home page on specific condition

I Make a promotion rule in which set coupon code , Uses per Coupon is 20 and Uses Per Customer 1. override newsletter email template and set coupon in mail. when any user subcribe newsletter then get ...
2
votes
1answer
30 views

My website not showing products on front page

Any help will be highly appreciated. My website https://muzikhausberlin.de is not showing products on the front page, however on other pages products working fine but I can't see any images in a block ...