Questions tagged [blocks]

denotes questions about the `Block` classes.

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

Difference Between $block and $this with Example in magento 2.4.4?

I want to know what is the main difference between $block and $this with example. And also wants to know what are the classes of $this and $block.
user avatar
1 vote
1 answer
30 views

Adding layout handles to blocks in cms pages

We have a cms page with a content like this: <p>Lorem Ipsum</p> <div>{{block class="Vendor\Module\Block\Feature" block_id="feature_wrapper_block"}}</div> &...
user avatar
  • 288
1 vote
2 answers
29 views

how to add cms block in magento without using our own theme and in app/code?

How to Add CMS Block in Magento2 programatically. I want to add a cms block in app/code insstead of app/design using layout or xml files.
user avatar
0 votes
1 answer
20 views

PASS DATA FROM MODEL TO BLOCK

Hello guys i get my data from db with API i want to show data in frontend , i can do this this is function, that return an array of data. public function getComputerAttr($customerId) { $...
user avatar
  • 3
0 votes
0 answers
15 views

How to add dropdown to product variation in grid.phtml

I want add variation dropdown instead of multiple div swatch option. I am not getting how to do in grid.phtml. Below is the code swatch option display <?= $block->getProductPriceHtml($_item, $...
user avatar
  • 1
0 votes
1 answer
22 views

Magento2 : Layout block what is the difference between acl="" and aclResource"" attribute

I've been trying to figure out the difference between acl and aclResource both attributes available for <block> directive. I know that aclResource is useful to render the block based on specific ...
user avatar
0 votes
0 answers
32 views

Set the header block to be the first element in the top.links block

I am facing this issue in magento 2.3.4: I want the welcome message to be the first element in the top.links block. Now it is looking like this: For that, I have made some changes inside design/...
user avatar
0 votes
1 answer
82 views

Using a block markup tag strips out elements of block created in pagebuilder

When I create a block with pagebuilder that includes background images for the rows, image elements and buttons they all get stripped out when using the {{block id=''}} tag on another page There is ...
user avatar
0 votes
0 answers
63 views

Extension Layout won't work when using a custom theme

I have built an extension intending it to add a block underneath the Add to Cart button on the catalog product page. My extension layout file isn't being executed - instead it just executes my custom ...
user avatar
0 votes
1 answer
38 views

Can't add block below add to cart button

I am new to Magento and would like to add a custom block underneath the 'Add to Cart' button. Here is my catalog_product_view.xml file: <?xml version="1.0"?> <page xmlns:xsi="...
user avatar
0 votes
0 answers
8 views

Magento 2.4.2 in admin product edit Advanced pricing in Customer Group Price missing how to create this?

Magento 2.4.2 in admin product edit Advanced pricing in Customer Group Price missing how to create this? Please guide me how to add this fields?
user avatar
0 votes
0 answers
59 views

How can I pass custom form data and load result page using Ajax?

New to Magento. My goal with this is to have customer pick price range and sort order from a custom form I created, then when form is submitted have Ajax pass the form data AND load the new page with ...
user avatar
0 votes
0 answers
21 views

block which can be added between products on category page magento 2?

is there any free or paid extension available in which we can add block and this will display on the category page between the products on 20th product, 40th product like this.
user avatar
  • 1,214
0 votes
1 answer
39 views

How to display cms block in product page if some attribute is set to yes

I want to display cms block if product has the attribute set to yes. A product may have multiple attributes set to yes, and may display multiple cms blocks. Attribute label text will be a BlockId. It ...
user avatar
0 votes
0 answers
75 views

How to get widget instance id in its block

I can get widget parameters in the widget class like $this->getWidgetTitle() but here widget_title has been declared in widget parameters in widget.xml file, I want to get the widget instance-id ...
user avatar
  • 860
0 votes
1 answer
13 views

How to modify core product block

I have a problem with having any impact on how the site render a block. I want to pass data about shipping price to a product page, and I want it done by creating module, I've made standard: app/code/...
user avatar
1 vote
1 answer
205 views

Magento 2 How to create CMS block with HTML content programmatically

In Magento 2.4.x, How to create CMS block with HTML content (Text, Image with div structure) programmatically in Page builder section?
user avatar
  • 1,094
0 votes
1 answer
35 views

Unable to retrieve value from Block

I am using Magento 2.3.5-p2 I am adding a Google Tag Manager integration code at the Catalog Search, thus this requires me to modify the catalogsearch_result_index.xml and add a new .phtml file which ...
user avatar
0 votes
1 answer
63 views

Magento 2 - How to override footer block

How to How to override footer block Magento\Theme\Block\Html Current block is vendor\magento\module-theme\Block\Html\Footer.php <?php namespace Magento\Theme\Block\Html; use Magento\Customer\Model\...
user avatar
0 votes
1 answer
39 views

Magento 2.3.4 - CMS_Block Query taking up resource

Hope someone can help because I'm aghast. So we have a 2.3.4 store (migrated from 1.9) which we put live recently. After an hour or so, the site completely collapsed under the traffic (apparently it ...
user avatar
0 votes
1 answer
21 views

Remove block magento

I am facing a problem in the picture. I have two SIGNOUT. How can delete the external SIGNOUT?[![enter code here][1]][1]
user avatar
0 votes
0 answers
147 views

Magento 2 : Rearrange Block Argument Items Using ReferenceBlock

I'm using magento 2.4 and trying to customize the items ordered table in admin order detail page via MyVendor\MyModule\view\adminhtml\layout\sales_order_view.xml. Here, if I reference the block to add ...
user avatar
  • 131
0 votes
0 answers
20 views

Render block from outside a block

I'm receiving this kind of string {{block class="Cpy\ModuleName\Block\BlockName" name="mega-menu" template="Magento_Theme::html/mega-menu/mega-menu.phtml"}} Usually, ...
user avatar
  • 772
0 votes
0 answers
401 views

main.CRITICAL: Error: Call to a member function getId() on null

I'm using Magento 2.4.3 and I'm loading a custom module using someone else's code from the link https://community.magento.com/t5/Magento-2-x-Programming/Magento-2-Product-Reviews-only-by-customer-who-...
user avatar
  • 1
0 votes
0 answers
122 views

How to extend app/code/Smartwave/Megamenu/Block/Topmenu.php this file Function in Custom Module or in Child Theme?

I need to extend a function from this file app/code/Smartwave/Megamenu/Block/Topmenu.php. By using a module or in child theme. How can i achieve that to extend that file like how to modify that ...
user avatar
  • 536
0 votes
1 answer
329 views

Magento 2 how to add order view information blocks and sections to my custom tab?

I would like to add Order View -> Information sections to my custom tab at admin end. Here is my layout file sales_order_view <?xml version="1.0"?> <!-- /** * Copyright © ...
user avatar
0 votes
0 answers
109 views

Magento 2.4.3 - Notice: Undefined property: $_view - Decomposition of Controllers

I have been trying to create module in Magento 2.4.3 that has significant changes where decomposition is favored instead of inheritance - https://community.magento.com/t5/Magento-DevBlog/Decomposition-...
user avatar
1 vote
0 answers
13 views

Can you add Dynamic fields in admin grid?

I am trying to add Dynamic fields in admin gird. i am not using UI to do this. I have added custom field using this $fieldset->addField( 'test_field', 'text', [ ...
user avatar
  • 45
0 votes
1 answer
210 views

How to set custom action on admin form edit top button in magento 2?

I have one my admin grid in that edit time i add button in top action bar now in that on click i need to set custom action of controller i try this but not working $this->buttonList->add( ...
user avatar
0 votes
0 answers
62 views

Custom Module made Pagination disappear?

My custom module is preventing users from seeing specific products when they are not logged in or logged in but don't have access to see them. For category pages I am listening to the ...
user avatar
0 votes
0 answers
82 views

How can I add yotpo review in static block in Magento2?

I want to get yotpo review in my static block and want to show it on the front end. I want to inherit a review like this code. {{block class="Magento\Framework\View\Element\Template" name=&...
user avatar
  • 25
0 votes
0 answers
84 views

Minicart Not Updating When Cart Price Rule Applied

I created a Cart Rule for all of the categories as Qty is greater than 3 . Then you will get a 1000 flat discount. When I added 3 products to the cart then the mini cart showing 3 as qty and subtotal ...
user avatar
  • 492
0 votes
2 answers
438 views

Magento2.4.2 in Elasticsearch 7 reindex not working

We have installing magento2.4.2 with Elasticsearch 7. reindex not running. facing some issues: Catalog Search index process unknown error: {"error":{"root_cause":[{"type"...
user avatar
0 votes
1 answer
224 views

How to block specific email address?

How to block specific email address? The customer is registered as guest but making series of suspected fraudulent transactions. We see he is using different credit cards, fictitious address and ...
user avatar
0 votes
2 answers
51 views

How can I get the first level category list?

I'd like to list all first level categories from inside my custom block. I'd like to get the category names and the URLs. How can I achieve this?
user avatar
  • 115
0 votes
1 answer
98 views

How to override _getHtml() function form topmenu.php file in Magento 2

I want to override _getHtml() function from topmenu.php file using block. So Please help me THANKS.
user avatar
  • 3,187
0 votes
1 answer
522 views

How to Block Customers by their Address in Magento 2?

I want a feature in which user will be blocked by their Address. Like I will add the address in block list of Magento Admin and then user will not be able to purchase anything if I add their address ...
user avatar
  • 536
0 votes
1 answer
27 views

How to force reviews to appear on page load? trigger processReviews

I'm trying to make customer reviews appear on the PDP page without clicking on the reviews button. On reviews tab click, ajax request is being sent to the server and I want to send this request on ...
user avatar
  • 11
0 votes
0 answers
11 views

Error log showing a template file but module not found in my files

My Magento 2.2.6 Website is become very slow when we are adding product or updating product in backend and some time website is crashing . So when i check the log file i have found following error ...
user avatar
  • 53
0 votes
2 answers
105 views

How to add a full width area in the homepage with 2 columns with right bar?

I'd like to add a full-width area (in order to insert a block) in my Magento homepage which is now set to 2 columns with right bar layout. Should I add a new section before the main content? How? Or ...
user avatar
  • 115
0 votes
2 answers
82 views

I want to call phtml file from Magento_Theme to static block. but it is giving some error

PHTML file is located in Magento_Theme/templates/html/breadcrumbs.phtml. I tried with the code {{block class="Magento\Framework\View\Element\Template" template="Magento_Theme::html\...
user avatar
0 votes
1 answer
51 views

Can't find Contact Block

I'm having trouble finding where exactly the Contact-page is located in a shop I got handed down. There is a Block called 'Contact Us info' saved in the Admin Frontend Portion of Content->Blocks, ...
user avatar
0 votes
3 answers
2k views

Magento 2: How to get last inserted custom table Id without saving new item?

I want to get the last inserted id to my block without adding new data into the table. I want to use this value to automatically filled in my phtml file. I tried getId and it's not working. I just ...
user avatar
  • 15
0 votes
1 answer
353 views

How to get data from table in block magento2? Note: my model is in another module and i want to get data in another module.[frontend]

I have databse table with data.My model was created in one module and i want to get table data in another module's block class, so that i can render those data into my phtml. table name:form columns:...
user avatar
  • 15
0 votes
1 answer
238 views

Using different background images for desktop/mobile display on blocks - widgets

I created a block and a widget in magento 2.4 page top to display as a banner promotion, but i want a different display for desktops and different for mobile. what i have tried: <div style="...
user avatar
0 votes
1 answer
263 views

Magento 2.4.2 : Move existing core block to child block

I am trying to move page.main.title to child block of my custom block on custom page. I have defined one block in my layout file with template assigned to it. I want to show page title in between the ...
user avatar
0 votes
2 answers
47 views

How to change the amount of products shown in related products programatically?

I want to display more than 4 products in the related products block. I've tried some solutions like overriding the core Related.php class and using methods: $this->_itemCollection->setPageLimit(...
user avatar
1 vote
1 answer
192 views

difference between the Block and UI_Component to Make grid and Form at admin side?

What is the Difference way to use of Block and ui_components to Make the Admin side grid and form and fields and elements in the form, can someone explain, which is better way to choose and Why ?
user avatar
0 votes
1 answer
229 views

How to call one block function to another block in same module

First Block: app\code\Zero\Storelocator\Block\view\Attributes.php function name : getLocationAttributes() Second Block: app\code\Zero\Storelocator\Block\Customerreview.php How to get the first ...
user avatar
  • 95
0 votes
1 answer
199 views

Magento 2 which of the elements automatically render their children in layout Xml?

Which two elements automatically render their children in Xml? <block class=”\Magento\Framework\View\Element\AbstractBlock” name=”shop.info.details”/> <block class=”\Magento\Framework\View\...
user avatar

1
2 3 4 5
36