33 votes

Magento2 Setup version for module is not specified

In my case it was the file/folder permission of that module. Apache couldn't read the configuration file. Apply following permission to your module directory. chmod 775 <module path> -R
Nahid's user avatar
  • 621
24 votes

How can I get the collection of a custom module in magento 2

You need to create three files for getting collection from custom module Model, 2) ResourceModel, 3) Collection Namespace: Prince Module: Hello Table: hello 1) Create Hello.php Model file at app/...
Prince Patel's user avatar
  • 22.7k
24 votes

How to call a PHTML file within a CMS page Magento 2?

In magento,if you want to add block class in cms page, then you can tre below code {{block class="Magento\Bannerslider\Block\Slideshow" template="Magento_Bannerslider::bannerslider.phtml"}} Formula ...
Amit Bera's user avatar
  • 77.5k
23 votes

Magento2: what is the basic difference between plugin and preference?

In simple words Preference is used for overriding class Plugin is used for adding functionality before, after and around methods. For As Your example: <preference for="Magento\Catalog\...
Prince Patel's user avatar
  • 22.7k
18 votes

Magento 2: Call a static block using xml

Try below code. Call from Phtml File: <?php echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('block_identifier')->toHtml();?> Call from cms page or ...
Makwana Ketan's user avatar
18 votes

Add More Mass action in Order grid in magento2

You need to define router for adminhtml in order to get it work with your custom module. You can define the same at app\code{{your_package}}{{your_module}}\etc\adminhtml\routes.xml as like below: ...
Himmat Paliwal's user avatar
13 votes

Magento2 Setup version for module is not specified

Reference source: https://magentoexplorer.com/magento-2-setup-version-for-module-is-not-specified-how-to-fix (in my case, i got this error when creating a new Magento 2 module) You may encounter this ...
Hung Tran's user avatar
  • 441
12 votes

Magento 2: Is there a Profiler?

From v2.2.4 and above From version 2.2.4 you can now enable/disable Profiler from the CLI : # Enable the profiler. bin/magento dev:profiler:enable # Disable the profiler. bin/magento dev:profiler:...
Cladiuss's user avatar
  • 1,271
11 votes

Delete operation is forbidden for current area

I recently had this problem while writing a console command to delete empty categories. As said in another answer you need to register 'isSecureArea' to true. To do this in a console command you ...
Mir's user avatar
  • 466
11 votes

Delete operation is forbidden for current area

if you using script please create the registry object as shown below. $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $objectManager->get('Magento\Framework\Registry')-&...
Liz Eipe C's user avatar
  • 1,286
7 votes
Accepted

Magento 2 "sequence_" tables

I happened to notice this table. In case you're still interested, it records the increment_id for order/invoice/shipment of your store. e.g. Place a new order, it increases by 1. Set it to 1000000, ...
Tienyi Chi's user avatar
7 votes

How to show session messages at front end in magento 2 beta

In layout file i have used the below code. now i got the message in frontend. <referenceContainer name="page.messages"> <block class="Magento\Framework\View\Element\Template" ...
Naveenbos's user avatar
  • 1,226
6 votes

How to show session messages at front end in magento 2 beta

I have faced the same issue and I was able to fix it by adding the following in my layout file: <body> <!-- your layout content --> <referenceContainer name="page.messages"> ...
jony974's user avatar
  • 71
5 votes

Magento 2: Call a static block using xml

Call from Xml File worked. Change the "block_identifier" from the CMS block created on magento dashboard and add it to layout.xml <referenceContainer name="footer"> <block class="...
Bhanu Gupta's user avatar
5 votes

Email template 'custom_mail_template' is not defined

I face the same problem when I use a custom email template and its resolved by the following changes. If you check your system.xml file you can find that you path for system config for email template ...
Nikunj Rawat's user avatar
4 votes

Delete operation is forbidden for current area

Expanding on Chris O'Toole's answer. I too need to delete categories from a command, actually from multiple commands. Initially just having $oRegistry->register('isSecureArea', true); in one ...
quickshiftin's user avatar
  • 1,416
4 votes

Magento2 Setup version for module is not specified

An additional scenario where this has come up for me was due to performing a pull on my project's repository and the module had been removed from the file system. While this was intentional, there ...
Darren Felton's user avatar
4 votes

Magento 2: Call a static block using xml

Since Magento\Cms\Block\Block class is deprecated, you should use: <block name="custom_block_name" class="Magento\Cms\Block\BlockByIdentifier"> <arguments> &...
mskalny's user avatar
  • 131
4 votes

Magento 2 : Displaying the database table values in frontend

For that you first create the Model So in my case Module name is News app/code/FME/News/Model/News.php <?php namespace FME\News\Model; class News extends \Magento\Framework\Model\AbstractModel ...
Fme Extensions's user avatar
3 votes

Magento 2: Call a static block using xml

Try below code: <block class="Magento\Cms\Block\Block" name="news"> <arguments> <argument name="block_id" xsi:type="string">news</argument> </arguments> &...
tru.d's user avatar
  • 325
3 votes

Current page layout handle Magento2

You can have access in any $block by calling $block->getLayout()->getUpdate()->getHandles(). If you prefer, you can create a new module and inject this block in the end of content. For ...
Ricardo Martins's user avatar
3 votes

Magento2: what is the basic difference between plugin and preference?

In brief : Preference is used to specify the default implementation of an interface. Plugin ( Interceptor ) is used to extend the behavior of a public method of another class. In detail : ...
nikin's user avatar
  • 1,132
3 votes

How to get events/observers in magento 2

In my case I can get list of all event by doing below changes which is very short cut like we do in mage.php file of magento1: Note: I have only tested on magento2.1.1 version so I am not sure for ...
jyotiranjan.in's user avatar
3 votes

How to enable Full Text search in admin grid of magento2

To make fulltext search work in magento 2 admin listing/grid you need to: Add index to the table you use for storing your listing/grid data Add addFilter method to you grid/listing DataProvider that ...
transversus's user avatar
3 votes

custom xml get error is not valid?

This is late, and probably won't be marked - but in some of the xml files the <?xml version="1.0"?> Should say <?xml version="1.0" encoding="UTF-8"?> Such as in /vendor/magento/...
ol'bob dole's user avatar
3 votes

How To Add Country And State Dropdown In Admin Side in Magento2

In the block constructor, you'll need to enable two classes with the collection of regions and countries. Also, don't forget to add the corresponding fields in there. Next, apply the standard ...
Mageworx's user avatar
  • 3,796
3 votes
Accepted

Magento 2: How to remove add to cart template from product detail page

Override the template by copying Magento\Catalog\view\frontend\templates\product\view\addtocart.phtml to Vendor\Module\view\frontend\templates\product\view\addtocart.phtml. Original code: <?php /*...
Rendy Eko Prastiyo's user avatar
2 votes

Current page layout handle Magento2

You have to just add below line for Template view file and Block file to get current action name of page. This is nice working with any template file and block file, echo $this->getRequest()->...
Rakesh Jesadiya's user avatar
2 votes

Magento 2: Apply visibility and status filters on product collection

for product collection with status enable and visibility: you can try with below code protected $productCollectionFactory; protected $productVisibility; protected $productStatus; public function ...
Anas Mansuri's user avatar
  • 2,627
2 votes

How to show session messages at front end in magento 2 beta

Try using XDEBUG, set break point at your controller action. Maybe it was duplicated redirect and making lost messages in manager.
De Nguyen's user avatar
  • 401

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