We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [blocks]

denotes questions about the `Block` classes.

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

Magento 2 get Controller data in the same page it was sent

I got help to accomplish send data from Controller to a Block, and then display the info from Block in a template. The thing is that I want to send a form and display the data from that form in the ...
0
votes
0answers
19 views

Magento 2 Return Controller data in the same page

I got help to accomplish send data from Controller to a Block, and then display the info from Block in a template. The thing is that I want to send a form and display the data from that form in the ...
1
vote
1answer
41 views

Magento 2.3 - Can not hide account navigation links based on customer groups

I'm trying to hide account navigation links based on customer groups. In order to hide the links, I have installed a module https://github.com/KishanSavaliya/magehelper-magento2-hide-account-sidebar-...
0
votes
1answer
37 views

Magento 2 pass data from Controller to Block and display in Template

I'm a little bit stuck. I want to send a form and display it in a phtml. Here is my code: 1. Controller Search.php <?php namespace Vendor\SearchStores\Controller\Index; use Magento\Framework\...
0
votes
2answers
30 views

Magento2.3: How to fix Undefined variable issue?

We are facing issues from the custom module which we have done for EMI calculator. The issue is when we try to load the category page from the megamenu, its throwing the below error: 1 exception(s): ...
0
votes
1answer
34 views

Custom System Menu not calling Controller

I am using Magento 1.9. In the admin panel, I have created a sub menu named Whatsapp Notification inside the System menu. The sub menu in turns have two children menu, named Template and ...
0
votes
1answer
26 views

When use block vs view model?

I'm creating a module using blocks and view models, but when is it better to use view models instead of blocks?
0
votes
1answer
23 views

Create block and use it in template - Error filtering template: Invalid method

I created a block and a template. I call the template in a CMS site. Block: \app\code\Fekete\Newsletter2Go\Block\Form.php <?php namespace Fekete\Newsletter2Go\Block; /** * Dashboard Customer ...
0
votes
1answer
28 views

Dymanic Block based on Segments in phtml

I created 2 dynamic cms blocks in BE with different Customer Segment, How can I call to them from phtml file? Please note that dynamic cms block != cms block tried $block->getLayout()->...
0
votes
0answers
25 views

Getting information to an admin view page - block, viewmodel, both, etc

Old time Drupal guy here struggling with how to get data to the presentation layer. I have created ui listing and form components to list and edit records but there seems to be a gap in a process to ...
0
votes
0answers
23 views

Insert a widget/block reference in product/view/description.phtml

I am trying to display a widget linked to a new block reference I created. I would like to put this block reference inside my catalog/product/view/description.phtml file This is the code I am trying ...
1
vote
2answers
79 views

Override template and block from a module?

I am developing a newsletter extension. I try to override the template /vendor/magento/module-customer/view/frontend/templates/account/dashboard/info.phtml and the block Magento\Customer\Block\...
1
vote
2answers
30 views

Magento 2: Where are the block classes stored?

I've enabled template hints and block hints. I get this template path /vendor/magento/module-customer/view/frontend/templates/account/dashboard/info.phtml which has this block class Magento\Customer\...
0
votes
0answers
18 views

Get product configurable attribute with value (Child of configurable) from QuoteFactory

How can I retrieve simple product configurable attribute with its value from \Magento\Quote\Model\QuoteFactory (or any other method?)? I can retrieve some information using this: public ...
0
votes
1answer
49 views

Magento 2: in checkout how to display input fields on the same row?

how can I display street , House number, Addition fields in one row? I have this file app/code/Mageplaza/Osc/Block/Checkout/LayoutProcessor.php <?php /** * Mageplaza * * NOTICE OF LICENSE ...
0
votes
1answer
32 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
1answer
56 views

Add block after sidebar on checkout page

For accesibility reasons I want to move checkout button after the sidebar. I am able to move checkout button to sidebar but I want to move it after the sidebar in the html layout. I am able to add ...
0
votes
2answers
53 views

Magento 2: How to add PHP code into CMS Block using .phtml file

I have followed the below links to try and get PHP code into CMS Block which links to a .phtml file, with no avail. Show content of phtml file on static block Magento 2 PHP code in Block Currently ...
0
votes
0answers
33 views

Magento 1.9.4.3 item not added to basket when button clicked

I have just successfully updated to 1.9.4.3 from 1.9.4.2. However, in one of my custom blocks the add to basket doesn't work, item does not get added to the basket. Analysing the url from $this->...
0
votes
0answers
32 views

Magento 2 : Replace core block if module enabled

It's catalog_product_attribute_edit.xml file : <?xml version="1.0"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <page ...
1
vote
2answers
38 views

Magento 2: how can Override vendor\magento\module-sales\Block\Adminhtml\Order\View.php to remove/disable “Ship” button

To Disable/Remove “ship” Button from sales->order->view (click) -> Ship I commented in core file vendor\magento\module-sales\Block\Adminhtml\Order\View.php below code . if ($this->...
0
votes
2answers
43 views

Magento 2 - Cache problem for check if user is logged in phtml file

I use this code, on .phtml file, if($customerSession->isLoggedIn()) {} for check if the user is logged. But, when I active the cache, this code does not work fine. How I can resolve this problem?
0
votes
1answer
68 views

Magento 2.3: How to make a custom block with all added items in the cart?

I am using Porto theme. In addition to the available mini cart sidebar, I'd like to create a custom block on the right side with a sticky cart, so customers would be able to see what they add and what ...
0
votes
1answer
17 views

Magento 2 get Block Toolbar custom module gives Error

In catalog_category_view.xml <referenceContainer name="content"> <block class="Magento\Catalog\Block\Product\ProductList\Toolbar" name="my-block-name" template="Vendor_Module::...
0
votes
2answers
49 views

Call footer block of one theme into another

There are two themes which i am using. One is magento theme 'Smartwave porto' and another is Ced commerce theme which i got for ced commerce extension. This theme is enabled only for this particular ...
0
votes
1answer
36 views

how to align the custom order option in magento 2 in product list page sort by options

how to align the custom order option in magento 2 in product list page sort by options ? how to set the custom order in attributes using Short by options ?
0
votes
1answer
43 views

Magento2.3: How to move sku above product title?

I want to move the sku above the product title. But the problem I'm facing is that I can see two of the sku's in the product page(one is under product title and another is parallel to price). Please ...
3
votes
0answers
15 views

Ordering JS/CSS load order across multiple xml blocks

When rendered, the below core XML loads the require.js file in (for example) Position 10 in the HTML Source: vendor/magento/module-theme/view/frontend/layout/default_head_blocks.xml <head> ...
2
votes
0answers
38 views

Magento 2 Is there a way to use product chooser in ui component form (NOT BLOCK)?

Im building module using ui components and need product chooser in my form. But can't find any useful info related to product chooser implementation using ui component. Is it possible to do this ...
0
votes
1answer
54 views

How to add Custom Css class to a footer block in Magento 2.3

I want to attach one custom CSS class to a footer block using javascript. How can we do that? <ul class="footer-links col-lg-5 col-md-5 col-sm-12"> <li><a href="/about-us">About Us&...
1
vote
0answers
17 views

Custom field in Block with specific ID - Magetno 2

i wolud like add new custom field in Block with specific ID in Magento 2.3. It is possible? Thanks
0
votes
3answers
44 views

Block not showing in custom frontend controller

Here is my custom frontend controller namespace Namespace\Testing\Controller\Payment; class Failure extends \Magento\Framework\App\Action\Action { /** * @var \Magento\Checkout\Model\Session ...
0
votes
1answer
15 views

how to check an array with cart price rule ID magento 2

I am trying to get Cart_Price_Rule. public function test() { $ruleArray = $this->adventCollectionFactory->create()->getData(); $ruleArray = array_column($ruleArray,'promo_rule_id')...
0
votes
0answers
11 views

Magento 2 how to move Address customer fields to custom form?

I'm trying to move address fields to a custom form that I created. In app/design/frontend/vendor/theme/Magento_Customer/layout/customer_account_create.xml I have the following code: <?xml ...
0
votes
0answers
17 views

Moving blocks and widgets on XML at Magento 2

I'm migrating from Magento 1.9 to Magento 2. I need to move some elements on header and footer but this is being a nightmare. All the content that I found on my searches show me how to do it but just ...
0
votes
2answers
31 views

Call custom customer attribute in block

I have found a custom block that checks if the customer is logged in and edited it to this. What I need it to do is check the custom customer attribute is_allowed is set to yes, too. I want to use ...
0
votes
1answer
64 views

Show Order Details in Order History

Basically I want to show Customer's Order Details information in order History page under Customer Account My Order History Page. Exactly what I'm did? I have overridden vendor/magento/module-...
1
vote
1answer
31 views

Nice way to inject the main block to a viewmodel

We want to follow the best practice to add additional functionality to a block template without "rewriting" (i.e. a DI preference) the block. Is there a nice way to inject the main block (which ...
0
votes
1answer
29 views

Magento Blocks Positioning

I'm trying to move the social login block to the top of the page but i'm unable to find where to change this. I'v been searching and editing different files without success. URL for customer login ...
0
votes
0answers
33 views

Reorganizing the header on the default.xml of Magento 2

I was using Magento 1.9 and now I'm migrating to Magento 2. I ready Magento devdocs for frontend and tried a lot of things but none works for me. Probably I forgot some details but I'm completely ...
0
votes
0answers
88 views

Magento 2 Sort product in cms page widget block

I want to insert multiple products in a cms page using SKU . So i did using blocks . So please see my code {{widget type="Magento\CatalogWidget\Block\Product\ProductsList" show_pager="0" ...
1
vote
1answer
99 views

Magento 2 Custom Product block using SKU in cms page

I want to display custom product block in cms page . I have sku of the products . No how can i display this product in cms page . I know how to display one product using sku . But is it possible to ...
0
votes
4answers
66 views

Magento 2 Custom query to display selected product in Custom block

I have some product ids . Currently I can display products in category using {{block . But now I am developing a custom block in app/design/frontend/Alothemes/bencher6/Magento_Theme/templates/myphp/...
0
votes
3answers
56 views

getting null in customer email Magento 2 Custmer session

Edit.php (block) class Edit extends \Magento\Framework\View\Element\Template { protected $request; protected $customerSession; public function __construct( \Magento\...
0
votes
1answer
43 views

Custom php code in magento not working / magento block path wrong

i am new to magento & using magento 2 . I have to run a php code in my cms page . When i check the website i can understand that the theme is Alothemes Bencher6 . So what i did is app/design/...
0
votes
0answers
43 views

Show product blocks based on product id

I am new to Magento. I have some product ids. I have to list this product on my custom page. These products are selected from different categories. So I cant make these products in same category and ...
0
votes
1answer
29 views

How to display custom block in product_list_toolbar?

I have a problem with displaing my custom block in toolbar toolbar-products between sorter and toolbar-amount. I tried this code: <referenceBlock name="product_list_toolbar"> <block class="...
3
votes
2answers
93 views

How can I add a custom button by using a custom module in Magento 2.3?

I wanted to add my own button in the Shopping Cart as I tried to show you in the screenshot. But I didn't find a tutorial that worked for me. Do you have any idea how I can do this? (I want to make ...
0
votes
0answers
29 views

Magento 2 : How to Create Recent Orders Block on CMS Page or Static Block

I want to call block on the home page of the store. how can I add recent order block on store home page from admin? Thanks I have tried this <p>{{block class="Magento\Sales\Block\Order\Recent" ...
0
votes
0answers
20 views

how to get guest email address in CollectTotalsObserver page in magento 2

how to get a guest email address in CollectTotalsObserver page in Magento 2. public function execute(\Magento\Framework\Event\Observer $observer) { /** @var \Magento\Quote\Api\Data\...