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
4
votes
1answer
8k views

Magento 2: installation stuck at 65% “installing user configuration”

So I recently installed Ubuntu 16.04 on an old laptop. Running PHP 7: PHP 7.0.4-7ubuntu2.1 (cli) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend ...
4
votes
3answers
20k views

How can I add “add to cart button” in custom phtml file?

How can I add "add to cart button" in my custom phtml file in Magento 2 ? Please describe how default Magento 2 add to cart button working.
3
votes
4answers
16k views

Magento 2 - upload SVG files

how can I upload SVG files(icons for example) to my cms Page. If I try to upload them by using "insert image" and upload them to my media storage I always get "Disallowed file type"? Is there any ...
3
votes
1answer
3k views

Magento 2: Can you Filter By store_id Using a Product Repository

In Magento 2, it's not possible to add a store_id filter to a product collection directly. Instead, you need to use the addStoreFilter method, which adds a special "product limitation filter". It ...
2
votes
1answer
5k views

Magento 2 Block/Element order

A pretty basic question mainly because I'm still trying to wrap my head around Magento 2's templating system. But I'm just trying to switch the order of the mini-cart element and the search element ...
2
votes
3answers
2k views

Magento2 how to remove “choose an option” in configurable products drop down

How to remove "choose an option" in configurable products drop down and in the drop-down menu have the first attribute value be the top choice please if anyone idea reply me I need this type of
1
vote
1answer
650 views

Product edit form issue in admin panel magento2

Here is my etc/adminhtml/events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events....
1
vote
2answers
977 views

Magento 2 - How to Redirect Customer for Checkout After Login when cart is not empty

How to redirect customers to the checkout page after login when the cart is not empty for the customer? Loginpost\Redirect\etc\frontend\di.xml <?xml version="1.0"?> <config xmlns:...
0
votes
2answers
12k views

Magento 2 : After login need to redirect on same page instead of customer Dashboard

After login redirect user on previous page from front-end. I am using the login pop-up and all default functionality. Also the Admin configuration Redirect Customer to Account is set as No. But it ...
23
votes
2answers
30k 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
8
votes
2answers
17k views

Magento 2: Override Magento\Catalog\Block\Product\View Block

I have developed one custom module and i have tried to override product view block by following these two links Overriding Block in Magento 2 and DI & Extending a Block on Magento 2 but when i hit ...
8
votes
1answer
4k views

magento 2 event cataloginventory_stock_item_save_after

I need to detect whenever the inventory level of a product changes. As there is cataloginventory_stock_item_save_after in magento 1.x wanto to implemet same in magento 2.1 <event name="...
8
votes
3answers
11k views

Magento 2 - catalog product list widget product order

The homepage of my magento website is showing a product list. This product list was made with the catalog product list widget configured to show the products which are in the homepage category. ...
6
votes
2answers
8k views

How to show default payment method as checked at checkout page in Magento 2

When customer go to checkout page default payment method should be shown checked which is Paypal. What is the possible way to do this. Please help guys
6
votes
3answers
16k views

Magento 2: Get Customer data after login with observer

I need to detect in frontend section for my custom module if customer has just successfully logged in, and i need to run some function before it redirect to another page, is there any way to do this?
5
votes
3answers
4k views

Custom javascript not working

I'm trying to inject a scroll to anchor javascript globally in Magento 2. More specifically this script: $('a[href^="#"]').on('click', function(event) { var target = $(this.getAttribute('href'));...
4
votes
2answers
7k views

Magento 2: Can't switch from developer to production: “Command returned non-zero exit code:”

I've seen two other threads with this issue but I have been unable to resolve it with the solutions provided. I've increased my memory limit to 1G in php.ini and I've set ini_set('memory_limit','2G')...
3
votes
2answers
8k views

Magento 2 : Is there any way to disable Welcome Email after signup

What is the right approach to disable Welcome Email after completes registration process. I'm using magento2.1. We have an integration with a customer management system and which will sent email to ...
3
votes
2answers
1k views

Magento 2 admin page redirecting to homepage

My admin URL redirecting to homepage, I have did lot of efforts to fix admin login link but still it migrating to homepage, my website link https://www.muzikhausberlin.de/index.php my admin link ...
2
votes
3answers
11k views

Disable product magnification / zoom in Magento 2

I've added this to default.xml, which partially works to remove the zoom feature <head> <remove src="Magento_Catalog::js/jquery.zoom.min.js" /> </head> However, a magnifying ...
1
vote
1answer
259 views

Magento2 restrict cc number in the form fields

I would like to restrict CC number (Ex: 4111111111111111) in the customer form fields in the magento2 frontend. Could you please advise me on how to do the step by step in Magento2. Expected Results: ...
1
vote
2answers
5k views

How do you edit checkout field labels in Magento 2?

The site I am working on is only selling to UK customers, and therefore we would like to change the labels from the Zip/Postal to Postcode and from State/Province to County. I have spent a long time ...
1
vote
1answer
577 views

Magento1 to Magento2 data migration

I am new to Magento2, I need some guidance from magento geeks for migrating data from magento1 to magento2. Quick Overview I received a system that was built in magento2 from scratch. So I think ...
1
vote
1answer
4k views

Create product attribute with options in magento2 through rest API

I have created a custom module to create product attribute with option thruogh rest Api. Here is my code samples. etc/webapi.xml <route url="/V1/attribute/attributeCreate" method="POST"> &...
42
votes
1answer
7k views

How to add a new product type in Magento 2? (MageStackDay mystery question 1)

MageStackDay bonus question for 500pts Bounty AND a the possibility of winning a free Z-Ray license for a year. More info can be found >> here << The questions are provided by Magento 2 core ...
36
votes
3answers
14k views

Magento 2: template security: which method to use?

I'm aware Magento 2 has several methods available to secure the template: $block->escapeHtml() $block->escapeQuote() $block->escapeUrl() $block->escapeXssInUrl() But I'm wondering when ...
29
votes
3answers
5k views

Creating Integration Tests for Magento 2 Modules

So far for my Magento 2 testing needs, I've been using PHP Unit as (more or less) an acceptance tester -- testing results of server and HTML requests made into a system with my module(s) installed. I'...
59
votes
8answers
58k views

Magento 2 backend session timeout

In Magento 1.x the backend session timeout was set via: Backend -> System -> Configuration -> Admin -> Security -> Session Lifetime (seconds) Initially, my question was how to set this ...
47
votes
2answers
5k views

Magento Event Observers: Singleton versus Model

So Magento offers 2 ways of declaring an observer. Singleton and Model (new instance) by specifying the <type> tag in Magento 1.x and by specifying the shared attribute in Magento 2. Magento 1 ...
36
votes
3answers
14k views

What is mview in Magento 2?

First of all what I know : Index management is useful for increasing store performance. EAV has one disadvantage.it will store data in different tables. So that retrieving data is time-consuming. So ...
37
votes
4answers
70k views

magento 2 how to call any block function in phtml

How can I call any block function in any phtml? For example if I want to call my custom block function in product list.phtml?
25
votes
5answers
39k views

Magento 2: How to reset Customer Password from Database

It's hash for customer password in DB. So MD5 & Sha1 is not working. UPDATE `customer_entity` SET `password` = MD5('test123') WHERE `email` = 'X@X.com'; So how to update password using database ...
28
votes
4answers
3k views

How to create a Marketplace ready Magento 2 extension

I have created a Magento 2 extension which I wanted to upload on Magento Marketplace. When I tried to upload my extension it got rejected multiple times with one or the other reason. Due to this and ...
35
votes
22answers
81k views

Refused to apply style “because its MIME type ('text/html') is not a supported stylesheet MIME type”

Suddenly CSS is not loading on my Magento 2 admin panel. The frontend is working fine. Error details: 1. "Refused to apply style from 'https://www.ornativa.com/pub/static/version1502029409/...
26
votes
2answers
8k views

What is Context Object purpose in any class's constructor DI ? How Context works?

In most of the class's Constructors, a Context object is passed . I couldn't understand how this Context Obj works . I also noticed that sometimes this is passed to parent class's constructor like ...
24
votes
3answers
5k views

Is there ever a reason to prefer $model->load() over service contracts?

I understand that the preferred way to work in between modules in Magento 2 is using the service contracts. So if I want to load a product, I use the product repository: $product = $...
16
votes
5answers
15k views

Magento 2 events list

Is there any complete list of events in Magento 2? I'm looking for something like Magento Events Cheat Sheet (1.9)
28
votes
1answer
5k views

Magento 2.1: using the entity manager

From 2.1 Magento has introduced Magento/Framework/Model/EntityManager I may be wrong here but from my understanding it is to replace Magento/Framework/Model/AbstractModel which was implementing the ...
14
votes
1answer
20k views

Magento 2 - What case I use di.xml and How to use di.xml for module?

In Magento 2, What case I use di.xml and How to use di.xml for module? Anyone knew, please show me step by step.
37
votes
10answers
33k views

Where is Template Path Hints in Magento 2?

Just started playing about with Magento 2. Can anyone tell me where I can find the "Template Path Hints" option that used to be in System > Configuration > Developer > Debug?
21
votes
3answers
4k views

What is IdentityInterface in Magento2

I see that a lot of the models in Magento 2 implement Magento\Framework\DataObject\IdentityInterface. This interface has a single method called getIdentities The implementations of the method usually ...
12
votes
5answers
36k views

Magento 2: How to update order status programmatically in custom module?

$orderId = 1; $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $order = $objectManager->create('\Magento\Sales\Model\Order')->load($orderId); $order->setState("...
10
votes
3answers
15k views

Overriding Blank Theme Styles in Magento 2

How would you go about overriding the navigation styles for a custom theme when inheriting from the blank theme in Magento 2? I have a theme.css file in my app/design/frontend/<Vendor>/<...
24
votes
4answers
44k views

Programmatically create a simple product in magento 2

I'd like to create simple product programmatically in magento 2. Is there any way to create ?
21
votes
15answers
40k views

Missing write permissions in directory pub/static when run bin/magento setup:upgrade

The day before, I updated a new module and it was working normally. Now, when I run bin/magento setup:upgrade, I receive the below Exception. I tried setting permissions to 777 (or 770) for the pub ...
16
votes
3answers
46k views

Magento2 - setup:di:compile

I have been working in a project with some custom code... this is our first "medium" Magento 2 project, so (as all people here I think) every day we learn new things, and we have to change the way to ...
16
votes
2answers
20k views

Magento 2 : Add Product Attribute Programmatically

How to create Magento 2 Product Attribute Programmatically with type : Text Area.
15
votes
3answers
14k views

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry - Magento 2

I'm trying to setup my crons for Magento 2.2.2, but nothing seems to be updating. I have created cron in cPanel, like below, each once per minute: /usr/local/bin/php /home/userishere/public_html/bin/...
14
votes
2answers
50k views

Move blocks to other container how to

Being newby I look for a workaround to move Sign in and Store switcher from header.panel to header.container. I just tried this code but won't work <referenceContainer name="header.container"> ...
12
votes
5answers
57k views

Magento 2 PHP extensions missing

I am trying to setup a new vagrant box for Magento 2 development, however when running composer install, I receive the following errors: Problem 1 - The requested PHP extension ext-gd * is ...

1
5 6
7
8 9
96