Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
162 votes
10 answers
192k views

To use or not to use the ObjectManager directly?

Ok, so yesterday we had a big talk with other people from the Magento community regarding the direct use of the ObjectManager in classes/templates. I'm already aware of the reasons why we shouldn't ...
Raphael at Digital Pianism's user avatar
17 votes
10 answers
49k views

How to create a Magento 2 Patch?

I am working on a Magento module that requires a quick fix. I assume I can fix it by creating Magento 2 "patch" way. I have never created a patch file before, can anyone help me to create a ...
Charlie's user avatar
  • 3,136
8 votes
10 answers
9k views

How to create simple module in magento 2

I'm new to magento2. I want to create simple Hello World module in magento 2. How to create this module?
Saravanan DS's user avatar
  • 1,126
21 votes
8 answers
62k views

How to override .phtml files in Magento 2

I want to customize product details page, So it required to override some .phtml files in following locations. So I want to know, how to override .phtml files in vendor\magento\module-catalog\view\...
nuwaus's user avatar
  • 2,354
50 votes
18 answers
93k views

Magento 2: Safe and easiest way to disable Compare products & Wishlist Module

I am building Magento 2.0 only to sell 2 of my products online. The compare products and wishlist module is irrelevant for me. How I safely and easily remove those modules? I dont want to hack the ...
Malaiselvan's user avatar
  • 1,422
9 votes
2 answers
5k views

Magento2: How to include third pary module through composer.json in custom module

I created a custom module, this module depends on thirt party module(tecnickcom/tcpdf), I added this library in my custom module composer.json file { "name": "packagename/mymodule", "description": "N/...
Yogesh Karodiya's user avatar
16 votes
5 answers
19k views

How to "add to cart" a product with custom input field and save it to Database?

I had created a custom module in which I am overriding the add to cart form on the product page, and I successfully did it with catalog_product_view.xml file. Now I can see a custom input field on the ...
Fayyaz Khattak's user avatar
16 votes
4 answers
17k views

How to show a custom attribute in the admin Shipping Address box?

I have added the drop-down custom field on the checkout page with custom values. It's working fine also save attribute values in the database but not display in the order shipping address. Any idea ...
Magento2 Devloper's user avatar
7 votes
1 answer
32k views

magento2 how to override model file? [duplicate]

I would like to override (call the below model file from my custom module called Demo_Customprice /vendor/magento/module-catalog/Model/Product/Option/Value.php How could we achieve this?
Nagaraju Kasa's user avatar
25 votes
7 answers
19k views

Magento2 CLI module:enable gives error "Unkown module(s)"

In Magento2 I've built a simple custom module and want to enable it by CLI: bin/magento module:enable Vendorname_Modulename But it is giving me the following error: Unknown module(s): '...
7ochem's user avatar
  • 7,582
8 votes
2 answers
38k views

Magento 2 - Send form data to Controller using AJAX and return Result to PHTML

I am working on a simple custom module, where user can input height and the weight/BMI will be shown as output on form submit. The page where user enters input is Calculation Page while output is ...
Slimshadddyyy's user avatar
34 votes
5 answers
60k views

Magento 2: How to get controller, module, action and router name?

Magento 2: How to get controller, module, action and router name?
Bhavik's user avatar
  • 1,240
23 votes
2 answers
38k views

Magento 2.1.1 How to load Order with Increment ID using OrderRepository object

What would be the latest best practice to load Order using increment ID (instead of Order ID) using OrderRepository
frostshoxx's user avatar
8 votes
3 answers
15k views

Magento 2: How to override Adminhtml "Shipping & Handling Information" Information

I'm following https://ranasohel.me/2015/10/02/how-to-overwrite-sales-view-order-phtml-file-in-magento2/ I would like to override magento\vendor\magento\module-shipping\view\adminhtml\templates\order\...
Jackson's user avatar
  • 9,969
7 votes
2 answers
9k views

How does translation scope work in Magento 2?

In Magento 1 different modules could provide different translations for the same string and the various __() methods in helpers and blocks always passed a module scope to the translator model, to ...
Fabian Schmengler's user avatar
6 votes
2 answers
15k views

Magento 2 - Custom Page Layout

I wish to add a custom home page layout in Magento 2. In Magento 1, it's very simple, i create my module : <?xml version="1.0"?> <config> <modules> <Vendor_Custom>...
Eric Arbeloa's user avatar
5 votes
1 answer
7k views

How to add new css file for a module in Magento2?

I'm trying add custom css file for my module namely Magento_Hello in magento2. In the module I've created new page and trying to add new custom css to that page. Here is what I have done in app/code/...
SIBHI S's user avatar
  • 2,055
35 votes
2 answers
42k views

Magento 2: Default Values for `system.xml` Configuration

In Magento 1, it was possible to Configuration a user interface for the System Configuration section in etc/system.xml files Set default values for those fields in the etc/config.xml files Behind ...
Alana Storm's user avatar
  • 44.4k
27 votes
11 answers
37k views

How to disable Magento 2 reviews

I'm trying to disable the Magento 2 product reviews feature. I tried Disabling the Module at the Magento 2 admin Stores\Advanced\Advanced\Magento_Review but the reviews tab on each product is still ...
Omry Zobel's user avatar
15 votes
5 answers
9k views

Magento 2 does not allow linking Modules using symlinks

I've added a local development module (separate git repo) to Magento 2 using symbolic links and it was working fine until I hit the PHTML templates. After heavy debugging I found out that the Magento ...
Jisse Reitsma's user avatar
13 votes
5 answers
25k views

How to solve the message "Character content other than whitespace"?

I've received that message below when I try to reset my admin password using the Admin panel, I've my custom module installed. I see this same message on a white screen when I try to access using the ...
Rafael Corrêa Gomes's user avatar
12 votes
7 answers
49k views

Magento2 : How to get product id to my custom module

I am new to magento2 and currently I'm building a custom module and i want to get the product ID/SKU from the catalog. I'm trying to call using a function located in the Block folder. please advise!
ming's user avatar
  • 125
10 votes
1 answer
23k views

Create Magento 2 Upgrade Script to add/update new field into custom module table

Anybody have any idea/suggestion about creating Magento 2(CE Stable version) Upgrade Script(in custom-module) for adding/updating new field into custom table ? I know about "InstallSchema" but is ...
Vicky Dev's user avatar
  • 1,992
9 votes
2 answers
6k views

Validation of the terms and conditions (custom module)

I've made a custom module which enables me to have the T&C checkbox moved beneath the payment methods and the place order button inside the summary div, like so: Now, whenever I select a payment ...
Condor's user avatar
  • 647
8 votes
2 answers
4k views

Including generated 3rd party PHP library in Magento2

I am creating a module that connects to a SOAP service, I have generated classes for this service using wsdl2phpgenerator which uses autoload.php. Placing this in "lib/" with the correct class namings ...
nenne's user avatar
  • 654
2 votes
1 answer
2k views

Magento2 : Custom payment Module with Drop down list Is not working

Please check my Custom payment Module, I was able to display the list in drop down in Payment method, But when i select and place order it is not working as expected. Please download the complete ...
JB Pakalapati's user avatar
0 votes
2 answers
4k views

How to fetch data from a custom table in magento2 and show in home page

I have created a custom module with a custom table, now I need to fetch the data from the table and display in the home page. I achieved it by applying object manager I know it's not the correct ...
jithin 's user avatar
0 votes
3 answers
8k views

Magento 2 - add Enable / Disable field for custom module

I want to add some fields in the Magento 2 Admin Panel for my custom module and then I want to check in the phtml file if this field is have value or not. I need to add this fields: - enable / ...
Robert's user avatar
  • 2,186
21 votes
6 answers
33k views

How can I decrypt an encrypted configuration value?

This is the code that I'm using to get the value from a specific field saved via the admin panel. protected $_paymentData; protected $_scopeConfig; protected $logger; public function __construct( ...
Magento2 Devloper's user avatar
18 votes
5 answers
19k views

Why `code` folder is missing under `app` folder in magento 2 stable version?

I have downloaded Magento 2 stable from https://www.magentocommerce.com/download with sample data and installed. It's working fine in both areas i.e. frontend & backend. But I could not find app/...
Praful Rajput's user avatar
13 votes
1 answer
5k views

Magento 2 uninstall module

Apparently, now Magento 2 supports uninstall scripts that allow db schema modification when uninstalling a module (horay!!). As explained in here this only works for module installed via composer. (I ...
Marius's user avatar
  • 199k
10 votes
1 answer
25k views

How to add a custom helper in my module?

How to create new Helper or override/rewrite Core Helper in Magento 2 module? I tried adding dependency into my module.xml of Custom Module, but it doesn't load Helper class at all. Below is my ...
Vicky Dev's user avatar
  • 1,992
6 votes
2 answers
18k views

How can i disable module manually in Magento 2

I'd like to know if its possible to manually disable a module by changing some code like in Magento 1. I know the SSH way.
Chriss's user avatar
  • 175
6 votes
2 answers
1k views

What are the first steps in exploring Magento 2? [closed]

I am planning to start out with Magento 2. Could you please advise me on the first steps of transition from Magento 1 to Magento 2? I have quite little experience with Magento 1 development, but ...
Siarhey Uchukhlebau's user avatar
5 votes
1 answer
8k views

Using Magento 2 custom cache in custom module

@Rakesh explains how to add custom cache in Magento 2 here. My question is how to actually work with my custom cache in Magento 2? In Magento 1 you would do something like: $cacheId = 'example_id'; ...
Lucio.d's user avatar
  • 113
4 votes
1 answer
7k views

How to define multiple routes in single module

I am defining two routes to be used in same module. <router id="standard"> <route frontName="hello" id="hello"> <module name="HelloWorld_Hello"/> </route> ...
Hiren's user avatar
  • 41
3 votes
2 answers
2k views

Constr is not a constructor on layout.js line 137 error custom module

I have gone through this posts and tried to implement the answers and suggestions Magento2 getting 'Constr is not a constructor' error for custom theme && Error in layout.js, cart ...
Mac's user avatar
  • 583
2 votes
1 answer
2k views

How to Create a excel file in custom module?

I want to create an excel format file for download in Magento 2 <item name="buttons" xsi:type="array"> <item name="add" xsi:type="array"> <item name="name" xsi:type=...
Nitesh Kumar  Singh's user avatar
2 votes
3 answers
782 views

Installation issue in magento marketplace 'page doesn't contain HIT in cache header.'

I have developed customer module in magento. When i am trying to submit in marketplace its keep giving the same error even after trying so many solutions. Installation issue: http://magento.dev/gear....
Pramod Kumar Sharma's user avatar
22 votes
4 answers
12k views

How to override Virtual Type class in Magento 2

How to override VirtualType block in Magento 2, I want to override following virtual type block with my own block, <virtualType name="Magento\CatalogSearch\Block\SearchResult\ListProduct" type="...
nuwaus's user avatar
  • 2,354
22 votes
2 answers
5k views

Magento 2: Where do Third Party Modules Go?

I just installed the first official release of Magento 2. I was surprised to find that the app/code folder was gone app/code This was for both the version downloaded from the website and the ...
Alana Storm's user avatar
  • 44.4k
16 votes
6 answers
32k views

How to get the base url from a JS file?

I want to retrieve a base URL and append it with my module controller link from a JS file, so it's impossible to use a block to get the base URL. So far I've done this: define([ 'jquery', 'mage/...
simple guy's user avatar
  • 2,494
16 votes
11 answers
63k views

Magento 2 - How to uninstall module?

How to uninstall module ? I read this document But it was not successful, and display below: php bin/magento module:uninstall SP_Gridthumbs SP_Gridthumbs is not an installed composer package
MrTo-Kane's user avatar
  • 3,674
11 votes
3 answers
10k views

Magento 2 How to uninstall attributes added by custom module?

So far I know that when uninstalling a custom module, it is possible to remove custom tables or columns added by custom module by using uninstall.php which extends \Magento\Framework\Setup\...
Ricky.C's user avatar
  • 2,182
10 votes
1 answer
11k views

Magento 2 Check If Customer is Subscribed to Newsletter

I am developing this custom xml export/import. In magento 2 how can I check if a customer is subscribed to newsletter? Right now I am loading the customer factory. \Magento\Framework\App\...
André Ferraz's user avatar
7 votes
2 answers
6k views

How to set cronjob dynamic schedule from database in Magento 2

I am working on a custom module for Magento 2. I did setup crontab there and it is working good with static schedule. <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
Sohan's user avatar
  • 297
6 votes
1 answer
5k views

How to display instructions for custom payment method

I have finally gave up. I spent 2 whole days trying to do this but I finally could not. I am developing a custom payment method which needs to show instructions for the customer before the actual ...
jstuardo's user avatar
  • 609
6 votes
4 answers
8k views

Magento 2 : override customer login.phtml file in custom module

I had developed "Hello world" extension in Magento 2. I want to override Customer login form of core files. What is correct way for overriding Customer login form file in Magento 2. I have coded ...
Bharat Desai - Certified Dev's user avatar
6 votes
2 answers
4k views

Dependecy error Magento 2 ('sectionLoadUrl' error)

I've asked a similar question before, but because of some research, it would not have been relevant anymore. So here a more comprehensive explanation of my problem. My scenario I want the cart page ...
Condor's user avatar
  • 647
5 votes
1 answer
14k views

Magento 2: Creating a custom layout

I'm having trouble creating a custom layout. I have successfully created a layout called home_page.xml which is a copy of the default 1column layout. I have selected this layout for my home page, ...
David's user avatar
  • 51