10 votes
Accepted

magento 2 - How to create a custom "admin" block and display it on an existing Admin page?

Traditional location for admin blocks is (Example): app/code/YourVendor/YourModule/Block/Adminhtml/... If you'd like to use block with phtml template you'd like to extend \Magento\Framework\View\...
Sergii Ivashchenko's user avatar
10 votes
Accepted

Add custom block in Magento 2 admin dashboard

You can try to create a custom module that adds the a block there. Create: \app\code\Custom\Module\registration.php: <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\...
Adrian Z.'s user avatar
  • 707
7 votes
Accepted

Magento2 not getting post data from ui component phtml file

You have to just add data-form-part="forrname_form" in your input filed forrname_form it's must be similar with your ui form name your code shold be like now: <tr> &...
Rutvee Sojitra's user avatar
7 votes
Accepted

Magento2: How to call custom block in phtml file

Call phtml like this below way : <?php echo $block->getLayout() ->createBlock('Codism\Csr\Block\Index\TopMenu') ->setTemplate('Codism_Csr::menu.phtml') ->toHtml(); ?> ...
Rohan Hapani's user avatar
  • 17.4k
6 votes
Accepted

Magento2 loading admin layout and template in a new page

Your file name needs to be changed like this: From vendor_gift_index.xml To gift_gift_index.xml
Keyur Shah's user avatar
  • 18.1k
5 votes

How to include module's CSS in CMS pages with module block

Put your js file in your custom module Vendor_Module/view/frontend/web/js/yourjsfile Create requirejs-config.js file in your custom_module/view/frontend. add below code in it . var config = { "...
Manthan Dave's user avatar
  • 9,826
5 votes
Accepted

How to add a custom block within checkout cart summary in magento 2

You need to create this file in your custom module/theme to add custom Block on cart page. app/code/Vendor/Module/view/frontend/layout/checkout_cart_index.xml Content for this file is.. <?xml ...
Kishan Savaliya's user avatar
4 votes
Accepted

jQuery-ui autocomplete: Cannot read property 'element' of undefined

There is issue with Magento2 autocomplete in consequence of extending of base jquery-ui widget by Magento application. More details by link: Magento 2 & JQuery.UI.Autocomplete
Max's user avatar
  • 4,054
4 votes
Accepted

Where is Content block for <reference name="content" tag

For the regular frontend pages the content block is defined in the app/design/frontend/base/default/layout/page.xml: <default translate="label" module="page"> <label>All Pages</...
Siarhey Uchukhlebau's user avatar
4 votes
Accepted

Create block between header and main

I have tried and its working for me. <referenceContainer name="page.wrapper"> <container name="page.wrapper.second" as="page_wrapper_second" htmlTag="div" htmlClass="my-custom-div" ...
Nikunj Vadariya's user avatar
4 votes
Accepted

Magento 1 - Pass multiple variables to view

$foo = array(); $foo['currentTime'] = date("H:i", time()); $foo['someValue'] = 123; $this->loadLayout(); $this->getLayout() ->getBlock('newsletter_popup') ->assign('foo'...
Eugene Kapelko's user avatar
4 votes
Accepted

How to add a custom block after product info in product view page magento2?

Why you need phtml, You can directly call static block. You can use below code in: [VENDOR_NAME]/[THEME_NAME]/Magento_Catalog/layout/catalog_product_view.xml <referenceContainer name="product....
Pawan's user avatar
  • 5,891
4 votes
Accepted

Move Custom tab at top of left sidebar customer dashboard

Hope you doing well. I'm also facing this issue but after some time have solved this. Follow mentioned steps. create file at view/frontend/layout/customer_account.xml. <?xml version="1.0"?> &...
Bhavin Gehlot's user avatar
4 votes

Magento2: Custom module not working

There are a few problems in your module: You have used Outdoor_Configurator in module.xml but in Controller, Block, and layout you have used Vendor_Module. registration.php is missing from the code ...
Mohit Kumar Arora's user avatar
4 votes
Accepted

Magento 2.3 add custom block under each product in category page

Create di.xml file at /app/code/Vendor/Module/etc/frontend/di.xml : <type name="Magento\Catalog\Block\Product\ListProduct"> <plugin name="block-product-list" type="Vender\Module\Plugin\...
Rohan Hapani's user avatar
  • 17.4k
3 votes
Accepted

Custom Block generating an error on template: Magento

After trying to execute the given SQL query in phpmyadmin for a default Magento database, I got the following error: #1054 - Unknown column 'e.name' in 'field list' What this means is that the ...
V.S's user avatar
  • 914
3 votes

Disable page cache for a single block

You can't disable single block cache like in magento 1, Magento recommends handling customer related data via ajax. So you need to create an api endpoint or section data and use javascript to ...
Gosu Przmak's user avatar
3 votes
Accepted

Magento 2: How to add custom form on category page?

Create catalog_category_view.xml and call your custom form block app/code/Vendor/Module/view/frontend/layout/catalog_category_view.xml <?xml version="1.0"?> <page xmlns:xsi="http://www.w3....
Prince Patel's user avatar
  • 22.7k
3 votes

how to set custom template in custom block file in magento 2

You can set template by call in your xml like: <block class="Magedelight\EWallet\Block\Customer\Addmoney" name="customer_add_money" as="customer.add.money" template="Magedelight_EWallet::customer/...
Birjitsinh Zala's user avatar
3 votes

How to add a custom block within checkout cart summary in magento 2

You need to create layout file checkout_cart_index.xml at below path and paste this below code : app/code/VendorName/ModuleName/view/frontend/layout/checkout_cart_index.xml <?xml version="1.0"?&...
Rohan Hapani's user avatar
  • 17.4k
2 votes
Accepted

Function call returning fatal error: Call to undefined function getRecentProducts()

EDIT: I tested your code on a local installation, I assume you copied it from somewhere. The problem there is that - is not really a minus but some different special character (I haven't investigated ...
fmrng's user avatar
  • 3,398
2 votes
Accepted

Is this the correct way to add a custom block to before_body_end only on homepage?

The template location is wrong. Assume that your template is located at app/design/frontend/Your_Pakage/Your_Theme/template/page/html/custom_code.phtml. Magento,design fall back logic it would be ...
Amit Bera's user avatar
  • 77.5k
2 votes

Magento2 loading admin layout and template in a new page

https://magento.stackexchange.com/a/102800/36102 combined with remove protected function _toHtml() { return $this->_template; } I have no idea why this worked, but it actually passes ...
Lachezar Raychev's user avatar
2 votes

$product->getOptions() returns empty result

The problem is that the product is not fully loaded in your block. The load() method makes sure that all information of an object is loaded. If you only use loadByAttribute() or a collection, this is ...
simonthesorcerer's user avatar
2 votes

$product->getOptions() returns empty result

Try this: if (Mage::registry('current_product')) { $product = Mage::registry('current_product'); } else { $product = Mage::getSingleton('catalog/product'); } if ($product->getId()) { ...
Abdul's user avatar
  • 9,701
2 votes
Accepted

How to ovveride a block in custom module?

You can try with config,xml file as below, Replace tag with catalog, In your module you need catalog module override so you have to used catalog tag before rewrite tag. you have to define your core ...
Rakesh Jesadiya's user avatar
2 votes

Module not working after namespace magento 2

Did you change the registration.php (https://github.com/sohelrana09/magento2-module-additional-shipping-block/blob/master/SR/AdditionalShippingBlock/registration.php) If not - change it to yours ...
Goldy's user avatar
  • 1,013
2 votes
Accepted

Magento 1.8 - Custom Block just on Homepage

Not the correct way. As you mentioned Just on home page you need static block Just put below any one line code in content of your home page inside Admin->CMS pages {{block type="cms/block" ...
Akhil Gupta's user avatar
  • 1,946
2 votes

Mtslideshow SUPE8788 getConfig returns null

If you installed SUPEE-8788 this code is deprecated. I suggest you follow this post in order to make your module SUPEE-8788 compatible: https://magento.stackexchange.com/a/142013/2380
Raphael at Digital Pianism's user avatar
2 votes
Accepted

Adding a new custom phtml block to the header

wrong template file location it should be in <theme>/Magento_Theme/templates/html/headersitemenu.phtml Update block name navigation.sections already exist so you can't use change to some ...
Bilal Usean's user avatar
  • 9,977

Only top scored, non community-wiki answers of a minimum length are eligible