All Questions
1,419 questions
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 ...
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 ...
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 ...
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?
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 ...
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): '...
25
votes
3
answers
5k
views
List of not-used core modules that can be turn off with no harm
Reffering to this this topic for Magento 1, maybe it would be useful to prepare a list of core Magento 2 modules that can be turn off or completely removed with no harm for our store, because they are ...
23
votes
7
answers
23k
views
Strange Error when running setup:upgrade after module installation
I have tried to install wyomind google shopping and have the following error when running bin/magento setup:upgrade.
[UnexpectedValueException]
Unable to retrieve deployment version of static files ...
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
23
votes
2
answers
2k
views
Magento 2: what are the benefits of using UI grid components over the standard Grid.php?
So Magento 2 introduced the UI Components.
One of them is the UI Component Grid (you can find more information about it here: Explanation of UI Component Grid in Magento 2)
When creating a custom ...
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="...
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 ...
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(
...
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\...
19
votes
2
answers
53k
views
When exactly to use php bin/magento setup:upgrade
There are lots of situations in which I change some files in my module in the developer mode but the changes didn't take place in frontend until I run php bin/magento setup:upgrade
Just wanted to know ...
19
votes
2
answers
5k
views
Magento 2: How to Check if a Module's Installed
In Magento 2, is it possible to check if a module's installed at runtime?
In Magento 1 I'd either use the isModuleEnabled helper method, or manually fetch the global configuration tree and check the ...
19
votes
3
answers
5k
views
Property does not have corresponding setter in class Magento\Quote\Api\Data\AddressInterface while change checkout step
1 - I add a eav attribute to customer_address
$attributesInfo = [
'reference' => [
'label' => 'Reference',
'type' => 'varchar',
'input' => 'text',
...
18
votes
5
answers
28k
views
Magento2 REST API Error 'Class does not exist'
I've created a test Magento 2.0.2 REST web service based on Alan's blog: http://alankent.me/2015/07/24/creating-a-new-rest-web-service-in-magento-2/
I'm using Postman to call the custom web service ...
18
votes
2
answers
12k
views
What's a hard dependency and what's a soft dependency?
In Magento 2 (any stable version) you can run this command bin/magento info:dependencies:show-modules and you will get a csv file in the root of your application called modules-dependencies.csv with ...
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/...
18
votes
1
answer
6k
views
Magento 2 Enterprise: Create New Module in vendor directory
I tried to create new module in vendor directory in Magento Enterprise 2.0.0.
The module could not be loaded after I ran the Magento setup:upgrade.
If I move my files to the app/code directory, the ...
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 ...
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
16
votes
4
answers
26k
views
Less files in custom modules
How do you use less inside custom module
having created code/Vendor/module/view/frontend/web/css/source/custom.less
how do I include and compile?
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/...
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 ...
16
votes
5
answers
14k
views
Magento 2: How to set custom template for core block
I'm trying to override the register.phtml in my module, but it seems there are some config problem that make Magento unable to use my custom template to override the one in core module. I've checked ...
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 ...
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 ...
15
votes
2
answers
9k
views
How can I set configuration values in Magento 2?
Previously (in Magento 1, that is) we created a module called Setup which contained setting for the site. The upgrade scripts looks something like this:
$installer = $this;
$installer->startSetup()...
15
votes
2
answers
927
views
Create Employee Module like Customer module in magento 2
I have created Employee module. same as customer module. i have copied all files from vendor/magento/module-customer to app/code/Magento/Employee. I replaced customer with employee. but it shows an ...
15
votes
6
answers
2k
views
Magento 2 How to add Tab Component in admin module
How can I add UI Tab Component in the custom admin module with the help of the below user guide?
http://devdocs.magento.com/guides/v2.1/ui_comp_guide/components/ui-tab.html
There are not enough ...
14
votes
4
answers
3k
views
When to dispatch events in a custom module?
This is a question regarding both Magento 1 and Magento 2.
I understand that, as a good practice, 3rd party modules developers are encouraged to dispatch events in their custom module to make it ...
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 ...
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 ...
12
votes
3
answers
25k
views
Magento2: Load Model Data By Another Field
I have below table named "messages".
id | posts_id | message_description | created_at
-----------------------------------------------------------------------------
1 1 test1 ...
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!
12
votes
2
answers
4k
views
What and why is the proper way to load a model
I have quite a lot of experience with Magento but I realized that I don't understand which way of loading a model is the correct one and why. I've read everything that I could, about the topic but ...
11
votes
3
answers
11k
views
Magento 2: Disable all custom and Third Party Module in single Command
Is there is any way that we can disable all custom and third party Module in a single command? Currently, I am using below command to disable multiple modules
php bin/magento module:disable module1 ...
11
votes
3
answers
9k
views
ReflectionException error on Magento 2
I tried to install MailChimp module for Magento 2.
After I put all the files in the app/code/[vendor]/[module] and I run php bin/magento setup:upgrade, I received this error:
[ReflectionException]...
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\...
11
votes
5
answers
3k
views
Uninstalling a module
I'm trying to uninstall a module (my own) that I've installed via composer using CLI with this command:
bin/magento module:uninstall -r [Namespace]_[Module]
Based on the answer provided here by @...
10
votes
5
answers
18k
views
Magento 2 - How to disable wishlist and product review module
I want to disable the Wishlist and Product Reviews module including hiding all links in the menues (i.e. Dashboard, Top Navigation).
Is there an easy way to do this?
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 ...
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\...
10
votes
2
answers
9k
views
Magento 2: how to create your own custom cache type?
In Magento 1, it was possible to create your own cache type by declaring the following in your config.xml:
<global>
<cache>
<types>
<custom translate="...
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 ...
10
votes
5
answers
4k
views
Magento2: Setup Script not loaded
I've been banging my head for a few hours now. I have setup a small Magento 2 module. It is enabled everything is working except the Setup scripts never run. Actually from my diagnosis right now, they ...
10
votes
1
answer
1k
views
Module removed but Tables remaining in database in Magento2
I have created one module/extension using installer script in magento2.
After that I removed it, but tables in database still remain as it is.
can anyone tell me how to uninstall module/extension ...
9
votes
2
answers
21k
views
Magento2 - Missing required argument
I'm trying to create a block I can call in my override of 'root.phtml'.
In the root file, I added some extra classes to the body depending on the url, so I've created a module which I call on this ...