Stack Exchange Network

Stack Exchange network consists of 174 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
14 views

Is it a simple way to set conditions for widget of type CMS static block?

I want a CMS static block to appear in some product pages, but not all. The condition would be "brand is xxx", but unlike other widget types there is no condition option on Widget Settings. Is there ...
0
votes
0answers
9 views

How to always keep my block in the same section regardless of the template to be used?

Develop a block which I have positioned in a specific section of the product detail page, this works perfectly but if I change the theme of my store the block is no longer positioned where I need <...
0
votes
2answers
22 views

Multiple use of `getConnection()` in a single block and impact performance issues

I found a module someone created and looked into the code. I found that this person was making a lot connection as such in a single block: public function checkStoreExists($storeID){ $connection =...
0
votes
0answers
24 views

How to fetch product data into custom .phtml block on product view

I'm having trouble trying to fetch Product data such as price, SKU etc into a custom .phtml file referenced as a block within my catalog_product_view.xml file. Here's what I'm struggling with... I'm ...
0
votes
3answers
69 views

Cart details not getting in mini cart

For some purpose (something like popup) I'm trying to fetch cart details in minicart.phtml from Magento2\vendor\magento\module-checkout\view\frontend\templates\cart\minicart.phtml. I directly ...
0
votes
0answers
10 views

CSS & navbar edits for a Magento noob - ver. 2.2.6

I need to make a few simple changes to an existing Magento site, and although I have some wordpress experience, my Magento is currently 0. It's using a theme called Smartwave Porto, and the changes ...
0
votes
1answer
22 views

Add a static block(widget) before the breadcrumbs

I'm using Magento 2.3.0, and I'm trying to add a block before the breadcrumbs, without any padding or margin. I've created a block from the back-end, then my widget using this block, and then placed ...
0
votes
3answers
57 views

Custom registry is not retrieved in block magento2

I am setting custom registry in my module like below. here is my controller file code. use Magento\Catalog\Api\CategoryRepositoryInterface; use Magento\Catalog\Model\Category; use Magento\Framework\...
1
vote
4answers
78 views

What is the functional difference of Block & Container in Magento 2?

Block vs Container functional difference. I have followed this url but doesn't clear much for me. Which type of classes are extended by block and container. Note : I know how containers and Block ...
0
votes
1answer
24 views

Element 'block', attribute 'remove': The attribute 'remove' is not allowed. Line: 745

I'm getting this error when I hit the front end. Couldn't able to find any solution regarding this. 1 exception(s): Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'block'...
1
vote
3answers
26 views

Can I and should I call Block methods from its' View Model?

I have a template and should write some logic. I have made a view model and I'm calling it from a template. Should I call block methods from the view model? And if so, how can I do it?
0
votes
0answers
30 views

Edit up-sell block to show more than 1 product

When I add, products on the up-sell tab in the backend. It show each product in a single block. instead of a nice layout of 2 or 3 products in each line. How can I edit the block layout for the up-...
2
votes
1answer
41 views

What is the use of getFormActionUrl()?

In Magento2.1.10 I am trying to make admin grid module and found below function in given path \app\code\xyz\Grid\Block\Adminhtml\Grid\addrow.php public function getFormActionUrl(){ if ($...
0
votes
1answer
35 views

Pass boolean or variable from Child Block to Parent Block?

I'm probably thinking about this the wrong way, but I have two blocks and one is the child of the other. In the parent's template file, I'm calling getChildHtml() and rendering the child block that ...
1
vote
1answer
22 views

call block from controller via ajax

I call controller function from phtml via ajax, it calls controller function Now i am trying to call block function in controller it is not working Controller code public function __construct( ...
0
votes
2answers
49 views

Registry not working in magento 2

I need to call the controller function from block . in magento 2 i use the registry. In my block i wrote public function __construct( Template\Context $context, \Magento\Catalog\...
1
vote
1answer
16 views

not able to render phtml file magento 1.7

this is my config file <?xml version="1.0"?> <config> <modules> <Ilogix_Regionbased> <version>0.1.0</version> </...
0
votes
3answers
50 views

How to hide a div in .phtml if a customer is logged in magento 2

I want to have a block in home page that show text and button if customer is not logged in and if he is logged in this block have to disapear so how to proceed any help please here is my code in ....
0
votes
0answers
6 views

Put price.phtml into a specific block to exclude it from Lesti FPC?

I am not showing prices to guest users, only to those that are logged in. I am also using Lesti FPC. The problem here is, that Lesti caches the shown prices and shows them to not logged in users or it ...
0
votes
2answers
28 views

core/template block not showing

I am trying to add a block on my checkout page but for some reason its not working. <block type="core/template" name="checkout.cart.consultant" as="consultant" template="checkout/cart/consultant....
0
votes
0answers
17 views

magento 2 in update password to hash in save to database not working?

I will try to change password but its not working! <form method="POST"> <label>Old Password : <input name="old_password" id="old_password" type="password" /> </label> <...
0
votes
1answer
34 views

Magento 2 - Move Block Not Working

I've created a faqs.xml for a bespoke page template and this is my code: <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/...
0
votes
0answers
14 views

Magento 2 in how to change the password in direct in database link to connect using Seller without hash method?

i have try to change direct connect in database but its not working? <input type="password" placeholder="New Password" id="password" required> <input type="password"...
0
votes
0answers
18 views

Magento 2 in How to change password in programmatically without hash method in password? [duplicate]

I am trying below code but it is not working $customer = $this->_CustomerRepositoryInterface->getById($id); $customerSecure = $this->_customerRegistry->retrieveSecureData($customer->...
0
votes
1answer
27 views

M2 | How to find referenceBlock name for the Sales Order View : Account Information Section?

Part1: I need to know the referenceBlock name for: Part 2: and put a button at: “If you have knowledge, let others light their candles in it.” ― Margaret Fuller
0
votes
0answers
15 views

Magento 2 | Get billing country in sales email as block

We run an online shop in Germany and ship to non-EU countries like Switzerland and Norway. Those orders or better invoices get calculated without any tax/vat. The only downside of that is that we must ...
0
votes
0answers
9 views

Magento 1 product options inside popup or cms page

I am trying to display product options in cms page or popup. I am trying to find out if there any way to display it in a similar way like this: {{block type="catalog/product_view" product_id="391" ...
2
votes
0answers
28 views

Custom plugin files updated code is not showing in admin panel though cache is cleared

I have created a custom module. Controller files are working fine. I am trying to update my module MySQL version and adding new fields to the module in block folder files but they are not applying in ...
0
votes
1answer
45 views

how to get current products custom attribute value in block(phtml) to display in products details page magento2?

Here i am trying to get current products custom attribute value in block(phtml) and after that i want to show these custom attributes values in products details page using block,phtml file ...
0
votes
2answers
57 views

Apply discount Block moving issue in magento2 cart page

I need to move apply discount block to the summary block in cart page. I have used below code in Vendor/Module/view/frontend/layout/checkout_cart_index.xml <move element="checkout.cart.coupon" ...
0
votes
0answers
13 views

Is magento 2 allow to use templates in difference area?

Example i have one module works in frontend or area difference adminhtml area and have some layout render blocks <block class="MyModule/Block/Class" name="block_name" template="MyModule::...
0
votes
1answer
33 views

Magento 2 Add CMS/phtml block bottom before product_list_toolbar and after product_list (Between)

I am not able to add a cms block in category page. XML: <block class="Magento\Framework\View\Element\Template" name="catalog.filter.content.bottom" template="my_module::test.phtml"/> what I ...
1
vote
1answer
32 views

Magento 2.2: Where is the block of template html?

I need to add a conditional by checking the information of an custom attribute, for example if it is 'S' to show the address, if it is 'B' not to show the address I need to modify the next template: ...
0
votes
0answers
9 views

Extend catalog_product_prices not showing

I'd like to extend the block which shows the product price in the category page. I created the view/frontend/layout/catalog_product_prices.xml file with the following content. <?xml version="1.0"?&...
0
votes
0answers
10 views

M2: Can we use Model class in Block and same Block class in Model for sharing values?

I want to use an instance of a Model into a Block and an instance of same Block into same Model. As namespace Demo\HelloWorld\Block; class Seller extends \Magento\Framework\View\Element\Template { ...
0
votes
1answer
119 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
2answers
38 views

Magento 2 | When to use referenceContainer and when referenceBlock?

I am getting same output if I use referenceContainer or referenceBlock As <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:...
1
vote
2answers
37 views

how to get products collection in block magento 2?

Actually I am trying to get products collection in block using resource model class here I want to get the price of the first product if product is configurable Magento 2. <?php namespace ...
0
votes
2answers
38 views

Can't rewrite block (Mage_Review_Block_Product_View) Magento M1

Cant rewrite Mage_Review_Block_Product_View for some reason. In my config file I have: <?xml version="1.0"?> <config> <modules> <NameSpace_ModuleName> ...
0
votes
0answers
29 views

Filters in custom product collection M2

I have created a new category in backend and fetched products programmatically via override ListProduct block <preference for="Magento\Catalog\Block\Product\ListProduct" type="Custom\Vendor\Block\...
0
votes
1answer
38 views

Magento 2.2: How to remove add_to_wishlist button from, and add SKU view in, recently viewed products widget in module

I want a extra tab on product page with 4 previously viewed products. Besides that I want to remove "add_to_cart,add_to_compare,add_to_wishlist" buttons and add SKU attribute to recently viewed ...
0
votes
0answers
16 views

call breadcrumbs block twice in page.xml magento 1.9

I am trying to call breadcrumbs.phtml file twice through page.xml file. In page.xml breadcrumbs are added here <block type="page/html" name="root" output="toHtml" template="page/3columns.phtml">...
0
votes
3answers
36 views

Move block before Tab Magento2

i would like to create a banner on product view page and move this banner AFTER the short description and before the tab content. I user this code under catalog_product_view.xml <move element="...
0
votes
2answers
49 views

Fatal Error : when get child block using controller

When get block using controller got fatal error like Fatal error: Call to a member function getPostUrl() on null in /app/design/frontend/theme/Vendor_Module/templates/post/list/item.phtml on ...
1
vote
2answers
37 views

Adding a Block between Menu and Breadcrumbs

Going a bit nuts trying to get my head around this. Debug mode doesn't help me. I'm trying to add a block just before the </header> on only Product Pages. I've created a phtml file with my ...
0
votes
1answer
18 views

I have an error pointing to this block class but i'm not sure what's wrong with it.. (magento 2.2.5)

A validation error occured in an XML layout file <block class="Magento\Cms\Block\Block" name="gbp_success_page-block"> <container name="gbp-fullwidth-hero-wrapper" as="heroWrapper" ...
0
votes
1answer
31 views

Magento 1 Set Template Doesnt work

I'm new to M1. I'm trying to add a new custom option type in product My Config <?xml version="1.0"?> <config> <modules> <CompanyName_ModuleName> <version>0....
0
votes
1answer
34 views

Magento 2: Parsing Item information through block

Good day, I want to create a phtml file and create a dynamic block with that one to put on CMS pages - Take it as product information blocks where i want to display the product name, the price, the ...
0
votes
0answers
12 views

Add template below price info in product grid

I would like to add a new template file below price info in product grid. I found the widget used for product grid:vendor/magento/module-catalog-widget/etc/widget.xml:36 Is there any method to add a ...
0
votes
1answer
147 views

Override Sales order history issue in magento2

I am trying to override sales order history block into custom module. Below code i used in di.xml file. <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...