Questions tagged [blocks]

denotes questions about the `Block` classes.

Filter by
Sorted by
Tagged with
0
votes
2answers
33 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 ...
2
votes
0answers
11 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> ...
1
vote
0answers
31 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
2answers
48 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&...
0
votes
0answers
12 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
41 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
14 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
10 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
10 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
56 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
26 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
22 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
25 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
40 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
64 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
36 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
42 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
39 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
42 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
26 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="...
4
votes
2answers
80 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
26 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
19 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\...
0
votes
2answers
35 views

M1 How to know what contents corresponding to layout / block / template?

Currently, I don't know how to find the layout of the manage customer page (Customers > Manage Customer). Generally, how can I find the block/layout/template/controller of a specific page? Thank ...
0
votes
0answers
28 views

Magento2: how to add fulltext search query in block page

Magento2 : How to add a full-text search query in a block's function within a custom module? This is what I am trying so far: $postCollection->addFieldToSelect('*'); if($search != '') { ...
0
votes
1answer
37 views

In Magento 2 how to add phtml block after newsletter in footer.?

I want to add html content after newsletter in footer section in luma theme Please suggest me how can i do that?
0
votes
0answers
22 views

Magento 1.9 Override extension's block that is overriding core block

I am trying to override a block from an extension that is itself overriding another block, but having no success. Here is what I have: Initialize the Module: DBCustom_Amasty: <?xml version="1.0"...
0
votes
0answers
17 views

Magento 2.3 Add/Update Block

In Magento 2.3 EE, If we are going to add or update block, there we can get the Row and inside that we have to place HTML Code. But this row makes my page layout which is different than the previous ...
0
votes
0answers
16 views

Magento 2.3.1 in multi shipping overview Post controller page not working go to Success page

Magento2.3.1 in multi shipping overview Post controller page not working go to Success page Page Redirect is not working how to solve this issues ? Payment id is not showing on this page ???? vendor/...
1
vote
2answers
33 views

How to add block html content display in particular div or any particular place by xml file?

I created customer_account_login.xml to add block. <?xml version="1.0"?> <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:...
0
votes
0answers
18 views

Error on Category Page

I am getting error on Category Page Magento 2.2.6 ( Element 'block', attribute 'remove': The attribute 'remove' is not allowed) 1 exception(s): Exception #0 (Magento\Framework\Config\Dom\...
0
votes
0answers
26 views

Magento Captcha in checkout page

I have implemented a custom block in Magento 2. The block contains a form, which will be called in onepage.phtml. I am able to retrieve block contents in onepage.phtml using: $this->getLayout()-&...
2
votes
1answer
31 views

Remove container in block class

I want to remove some items from a page when certain conditions apply. I got a solution but I'm wondering if there isn't any better way to do this. Now the code that I have is for each block that I ...
1
vote
0answers
26 views

template is not working magento 2 admin customer_index_edit

I am calling a js function form this file current.phtml like this <script type="text/javascript"> require([ 'jquery', 'jquery/ui'], function($){ $(document).ready(function($) { updateAjax()...
2
votes
0answers
27 views

ReferenceError: {var} is not defined

I have a problem with the frontend_model of the system.xml This is the system.xml <field id="words" translate="label" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="1"> ...
0
votes
1answer
38 views

Layout XML Error - Magento 2

I change the deploy mode to developer on Magento 2 and now I see the following error: 1 exception(s): Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'block': This element is ...
0
votes
0answers
15 views

Get configValue in _prepareToRender function of a block

I want to get the configValue of system.xml in this block <?php namespace Module\Vendor\Block\Adminhtml\Menu\Field; use Magento\Config\Block\System\Config\Form\Field\FieldArray\...
1
vote
2answers
38 views

How to get block from controller in magento 2

I want to get block Magento\Catalog\Block\Product\ProductList\Toolbar, I tried this code but it not work and show error Type Error occurred when creating the object: `Vendor/Module/Block/Search` My ...
0
votes
0answers
30 views

Moving language block in footer not getting after reference block in magento2

I want move header language block into footer after copyright but it's display before copyright block i have tried using <move destination="footer-container" element="store_language" after="...
0
votes
2answers
82 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 ...
2
votes
0answers
34 views

Take value of a field in a block and place it in another field

I have a problem taking values from a system.xml field to show them in another field. This is the system.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-...
2
votes
0answers
23 views

Cache life time with varnish

Magento Magento\Framework\View\Element\AbstractBlock has method getCacheFiletime, it return lifetime of cache in seconds. How it will work with varnish?
3
votes
1answer
19 views

Magento2: Phtml file not visible on PDP

I have create a module which consists an extra button on the product description page . For this I have added a layout catalog_product_view.xml which is below. <?xml version="1.0"?> <page ...
0
votes
0answers
23 views

Overwrite block layout inside text_list (content) blocks

I re-developed the whole category page in a layout.xml file included in my custom module, trying to reuse the block names. I needed to change many block (type) classes. I had read that by redefining ...
3
votes
1answer
30 views

SOLVED Createblock definition in magento 2

i search around a lot about references of this function. but the documentation have a big lack. does somebody explain me this part of code (deeply) ? $this->getLayout()->createBlock(...
0
votes
1answer
28 views

How to remove side bar of best seller in my account page of Magento 2

I want to remove sidebar of best seller in My account page of magento 2
3
votes
1answer
34 views

Magento 2 - Argument 2 missing error on overriding file

I am trying to override Magento\Catalog\Block\Category\View added this code in di.xml <preference for="Magento\Catalog\Block\Category\View" type="Naheed\AllProducts\Block\Category\View" /> ...
3
votes
0answers
23 views

insert different block in the middle of block content

I have a phtml for a block like this : app/code/Vendor/Modul/view/frontend/templates/main.phtml <div class="business-container"> <nav class="mini-head"> </nav> <div class="...
0
votes
1answer
29 views

Magento 2 | is it possible to set block class by referencing a block?

I'm currently rewriting a layout file: <referenceBlock name="checkout.cart.totals> <!-- some stuff --> </referenceBlock> Is it possible to set the block class here? Thanks in ...