Skip to main content
65 votes
Accepted

Magento 2 How to Add a New Column to Orders Grid

After lots of digging into Magento's core code, I found a solution to my question. Instead of adding a column to the grid via the database, I created a UI component sales_order_grid.xml under [...
André Ferraz's user avatar
58 votes

Magento 2 - How to add a custom field to checkout and then send it

I will try to answer your question(s). No. This is not a correct way to add custom attributes to the shipping address form. You do not need to edit new-customer-address.js. Indeed, this JS file lists ...
aakimov's user avatar
  • 631
53 votes

How to Create Custom Form in Magento2 Frontend?

Assuming you have the following module Company/Module. Create the frontend router /app/code/Company/Module/etc/frontend/routes.xml Create a route to manage : GET request wich going to display ...
Antoine Subit's user avatar
51 votes
Accepted

Magento2 Error: "Something went wrong with processing the default view and we have restored the filter to its original state" showing on the loop

Old post but for future viewers - a temporary fix is to clear (empty, not delete) the ui_bookmark table of your Magento 2 database, this will reset the grid back to its default and stop the infinite ...
Rhyan-WoodsAndWalker's user avatar
49 votes

Magento 2 Issue with "Not Registered Handle" on all the sales sections?

The problem here is that someone defined a handle in the etc/adminhtml/di.xml search for something like this <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory"&...
CompactCode's user avatar
  • 2,477
46 votes
Accepted

Why is Magento 2.1.0 released before 2.0.9?

Magento2 is following semantic versioning. This means that the versions consist of major.minor.patch numbers. Whenever there are bugs or security issues solved, Magento will release a new "patch" ...
7ochem's user avatar
  • 7,562
46 votes
Accepted

Magento 2: Implement UI Fileuploader

I follow this steps to add UI fileuploader component in admin form I use UI fileuploader component to upload an icon for my FAQ extension. You can take reference from here: https://github.com/...
Prince Patel's user avatar
  • 22.8k
43 votes
Accepted

Magento 2 did not sign in correctly or your account is temporarily disabled

After some search on the internet, I found that due to security reasons Magento has introduced account disabled functionality with considering the security of the business. Here is how you can unlock ...
Yogesh Trivedi's user avatar
43 votes

Magento 2 How to Add a New Column to Orders Grid

My solution may be a bit more efficient since it follows the native way of adding a column to the grid, and you won't have to load every order displayed on the page to obtain the column data (...
MageParts's user avatar
  • 531
42 votes
Accepted

Magento2: Get Media URL In Template File (Without direct Calling Object Manager )

You can get media url in your template file using below way but without using objectmanager you must have to define Block file with __construct() method with define storeManagerInterface in construct ...
Rakesh Jesadiya's user avatar
40 votes
Accepted

Magento2 - Get category URL by ID

In order to get the category url you need to use the \Magento\Catalog\Model\Category function getUrl() like so: $category->getUrl() Also, you can get url by CategoryRepositoryInterface ...
Amit Bera's user avatar
  • 77.6k
38 votes
Accepted

Magento2 : Best way to load Customer by customer Id

It's always a better practice to use service contracts. In your case I would use \Magento\Customer\Api\CustomerRepositoryInterface : protected $_customerRepositoryInterface; public function ...
Raphael at Digital Pianism's user avatar
37 votes
Accepted

Static Content is not loading after upgrade

The main issue was caused by the incorrect rewrites work ( as @Marius told ). There was no RewriteBase in my directory pub/static/ and Apache could not find the files because searched for them from ...
Siarhey Uchukhlebau's user avatar
37 votes
Accepted

Magento2 creating and calling modal widget

You should create a module first, then after create a requirejs-config.js file at app/code/Vendor/YourModule/view/frontend/requirejs-config.js var config = { paths: { 'myjs': ...
P S's user avatar
  • 1,983
36 votes
Accepted

Magento 2: what are the Interceptors file in var/generation?

Interceptor classes are an implementation of the interceptor design pattern. The interceptors are how how Magento 2's object system implements a plugin system. As a client developer, the theory is ...
Alana Storm's user avatar
  • 44.4k
35 votes
Accepted

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

Magento 2 uses Service Contracts for retrieving and saving objects. In Magento this layer is formed by Repositories, which are managers with get() and save() methods. This keeps user code away from ...
Jacques's user avatar
  • 1,022
33 votes

Magento 2 - Why do SKU not change dynamically in configurable product view page

I wrote the module based on Fabian Schmengler's solution. This works for me on Magento 2.1.3. /app/code/YourVendor/YourModule/view/frontend/requirejs-config.js var config = { config: { ...
nbjohan's user avatar
  • 521
32 votes
Accepted

Ajax add to cart button in product detail page magento 2

You have to just override addtocart.phtml file app/design/frontend/Packagename/themename/Magento_Catalog/templates/product/view/addtocart.phtml Replace "bindSubmit": false to "bindSubmit": true &...
Rakesh Jesadiya's user avatar
31 votes
Accepted

Magento 2.1 Admin login issue - Someone logged into this account from another device session is terminated

Solution: Because of security purpose Magento by default disable the admin login share session and therefor while in development mode you need to enable this from: Admin >> "Stores > ...
Yogesh Trivedi's user avatar
30 votes
Accepted

Magento2.1 ui grid, remove or clear filter issue (after removing filter, result row apply to whole collection)

Just to add to the previous solution by Tony Bartiloro. The specific fix is to add the 'storageConfig' item. If this is missing you will see the issue where row data is duplicated. <item name="...
Chris's user avatar
  • 1,004
30 votes
Accepted

How to specify skin image path in Knockout HTML template?

You need to call the function into js from the template. require.toUrl('images/icon-paypal.png');
Sunil Patel's user avatar
  • 2,117
30 votes
Accepted

Magento 2 : what is use of _replica table in Magento_Catalog module?

Replica tables are mainly used for indexer optimization. Replica tables are used to prevent deadlocks or wait locks caused by read/write collisions on the same table. In the above causes, Magento ...
Gideon Babu's user avatar
29 votes
Accepted

How to call static block in knockout template file?

You can create a module that will make your cms block message available to the KO template by adding to the checkout config. In Your/Module/etc/frontend/di.xml we add a new config provider to the ...
Aaron Allen's user avatar
  • 9,009
28 votes
Accepted

Magento 2.1 How do I create form component field custom depends on another field value?

Try this (Note: Don't forget to replace the line "Namespace" and the line "ModuleName" with your values): <field name="field1"> <argument name="data" xsi:type="array"> <...
Siarhey Uchukhlebau's user avatar
28 votes
Accepted

NotNull not working with AddFieldToFilter in Magento 2

You can try this ->addFieldToFilter( 'ep_image', ['neq' => 'NULL'] )
Priyank's user avatar
  • 7,702
26 votes
Accepted

Add header and footer in checkout page Magento2

I got a solution. First go to Magento_Checkout in your theme folder app/design/frontend/package_name/theme_name/Magento_Checkout Now create below folder structure in layout folder on the above path. ...
Dhaval's user avatar
  • 1,695
26 votes

How to prevent customer/section/load ajax call when ever i'm making my custom ajax call in M2?

I had same problem and solution is very simple. Set the global event false in your jQuery request. Magento will not be able to intercept your request in that case. example: $.ajax({ url: webUrl,...
Surendra Mishra's user avatar
26 votes

Call to a member function setActive() on boolean

I will try this to solve problem if setActive() error() arrived after setup:di:compile then becauese of session is destroy. So go to Magento directory and then delete file generated by di:compile is ...
Nirali's user avatar
  • 261
25 votes
Accepted

Get product collection by category id on phtml file magento2

You can add this in the Block, and call the function getProductCollection() in phtml, protected $_productCollectionFactory; protected $_categoryFactory; public function __construct( \Magento\...
Rushvi's user avatar
  • 2,843
25 votes
Accepted

Magento 2 Check If Customer is Subscribed to Newsletter

First inject the \Magento\Newsletter\Model\Subscriber class in your constructor: protected $_subscriber; public function __construct( ... \Magento\Newsletter\Model\Subscriber $subscriber ...
Raphael at Digital Pianism's user avatar

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