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
12
votes
2answers
38k views

Magento 2: How to send data using Ajax form in custom form?

Can anyone explain me how I can create a simple form on Magento-2 page to send data using Ajax? I already have a form and controller action, that send data without using ajax.
9
votes
4answers
8k views

Disabling a UI component field upon condition in Magento 2

I have a UI component defining some fields. How do I disable the field upon a certain condition? In other words, use <item name="disabled" xsi:type="boolean">true</item> only when a ...
31
votes
10answers
59k views

How to delete and regenerate URL rewrites in Magento 2?

I have recently created 2 additional store view on magento 2 store. Now the url of category and Products are not for those stores is not proper Eg: http://example.com/catalog/category/view/s/pouches/...
27
votes
5answers
26k views

Instantiating Helpers in Magento 2

The latest builds of Magento 2 have done away with the Mage class. This mean we've lost the Mage::helper method. Is there a replacement technique (helper factory?) for instantiating helpers in ...
15
votes
8answers
56k views

Magento 2 Get customer ID from session in a block class

How to get customer ID from session? I tried this but not work. protected $_customerBonusPointFactory; protected $_customerSession; public function __construct(Session $customerSession, \Magento\...
11
votes
3answers
14k views

JS errors Magento 2

I've been trying to finish something and publish it online this entire weekend, it's some how broken and I have no idea why so I hope someone can help me out. I've tried adding custom jQuery into my ...
11
votes
6answers
40k views

Getting simple products from configurable

I am trying the following code to get the IDs of all the simple products which are children of $collection, which I know to be a collection of configurable products. foreach($collection as $_product) ...
5
votes
1answer
6k views

how to override template files for magento2 extension

In magento2 to override template files here, but for magento2 extension we have to follow here. So how to override template files in magento2 extension with out considering theme inheritance. I want ...
25
votes
5answers
38k views

How to use messageManager to show an error after redirect

I have a Module which processes a Post action, and then redirects. Now there are error cases, and I would like to show messages for them to the users. I already know, that this code adds the message ...
19
votes
2answers
5k views

Magento 2: Different static-content Files Per Locale?

In Magento 2, a static content URL looks like this http://magento-2-with-keys.dev/static/adminhtml/Magento/science/en_US/Pulsestorm_FrontendTutorial1/hello.js This includes a en_US locale portion. ...
13
votes
4answers
28k views

Magento 2: get product collection using category id

How to get all products of category using category id in magento 2?
12
votes
5answers
10k views

How to show the drop down attribute value using getData() method in magento 2?

When I try to get data from the material attribute like $_product->getData('material'), it shows the integer value. How can I convert it to the actual front-end value and in which file do I have to ...
10
votes
3answers
26k views

How to create Admin Grid in Magento2?

I am trying to create module in magento2, now i stuck creating grid page in admin side, let me know if any one already did
9
votes
2answers
5k views

Magento 2: Split order for every Item

I need to split my orders for every item (because I need an order status and delivery note for every single item in my cart). I tried to do this according to following resources: Magento2 Split ...
8
votes
3answers
12k views

Magento2- Send custom transactional emails

As done in Magento 1.x.x, how can custom transactional emails be sent. Additional Add email in bcc Send attachment along email
6
votes
2answers
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>...
5
votes
3answers
10k views

Develop a mobile app with Magento 2 REST API.?

I couldn't find some needed API functions in Magento 2 REST API Document . I am very doubted. Is it possible to develop a mobile application with current Magento REST API.? I couldn't find methods to ...
2
votes
7answers
14k views

Magento 2: How to remove decimal points from the price

I need to remove the two decimals from product prices on the frontend. For example, if the price is $49.00 it should be displayed as $49. Since my products have no floating points it is ok to remove ...
22
votes
4answers
43k views

Get Current URL from a PHTML - Magento 2

I'm struggling trying to show the current URL from a PHTML in Magento 2. Any suggestion?
7
votes
1answer
5k views

Magento 2 add new custom option text field

I would like to add new custom option text field like 'New Text Field Title' in the magento 2.x 'Customizable Options' section could you please suggest me and guide me how to add please refer my ...
7
votes
4answers
10k views

How to include 3rd party library in Magento 2 (like php xlsx library)

How to include third party library like php xlsx library in Magento 2? Since last 7 days I am browsing in google and I could not found any information. Magento 2 give default framework module like ...
6
votes
3answers
8k views

Get Token Authentication For Customer Logged With Facebook & Twitter : Magento 2

Dears, I created a custom REST API, So customer can login Via facebook and twitter through mobile app. The API consists of one service which take some parameters and email parameter and check if this ...
5
votes
1answer
11k views

Magento 2 - Emails -> if statement

I'm currently configuring my transactional emails for Magento 2 and since I am in germany and want to ship some parts to a partner inside the EU i can place those orders without calculating taxes for ...
3
votes
2answers
11k views

Magento 2 - Adding calendar to custom frontend form

I'm trying to add the calendar in magento2 to custom front-end form. jquery-ui.js and jquery-ui-timepicker-addon.js are also added in header & this is the code that I think should work to call the ...
18
votes
2answers
16k views

Remove a UI component child via Layout XML

How do I remove a UI component child via Layout XML? For example, from the below xml directive in checkout_index_index.xml. How do I remove the shipping node ? <item name="sidebar" xsi:type="array"...
12
votes
3answers
19k views

Magento 2: Apply visibility and status filters on product collection

I want to apply visibility and status filter on product collection. Like in Magento 1 we do: Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection); Mage::...
12
votes
1answer
1k views

Reasons to setup cronjob for setup:cron:run and update/cron.php on a deployed production system?

In Magento 2 there are three commands that should be set up as cronjob * * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> &...
9
votes
5answers
8k views

Magento2: how override translates in language pack?

I installed language pack in app/i18n/magento2translations/language_nl_nl/ with file nl_NL.csv It's works perfect. Also, I added in custom theme file app/design/frontend/COMPANY/PROJECT/i18n/nl_NL.csv ...
7
votes
3answers
3k views

How to remove Guam, Palau, and other US Territories from address State dropdown - Magento 2 [duplicate]

How can I remove Guam, Puerto Rico, Palau, and all other US Territories from the "State" (or "Region") dropdown list on both the cart page and checkout pages? I only want to ship to the 48 contiguous ...
7
votes
2answers
7k 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 ...
7
votes
3answers
6k views

Magento 2 add script before closing body tag

What is the proper way to add a script before the closing body tag in magento 2? I want it to be available to all pages. UPDATE: I've got in myvendor/mytheme/Magento_Theme/layout/default.xml with: ...
7
votes
3answers
8k views

How to extend backend template files in Magento 2

I could not find how to extend backend template files in Magento 2, however i have found how to extend frontend template files from here. If I extend the file at design/adminhtml/Magento/backend it ...
6
votes
2answers
27k views

Add custom js in head in magento2?

I have custom module. I want add file my.js in folder app\code\Xanka\Slider\view\frontend\web\js\slider\my.js. I used code in app\code\Xanka\Slider\view\frontend\layout\default.xml <head> &...
6
votes
3answers
3k views

How to override a Zend class?

I want to override a Zend class (Zend_Date). In Magento 1, I used to put Date.php in app/code/community/Zend and Magento itself used to do the rest. But now, there is no such directory. How can I ...
5
votes
1answer
13k views

Magento 2: How to include JS on the product page?

I'm trying to get a custom js on the product page, I'm using Magento 2, what's the page I need to edit to do that? I've already tried to create a local.xml into /app/design/frontend/Venustheme/yume/...
5
votes
1answer
6k 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/...
5
votes
2answers
16k views

What is the easy way to edit the maintenance / error 503 page?

I'd like to modify the generic blank page with a custom template Service Temporarily Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity ...
4
votes
3answers
9k views

Magento 2: How to show/hide payment method on basis of amount

I'm using Magento 2 CE Version 2.1.0. I have 2 payment method Paypal Express Checkout & Bank Transfer. When the amount is greater than X then Paypal should not be displayed only Bank Transfer. ...
4
votes
3answers
6k views

Magento 2 : Rating Filter in Layered Navigation

In Magento 2 How to add Star Rating Filter in to Layered Navigation?
3
votes
1answer
2k views

Magento2 adding dynamic route name

In magento1 we used to have an event controller_front_init_routers which could be used to add any route name dynamically based on some logic. I would like to add a route name which is saved in the ...
3
votes
2answers
3k views

How to add multi-select category tree at admin end in magento 2?

I would like to display *Category Tree Names** in multi select field in magento 2 admin end? I have tried with below code but displaying only first cateogires could you please any one help on this? ...
2
votes
3answers
7k views

Running magento2 commands in Windows XAMPP

I am using XAMP for magento2. I am not able to run commands and getting error: php is not recognized as an internal or external command, operable program or batch file I try these commands: C:\...
2
votes
1answer
9k views

How to add custom payment gateway extension in magento2

Redirect to Payment Gateway and process payment Return Back to store success page Any help will be appreciated. I have followed the Inchoo implementing a payment gateway tutorial But no luck.
2
votes
1answer
5k views

Magento 2: How to override adminhtml CSS?

I would like to implement a CSS file that contains only the styles that I'd like to override for the default admin theme. For example, let's say I want to change the textarea font to Consolas and my ...
1
vote
3answers
7k views

Magento 2: How to Override Abstract Class for Product Category Indexing Issue?

I have 2000 products which is assigned to multiple categories. When i run php bin/magento indexer:reindex catalog_category_product In catalog_category_product_index total record count is 1700. So ...
10
votes
2answers
10k views

How to enable custom admin theme in Magento 2

I have followed the instructions here: How to create admin theme for Magento2 and here: How to change backend admin theme in Magento 2.0.7 + and I still dont understand what I'm supposed to do to ...
8
votes
4answers
22k views

How to get the Description of a Magento\Catalog\Model\Product?

I'm in Magento2 and the getDescription(); does not work. I'm in the file Magento_Catalog/templates/product/list.phtml if that's relevant.
7
votes
3answers
11k 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\...
7
votes
1answer
5k views

Magento2 :: Accessing $_FILES using Magento Framework [duplicate]

I am current working on a file upload functionality in Magento. Everthing is working great. I am using the \Magento\Framework\File\Uploader and files are getting properly uploaded. The issue I would ...
6
votes
2answers
9k views

Magento2 : user define customer attribute not save value while create / save from admin

I have created two customer attribute one "abc" and second is "xyz" this two attribute display properly in customer admin. also attributes are created in database table "eav_attribute". But while save ...

1
4 5
6
7 8
96