Questions tagged [magento2]

General questions about Magento 2, not specific to a minor version. Use this tag to distinguish from Magento 1. If you have issues with a specific version, please use the appropriate 'Magento-2.x' tag instead. Functionalities between Magento 2 minor versions might differ.

Filter by
Sorted by
Tagged with
0
votes
0answers
712 views

Magento 2 : How to send form data to admin email?

How to send the form data through email to admin I have created a form in the template and on submit click it should send data to the admin.
55
votes
3answers
14k views

Magento 2 as a headless solution

I want to know if there are some best practices to use Magento 2 as a headless E-commerce solution. A typical E-commerce in 2017 is to have an omni-channel solution which includes E-commerce CMS ...
40
votes
14answers
53k views

Magento 2: How to truncate customers, products, reviews and orders table

Does anyone have list of tables I need to truncate to delete all test customers, products, reviews and orders in Magento 2 ? I'm looking for something similar to Clearing Magento after testing .
48
votes
14answers
122k views

How do I set Developer Mode in Magento 2

I'm trying to install Magento 2 but I am getting the following error: Error happened during application run. Could not write error message to log. Please use developer mode to see the message. I ...
71
votes
8answers
58k views

Magento 2 How to unlock reindex process

I'm making some tests in Magento reindex process and I locked the stock index process. How can I unlock this process? Design Config Grid index has been rebuilt successfully in 00:00:02 Customer ...
48
votes
10answers
77k views

How to reset lost admin password in Magento 2?

I tried to reset the admin password via Phpmyadmin in admin_user table but this doesn't seems to work. Also on chrome I am getting "This webpage has a redirect loop" error when loading admin page.
37
votes
7answers
52k views

Magento 2: How can I deploy my theme only

I was using this for deploy the content but it is taking too much time. php bin/magento setup:static-content:deploy then I figure out adding the language make fast but it still deploy all the ...
34
votes
7answers
37k views

Magento2 - programmatically add product attribute options

What is the right(official) way to programmatically add product attribute option in M2? E.g. for manufacturer product attribute. Obviously existing option would be matched by "Admin" title value.
33
votes
4answers
15k views

Magento 2 xml validation

For a while Magento 2 had a way to validate (and autocomplete) any xml by using an XSD file. For examplemodule.xml looked like this: <?xml version="1.0"> <config xmlns:xsi="http://www.w3.org/...
15
votes
5answers
37k views

Magento2: Best practice to modify css files

I want to modify css file pub/static/frontend/Magento/luma/en_US/css/styles-l.css. Initially this file is not present in pub/static folder and it's present in vendor/magento/theme-frontend-blank/web/...
13
votes
5answers
29k views

How to enable AJAX for the the 'Add to Cart' button of product widgets in Magento 2?

In Magento 2 the normal Add to Cart button has a very nice AJAX-based logic to add products to the cart. However, when we use a Catalog Products List widget for example in CMS pages the button in this ...
16
votes
7answers
47k views

How to call Direct SQL Queries and join to collection In Magento2

I just want to call direct sql query in Magento2 as like in magento1.x
33
votes
1answer
7k views

Magento 2 - Theme Type 0:physical, 1:virtual, 2:staging. When to use?

In the theme table there is a type field with 3 possible values: physical, virtual and staging. When to use physical virtual and staging theme? When I extended luma theme my new theme appear in ...
16
votes
6answers
19k views

How to Add a Custom Button to Admin Sales Order View in Magento2

How to add a custom button to sales order view in magento2, since some of the events was remove in-favor of plugins. Removed some events (plugins must be used instead): ...
13
votes
3answers
13k 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 ...
13
votes
5answers
31k views

Magento 2: How to override mini-cart default template html file?

How to override /var/www/html/magento2/vendor/magento/module-checkout/view/frontend/web/template/minicart/content.html file in our custom theme?
12
votes
2answers
40k views

Creating a custom homepage template in Magento2

As all you know that magento2 have some layout template like 1column , 2 columns-left , 2 columns-right , 3 columns and I want to create custom homepage layout template in Magento2 for that I follow ...
12
votes
3answers
7k views

Magento 2.3 it's not working properly in localhost [duplicate]

I have installed new Magento 2.3 in my localhost. it is a successfully installed. But When I open an admin URL it comes with blank URL. Also, my homepage comes without Magento default logo. Also, I ...
8
votes
2answers
17k views

Magento 2 - Keep Product Image Aspect Ratio

I'm working with Magento 2 Category Page. But I couldn't know how to keep the product image aspect ratios. In magento 1.x, I can get the image src to use below code. <?php echo $this->...
27
votes
28answers
79k views

Magento 2 Error ERR_TOO_MANY_REDIRECTS

I'm new to Magento, after installation of Magento 2 community edition.I am not able to access the admin panel. I am getting below error. This web page has a redirect loop Error ...
16
votes
9answers
27k views

Invalid template file magento2.3.0

I have recently installed magento latest version i.e. Magento 2.3.0 in local wamp machine with php 7.2.4 Installed it using command line interface. But when i tired to run it show me error like ...
12
votes
5answers
18k views

How to join order grid collection to custom table in Magento2?

I am trying to add a new column to order grid in Magento 2.0. So, i need to do joining to order grid collection. How can I achieve this ? Because, in magento2, the grid uses UI component.
11
votes
4answers
4k views

Difference between InstallSchema and InstallData

I want to know the difference between InstallSchema and InstallData in details. I also need to know when can I use InstallSchema.php and InstallData.php?
10
votes
4answers
18k views

Magento2: Community edition Vs Enterprise edition

I see Magento 2.0 Community edition and 2.0 Enterprise edition is launched. What's the difference between them on functionality level ?
36
votes
7answers
74k views

How to load product by SKU in magento 2

It's pretty basic, but I can’t find a working example on Stackexchange or google. I want to load a product from a helper or block. I already tried some things like: $objectManager = \Magento\...
21
votes
1answer
6k views

Block with Cachable=false not rendered on product view page

I am using magento2-1.0.0-beta4 I have copied the checkout.root block from app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml to the product page. Everything is working fine, ...
12
votes
24answers
46k views

Magento2 admin menu panel doesn't work

magento2 dashboard: All admin menu link don't work and have a strange icons. Why? I can't do anything.
45
votes
4answers
68k views

Magento2 how to getRequest

In Magento 2 how to receive request array? $_POST and $_GET too as we did in Magento 1: Mage::app()->getRequest()->getPost()
21
votes
2answers
6k views

Magento 2: what is the $data array constructor parameter?

So I noticed that in most models and blocks, there's this array $data = [] given as the last parameter of the constructor. For example \Magento\Catalog\Block\Product\ListProduct public function ...
15
votes
3answers
14k views

Get Base Url Or Dynamic Url In view Js or html files

I figure it out to get dynamic url in the front end if I need I can simply define mage/url and the use it as url.build('<Modulename>/<controllername>/<action>/') When I tried the ...
10
votes
8answers
19k views

Magento2: redirection from Observer

We have already know that How to redirect from an Observer for magento 1.x version. but for magento 2,we does not know How to forcefully do redirection from an observer. I have done google ,but does ...
9
votes
2answers
9k views

Magento 2 how to save custom field added in the form of customer group?

I've added some custom fields to the form of customer group by using upgradeSchema.php. After that I found that the original fields like customer group code and tax id are saved by using setter ...
3
votes
1answer
2k views

How can I use $_FILES in a Magento 2 way?

I used $_FILES when uploading files, but magento-connect do not allow to use global variables, and it generates an error in the validation report: Direct use of $_FILES Superglobal detected How ...
2
votes
3answers
12k views

How to add custom checkout fields and save them in db?

I need to add some fields to the shipping address form from checkout page, and then save them in database. Please tell me how to do this thing?
19
votes
6answers
17k views

add to cart not working localhost Only in chrome (Magento 2 fresh install )

I've installed magento 2 fresh on localhost, and trying to add items to cart but didn't work.. when click on add to cart button, button will change into adding and stays there, didn't add to cart ...
11
votes
3answers
14k views

Magento 2 : Override core Interface and Model

I am trying to override core interface of Customer Group. I add my custom get and set methods to core Api interface. Vendor\magento\customer-module\Api\Data\GroupInterface.php Where its working ...
10
votes
4answers
13k views

Magento 2: How to override Luma Theme Home Page

I'm using Magento 2 CE Version 2.1.0 on WAMP Windows 10 I already referred Magento 2: How to override mini-cart default template html file? Would like to override Magento 2 Default Luma Theme I ...
7
votes
2answers
5k views

Magento 2 api - How to get layer navigation filters available in rest api?

I have someone issue in api magento 2. I need get layer navigation data available in product collection ( current category , search product ) but I don't know magento 2 api available it or not . I ...
5
votes
1answer
7k views

How to make auto select first child product of configurable product in magento2?

I am trying to make auto select first child product from the configurable product in product detail page. Is this possible?
24
votes
5answers
15k 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): '...
16
votes
1answer
9k views

Magento2: How can I override core js module price-box.js

I need to extend Magento_Catalog/js/price-box.js. I have used the 'mixins' feature, but it's not working for price-box.js. requirejs-config.js: var config = { config: { mixins: { ...
13
votes
2answers
26k views

How to add external js in Magento 2

I want to add the following link in the head tag, but its returning 404 error. Can anyone help me on this? <script type="text/javascript" src="https://www.google.com/recaptcha/api.js"></...
12
votes
2answers
22k views

Get product from save event observer - Magento 2

Following a product save event I am trying to access the product within magento 2. I have configured the listener on: controller_action_catalog_product_save_entity_after the xml looks as follows: &...
12
votes
8answers
20k views

Magento 2.2.1 Unable to serialize value

I have upgraded website from 2.1.6 to 2.2.1 and facing Unable to serialize value error in frontend and backend. {"0":"Unable to serialize value.","1":"#0 \/var\/www\/vhosts\/demo.com\/eiselec\/vendor\...
9
votes
4answers
7k views

Customer password not working after migration from Magento 1 to Magento 2

I have migrated only customers from Magento 1.6.2.0 to Magento 2.2.3 and customers migrated successfully and listed properly in the admin section. But when I try to login with the Magento 1 password ...
8
votes
1answer
9k views

Magento 2 Tables Being Created Ending in “_cl”

After doing a diff on the tables from a production server to a local server I have noticed that new tables have been created all ending with _cl. These are: # TABLE: ...
8
votes
2answers
9k views

magento2 search_tmp join leads to empty results in category listing

I just imported products into fresh magento2 instance and encountered issue that category product listing block are empty, although the products successfully appear in database . I have debugged list....
7
votes
4answers
8k views

Need to Initialization js after ajax response magento 2

I am working on ajaxscroll product but when i got response below script not initialize <script type="text/x-magento-init"> { "[data-role=tocart-form], .form.map.checkout": {...
7
votes
1answer
14k views

Magento 2 add custom validation rule

I'm going crazy here trying to add a custom validation rule to Magento 2. It's impossible to find any useful information about it. The things I have are as follow: 1) requirejs-config.js file with ...
7
votes
2answers
9k views

How to add Qty in add to cart form on Product Listings Page in Magento 2

How can you add a Qty filed to the the add to cart form on the category listings page. With the Luma theme the user only has the option to add one product to cart at a time from the product listings ...

1 2 3
4
5
96