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 [blocks]

denotes questions about the `Block` classes.

0
votes
1answer
13 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
10 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 ...
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
43 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
32 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
21 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....
4
votes
1answer
22 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 ...
0
votes
0answers
13 views

Magento Backend CMS Page And Block pages continously loading

After Searching in the block and page loading continously since a week and tried this Magento2 Error: "Something went wrong with processing the default view and we have restored the filter to its ...
2
votes
0answers
19 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
10 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
90 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
25 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
28 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
52 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
45 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
38 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
26 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
26 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
25 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 ...
0
votes
0answers
12 views

How to get the attributes set using the all attributes in phtml page? in magento 2

How to get the attributes set using all attributes in phtml page? In need, the products view page in all attributes in particular attributes set related attributes?
0
votes
0answers
18 views

Migrating block code to Magento v2

We have some custom design blocks in Magento v1 which are utilizing core/zend_template(<block type="core/template_zend" name="CustomPage">) with fetchview. I do not see fetchview in Magento 2 ...
2
votes
1answer
37 views

How to create a default Magento 2 block (catalog/product_list) from a phtml file?

I'm trying to render a default block from a phtml file, without luck. After a lot of research, I learnt that I can use this code inside a page to render the block I want: {{block type=”catalog/...
1
vote
0answers
24 views

How to call block function in model

I'm using TemplateMonter_FeaturedProduct ang I'm building an API to build mobile application. This extension let me add specific products to appear in specific block on the storefront. Those products ...
0
votes
0answers
22 views

function in block not found

I'm trying to trace some code in TemplateMonster_FeaturedProduct extension inside Block. I've found the following line of code: $numberPerView = (int)$this->getNumberPerView(); I searched for ...
0
votes
2answers
29 views

How to use registry in block?

I'm trying to get registry value in my block. Here's how block looks like, <?php namespace Vendor\Dunning\Block\Adminhtml\Dunning\Edit\Tab; class PartPayments extends \Magento\Backend\Block\...
2
votes
2answers
31 views

Attempting To Override Pager - Type Error

Right now, I'm simply attempting to override the Pager class. Without changing anything within it, I've copied it into my module, and then specified the preference in the di: <config xmlns:xsi="...
1
vote
1answer
28 views

Translate text from blocks in admin panel

I am translating text in the blocks with by putting text instead of categories word{{trans "Categories"}}, but I have some text with span element and I don't know how to translate them, If anyone can ...
1
vote
1answer
38 views

Custom Admin Edit form not displayed

I have created a custom module using \Magento\Backend\Block\Widget\Form\Container form with Magento2.3 and I am facing issue while edit form is not showing in Magento Cloud, But local environment is ...
0
votes
0answers
12 views

How to order page links side by side

I have created some pages in Magento 2.2.1 - About Us, News Page etc - and I want to place them beneath the categories on the default home page. I have created pages, blocks, and widgets. However - I ...
0
votes
0answers
18 views

Magento 2: Overriding Sales Order DefaultRenderer (Order Items)

I'm trying to override the DefaultRenderer (commonly found when customer views their order in accounts) so I can do some customisations and include extra data. I've managed to do this successfully, ...
1
vote
1answer
23 views

magento 2 createBlock from argument item

My custom module xml file contains the block code. I want to call that block code directly using createBlock method and set template to show in specific template. My block code is adding animated ...
0
votes
1answer
65 views

Magento 2 get cart items in block class

I have created block for sidebar. I have added below code in my block for compare products. It's working fine <div class="block widget block-compare"> <div class="block-title"> ...
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"...
1
vote
0answers
7 views

Magento 2 add body class into as per current page using toolbar.php plugin for category and search results page

I have created plugin for toolbar.php \Magento\Catalog\Block\Product\ProductList\Toolbar protected function _prepareLayout() { $this->pageConfig->getTitle()->set(__('Category Page')); ...
0
votes
0answers
7 views
1
vote
1answer
17 views

Incorrect behavior when sending email with use a block inside a template

When developing the module I encountered the following problem: inside the my controller (class Index extends \Magento\Framework\App\Action\Action) there is a method that calls a method to send email ...
0
votes
0answers
34 views

I am trying to Create a product Grid in My custom Module Admin Form

I am trying to add a product Grid in My custom Module I searched a internet and found this Solution Magento 2 : How to add product grid in custom module's tab Now there is a function in this ...
2
votes
2answers
45 views

Best way to change block´s template?

I've been studing for the Magento certification and I came across a question in the swiftotter practice exam that said: Can someone explain me why the answer I chose is incorrect? I thought the way ...
1
vote
1answer
54 views

Magento 2 in default newsletter subscribe not working?

I will attached the phtml and php block code but client side mail does not send? subscribe.phtml <div class="block newsletter"> <div class="title"><strong>Newsletter</...
2
votes
0answers
76 views

Magento 2 - Page cache with hole punch

Magento page cache cached some of the blocks that has dynamic value, like Wishlist count on header for logged in customers I can make it dynamic using Ajax, but then it came to my knowledge that it ...
1
vote
2answers
74 views

Nested cache blocks

I have a parent block that has so many child blocks inside it. The parent block has these cache rules: Header: $this->addData([ 'cache_lifetime' => 86400, 'cache_tags' => ['...
2
votes
1answer
15 views

Magento 1.9 - exception 'Mage_Core_Exception' with message 'Invalid block type

Checking the log file of Magento 1.9, in two web site, I find this row: exception 'Mage_Core_Exception' with message 'Invalid block type: ES_Newssubscribers_Block_Newssubscribers How to remove ...
3
votes
1answer
48 views

Is it possible to append a block to the footer in admin dashboard?

I'm trying to append a block to the footer but only on the dashboard page i.e. <footer> [New Template] [Core Content] </footer> How can I achieve this? I've tried a layout file with the ...
2
votes
1answer
59 views

Handling templates without a module name specified

I have a 3rd party extension installed and I needed to overwrite on block because I could not use events or plugins on it. The block is added in the layout file like this: <block class="Vendor\...
0
votes
2answers
41 views

Create Custom block on Product View with form

I'm trying to do a form and put this on Product View. I did some fields and they are saving the results on DB, ok, everything is good. But, I need to insert this block there. Any thing that I help me?...
1
vote
1answer
81 views

How to override protected _prepareLayout function in block in Magento 2?

I wanted to make changes in _prepareLayout() in block. Code is as follow: Block: Magento\Catalog\Block\Category\View protected function _prepareLayout() { parent::_prepareLayout(); $this-&...
1
vote
2answers
52 views

Magento 2 : How to change the currency symbol wise price in list.phtml page?

I will trying but its not working ? <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // Instance of Object Manager $currencyModel = $objectManager->create('...
0
votes
2answers
37 views

Magento 2 How to get the configurable products related all child products in list page using object manager?

Magento 2 in how to get the configurable products related all child (simple products QTY) in list page using object manager? Please give me a solution this questions?
0
votes
0answers
35 views

How do I create a “floating” widget/block?

I'm trying to create a floating widget/block that can sit over on the left of my website like the attached picture. I want to advertise my catalogue for download.