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
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 ...
0
votes
3answers
3k views

Add custom copyright text below existing copyright text in Magento 2 frontend by module

I have attempted several steps to create a custom block to display custom copyright text below the existing default copyright in the frontend. In my module root directory (app/code/Ciptaloka/...
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->...
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 ...
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....
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> ...
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 ...
4
votes
1answer
898 views

Render Javascript on customer_login event

I'm trying to render some javascript when the customer_login event fires by accessing a block on the layout from within the observer. I've successfully registered my observer to execute with the ...
3
votes
4answers
1k views

How to call module block after header?

I have a module layout file like below <default> <block name="ampromo_notification" type="ampromo/notification" template="amasty/ampromo/notification.phtml" before="-" /> <...
11
votes
2answers
5k views

Magento 1 Widget setup in backend - how do I move upwards

I have a widget setup on all category pages via backend -> CMS - > Widgets Now when I use this method I select a block for category pages and the block shows up nicely. It is at the bottom of all ...
0
votes
2answers
619 views

How Can Override Block (\Magento\Catalog\Block\Product\View\Options\Type\Select.php)

<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference ...
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"> ...
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 ...
3
votes
2answers
90 views
5
votes
3answers
154 views

Get category id

How can I get ID from this code which is typed into CMS page content? {{block class="Vendor\Module\Block\CategoryList" category_id="49" template="Vendor_Module::subcategorylist.phtml"}} I need to ...
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-...
2
votes
2answers
986 views

Magento 2 How can I remove tabs in order view?

It is able to remove the block by using But how can I remove the tab which is added by using argument? Thanks. <block class="Magento\Sales\Block\Adminhtml\Order\View\Tab\Creditmemos" name="...
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, ...
4
votes
3answers
2k views

Creating a custom navigation bar

I successfully created a module which outputs "Hello World" on my CMS homepage. Now, I want to make this module a header / navigation bar which replaces the one of the blank theme. I also successfully ...
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
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
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\...
0
votes
2answers
2k views

Magento 1.9 : Add Block to One step checkout

I have a extension that shows a price slider for store credit in the Cart. I do not use the Cart and customers go straight to the Checkout. I want to show the slider on my checkout instead. Here is ...
1
vote
1answer
63 views

Mage_Core_Exception: Invalid block type: Mage_Adminhtml_Block_Sales_Order_Totals_Subtotal

I am new in Magento and in Magento (Magento ver. 1.9.3.2), it show Exception of Invalid block type: Mage_Adminhtml_Block_Sales_Order_Totals_Subtotal(in exception.log) And reason of that Exception ...
1
vote
2answers
2k views

how to get block data on phtml template in magento 2

what is missing in my code block data not shown in phtml template block page namespace xxxx\Trails\Block; use \Magento\Framework\View\Element\Template; use \Magento\Framework\View\Element\...
2
votes
2answers
910 views

Magento 2 add new block template file

I am trying to add a new phtml template file (in my child theme) of a custom module (not mine). Here is the block : {{block class="Sm\FilterProducts\Block\FilterProducts" template="Sm_FilterProducts:...
0
votes
1answer
98 views

Exception 'Mage_Core_Exception' with message 'Invalid block type' Magento 1

The following exceptions are showing in my exception log. Could anyone help to resolve that issue and clean my exception log? exception 'Mage_Core_Exception' with message 'Invalid block type: ...
3
votes
0answers
69 views

Block data are not shown in PHML magento 2

I am new to Magento 2 module development. I have a custom table sample_data(id,sample_text,sample_number) I want to fetch a listing of this custom table.But unfortunately when I type www....
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
3answers
448 views

remove block block-layered-nav from website

I am trying to remove block block-layered-nav from website. I have looked through the website and found people wanting to remove the catorgies, price ect but not the block. Can someone point me in the ...
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
3answers
416 views

Magento2 - missing adminhtml custom block after upgrade to 2.2

We had a custom block injected in the adminhtml section. This block is managed in a module (let's call it Vendor/Module) & it was working fine in Magento 2.1.*, following this methodology magento ...
0
votes
3answers
581 views

How to add header and footer at sales order print page

I think by not mentioning magento version I made a mistake. This question is related to Magento 2.1.5 I need specific answer regarding How to add header and footer at sales order print page? i.e. /...
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
1answer
2k views

Get Configurable Parent from simple product in quote when simple product has multiple parents

So I have a client that has about 14 Configurable products that are basically the same thing (logo item). Then they have created a simple product for each base color(Blue, Pink, Black)[3 total simple ...
4
votes
1answer
2k views

magento2 -custom layout file not loading

i have followed the below link in order to get check if our custom layout xml file is loaded or not using the event: layout_generate_blocks_after In the log file i just get: 2016-06-29T11:07:40+00:...
2
votes
2answers
637 views

Rendering Html content for Header Block

I want to get my header part as html and I will use this in some other site with Api call. For that I am trying to render using the Magento\Theme\Block\Html\Header block. I am using the following code....
1
vote
2answers
2k views

how to remove phtml file from home page in magento 2 theme

How can I remove a phtml template file from my theme, but only from the home page? My template file is "custome_home.phtml" at app/design/frontend/kalpak/ktheme/Magento_Theme/templates/html
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?
2
votes
2answers
2k views

Products on homepage: get more than 12 products

Im trying to show a few products on my homepage I got pretty far using this code: {{block type="catalog/product_list" name="product_list" category_id="74" column_count="5" num_products="24" mode="...
1
vote
2answers
1k views

how to call phtml inside phtml

I have a custom phtml inside I called attribute.phtml but it's not working: echo $block->getTemplateFile('Magento_Catalog::product/view/attribute.phtml'); echo $this->getLayout() ->...
0
votes
1answer
603 views

How to turn off cache for a block?

i want to completely remove from cache the header-minicart. It is confused when magento cache and fpc work together. how can i do that?
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
1answer
4k views

Magento 2 : Display Related Products Block in Product View

I'm using magento 2.1.3 and I want to display related products under product_view. Product view is using 1 column template. I've added successfully related products to some products. I've reindexed ...
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 ...
1
vote
1answer
1k views

Magento 2 : Adding Cms block using Layout Update XML

In order to create custom sidebar menus for my CMS pages in Magento 1, I used to be able to create a static block, and then use a widget to place it on all CMS pages that had a 2 column layout with ...