Questions tagged [blocks]

denotes questions about the `Block` classes.

Filter by
Sorted by
Tagged with
0
votes
1answer
43 views

How to remove cache from my Block class?

I need to remove the cache from my Block class, even if it removes the cache from the entire page. How could I do it?
0
votes
0answers
13 views

magento 1.8 /checkout page

I have a question to ask, hope anyone can help me My store magento 1.8. There is a page: https://www.lieblingstaschen.com/checkout But there is only a image. And I can edit the image in a block. I ...
5
votes
1answer
999 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 ...
0
votes
0answers
5 views

How to update addItemRender action through layout file for changing the template in Magento 1.9

I have this piece of code in my custom theme in layout file: <default> <reference name="header"> <block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/...
0
votes
1answer
21 views

Pagination in Magento2 widget block

Hi is there any way to do pagination in widget block . For example have a category with id 355 . I want to display that category product in a page . So I am using widget(following code) {{widget ...
1
vote
2answers
750 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-&...
0
votes
0answers
17 views

How to show only Product Name and price in specific category magento 2

I am working on specific category so I need to show some customized changes in that for that I need to show only product Name and price and by clicking on that I have continued button I am confused ...
0
votes
1answer
16 views

Add Custom block and changes for specific category

I have created the category and added my custom code in that, I have also my custom block which I created for that I have used catalog_category_view.xml file but it affects in all other my category ...
2
votes
4answers
1k views

Can't remove layout blocks. (Magento 2)

Information: I'm using Magento 2.1 on CentOS Linux, my theme is a child of the built-in Luma theme. When the theme I made is active, I want some blocks to be removed. Let's say I want to remove the ...
0
votes
1answer
15 views

Magento 2.3: How do I retrieve the product price in form.phtml file and assign it to an HTML attribute data-purchase-amount?

How do I retrieve the product price in form.phtml and assign it to an HTML attribute data-purchase-amount ="" as code snippet meant for Klarna tagline placement as seen in the file below. <div ...
1
vote
3answers
565 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 ...
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 ...
2
votes
2answers
1k 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="...
0
votes
1answer
49 views

Magento 2: Exception #0 (Magento\Framework\Exception\LocalizedException): Invalid block type: Perfectmirrors\PmmLayout\Block\Head

I am really not sure how to create the block class Pmm\PmmLayout\Block\Head , function of which $block->getAllPagesJSContent() should be called inside my phtml file pmm_head.phtml <...
1
vote
2answers
4k 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\...
0
votes
4answers
708 views

Module works when in app/code but not when in vendor folder

Seem to have quite an odd issue. I've got a custom module that essentially is just a class which extends a Template. When I install it using composer; it installs the module into the vendor folder. ...
0
votes
0answers
9 views

Magento 2.3.4 - Blank page with login block after login

I have added the following block to the Page: {{block class="Magento\Customer\Block\Form\Login" name="customer_form_login" template="Magento_Customer::form/login.phtml"}} But after the login, the ...
13
votes
4answers
9k views

Possible to change block type in layout XML?

Is it possible to change a block type in layout XML? I know how to change template using setTemplate method, but I am trying to change a block's type. Is this possible?
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 ...
0
votes
0answers
20 views

Blocks changing order on mobile

I created 2 blocks using the magento UI block creator. I then went to the pages area and used the "add block" function to add the blocks to the page. In Desktop, they show up the way that I added ...
1
vote
0answers
19 views

How to control block XML cache via admin?

I've created a condition in my admin panel to enable or disable a feature in my module. In my XML I used the ifconfig to check if it's enabled or disabled. I want to disable the cache in the entire ...
0
votes
1answer
727 views

Magento 2 login popup

I have a client login popup on my page with the form action="<?= $block->escapeUrl($block->getPostActionUrl()) ?>" How can I change this so the form will not redirect to the account ...
0
votes
0answers
11 views

Nesting Pruduct details default block in my custom block

I would really appreciate a hand here - thanks in advance for any tip, I'm fairly new to Magento's layout structre. I've created a custom block via backend. In that block, among other things, I would ...
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:...
0
votes
0answers
15 views

Admin Add a New Button in Form Container which send form to other controller

In magento 2 Admin i have create a form using a NON UI component method that is using block classes. I wanted to submit this form to two different controller. By default it sends data to save ...
2
votes
2answers
3k 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="...
39
votes
3answers
61k views

Remove block from layout XML in Magento 2

In Magento 1 I could remove a block added by a layout file by adding this in my layout-block <remove ="block_id_here" /> How can I do the same for Magento 2? As a practical exercise, let's say ...
-1
votes
1answer
17 views

Error when extending the Magento\Catalog\Block\Product\ListProduct::class

I tried to extend the Magento\Catalog\Block\Product\ListProduct::class like this : namespace Vendor\Module\Block\Product; class ListProduct extends \Magento\Catalog\Block\Product\ListProduct { ...
1
vote
0answers
36 views

Error add new block into block Magento 2

I'm using Magento 2.3.4 and t tried to append a block to another block like this in my controller: $category_list_subcategories = $resultPage->getLayout()->getBlock('promotion.view....
1
vote
1answer
6k 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
1answer
831 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
1answer
847 views

Contact-us page captcha not showing on another page using the same template

I added a captcha on the contact-us page following the guide here: How to implement Magento Captcha in Contact- Us form? it seems to be working perfectly, the problem is that I have another CMS-page ...
3
votes
2answers
1k views

Magento Container not working in custom layout

I have created a custom XML layout page that I will be using for my home page. Right now it is a clone of the normal 1column.xml layout, and I'm trying to add a container for an image slider. Here is ...
19
votes
4answers
33k views

How do I get the current product?

I'm trying to retrieve the current product's attributes in a block in Magento 2. I can get a product, like ID 1: $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $...
0
votes
2answers
30 views

Error getting Block in controller Magento 2: Element 'block', attribute 'class': [facet 'pattern']

I'm trying to get block in my frontend controller like this: $resultPage = $this->resultPageFactory->create(); $breadcrumbs = $resultPage->getLayout()->getBlock('breadcrumbs'); this is ...
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
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
2answers
718 views

Add block in layout XML only for one store view

I have a Magento 2.1.x installation with two store views. I would like to show a particular block in the footer only for one store view. In Magento 1.9.x I would have done it in this way: <...
0
votes
2answers
769 views

How to override Select.php block file in magento2

How to override vendor/magento/module-catalog/Block/Product/View/Options/Type/Select.php file I have followed below steps, but not working Step1: Created di.xml <preference for="Magento\Catalog\...
0
votes
1answer
28 views

How to add button at top of Layered navigation Filter from custom module?

I have a phtml that contain button like this in my custom module : app/code/Vendor/Module/view/templates/button.phtml <button> <span> <?= __('New Button') ?> </span> </...
0
votes
2answers
158 views

call phtml file in page builder in magento 2.3 enterprise

I want to call phtml file in static block that uses page builder in Magento 2 EE.
0
votes
0answers
20 views

PHTML receives no response from the Ajax Controller

In order to be able to load the product list according to the customers' selection, I tried to use an Ajax query. However, I have the problem that I do not receive the response from my controller. The ...
0
votes
2answers
1k views

Remove Default header and create new one with menu and search bar

I created a new block with HTML and CSS from Admin Panel in Magento 2.2.5. I want to display this block as a header of my store, so I want the method to remove or hide the default header and also how ...
2
votes
1answer
1k views

Magento 2.3 Fatal error: Uncaught Error: Call to undefined function mime_content_type()

Fatal error: Uncaught Error: Call to undefined function mime_content_type() in when trying to upload image from admin blocks. Please check screenshot
0
votes
0answers
16 views

cloning xml block or move block only for mobile

can anyone please help me how to duplicate the block sidebar block 'red box' in the first picture to mobile navigation like all the links in the sidebar 'red box' in first picture will be replace ...
0
votes
1answer
22 views

Dynamically generated block identical for all clients - Why?

I use PHP to create the content of a block dynamically on a CMS page (created via the admin portal). But I found out during testing that the first generated block remains active for all clients until ...
0
votes
1answer
31 views

Magento 2 - new container not showing in overriden layout file

I try to change the layout vendor\magento\module-catalog\view\frontend\layout\catalog_product_view.xml in my own theme. I have overriden the layout file completly: app\design\frontend\company\base\...
2
votes
1answer
34 views

Add a custom/programmed block to a CMS page

I have created a page using the CMS (via Admin Portal) and now I want to add a custom block (programmed) to the page. You can see the created page here: My structure is the following: but ...
0
votes
1answer
734 views

How can I output minicart block?

I am making changes to Luma theme. I want to move the minicart icon (module-checkout/view/frontend/templates/cart/minicart.phtml) to a different location. <?php echo $this->getLayout()->...
0
votes
1answer
24 views

How to add global container fo all my actions using layout block magento2

i want to add a global select like 'Select one option' contains my all actions 'Renew' and 'View' , can anyone tell me how to do that ? This is my code for now I have done some effort but 'Select one ...

1
2 3 4 5
35