Questions tagged [magento-2.1]

Denotes questions related to Magento CE and EE 2.1.x

Filter by
Sorted by
Tagged with
14 votes
4 answers
30k views

How to override blocks in v2.1

I'm trying to override the Topmenu block in Magento 2.1 but can't find any guide to do so. Everything I've found on here and elsewhere either seems to apply only to version 2.0 which appears to use a ...
Michael's user avatar
  • 337
14 votes
1 answer
4k views

Get Magento 2 mode programatically

What's the best way to get the current mode Magento 2 is running with code? In my case it's for a headless Magento, but I can see a number of cases where this might be required.
mbalparda's user avatar
  • 7,363
14 votes
3 answers
8k views

Magento 2 Show timepicker using UiComponent not Datepicker [duplicate]

I want to show timepicker in my UiComponent form As Magento Docs show the variations they provide timepicker : I want this using UiComponent in my form. Note : Need to show schedule time so no ...
Ronak Chauhan's user avatar
14 votes
3 answers
16k views

How can we load product image gallery instantly without the delay in magento?

this is my first question bare with me :) Problem: The fotorama gallery used in Magento 2 makes the user experience sluggish. It does not matter how fast my cached static Magento 2 runs if the product ...
Fancyman's user avatar
  • 509
14 votes
1 answer
6k views

Magento 2 : Show product ratings for each star, average ratings and % of 5 star ratings on product page

I want to display ratings on the product page like this: How many users selected 5/4/3/2/1 star ratings The average rating, displayed as stars Percentage of users selected a 5 star rating I need ...
Ronak Chauhan's user avatar
14 votes
1 answer
3k views

Magento 2 Add Category Tree Renderer Input With Modal Button

I am trying to place the category input for my custom form using uicomponent form. I am able to create dropdown but how I can create the button and open a new modal from it? Can I create a button ...
Priyank's user avatar
  • 7,682
14 votes
2 answers
3k views

How to make product grid in frontend in custom module magento 2?

I have created brand page to display details with associated product list. I want to show that product list in grid same as admin. Can it be possible to show grid in frontend same like backend ?
Dharmendra Jadav's user avatar
13 votes
1 answer
4k views

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

As Magento releases 2.X version, I found _replica tables, particularly in the Magento_Catalog module may be for indexing the catalog data. I also notice that _replica is nothing but the duplicate ...
sandip's user avatar
  • 4,004
13 votes
2 answers
22k views

NotNull not working with AddFieldToFilter in Magento 2

I have following code to filter out rows on a column that is null and it is working ->addFieldToFilter( 'ep_image', ['null' => true] ) and I have another code to ...
Nausif's user avatar
  • 1,544
13 votes
3 answers
9k views

Magento 2.1 image not uploading in edit form

I am working on magento 2.1 form. Image is uploaded successfully when i add new field. however when i edit any field from grid then file uploader will not shown on page. When i inspect edit page it ...
Ashar Riaz's user avatar
  • 1,035
13 votes
4 answers
5k views

Magento 2 compile command fail, but no errors

The compile command suddenly stops, but there is no error. [~/public_html]# php bin/magento setup:di:compile -vvv Compilation was started. Repositories code generation... 1/7 [====>----------------...
Rick's user avatar
  • 452
13 votes
1 answer
16k views

Magento2 - Change standard address format on Magento Frontend

I want to change Magento's standard address format to the one we use in the Netherlands. For those who don't know the address format, it is the method in which we write the address. For example, the ...
Frank Groot's user avatar
13 votes
2 answers
8k views

How to call static block in knockout template file?

I am Using Magento 2.1. Want to show some custom shipping message for shipping method on checkout page, I have done it by editing directly to the knockout template file. Magento_Checkout/web/...
Arun Karnawat's user avatar
13 votes
2 answers
6k views

Magento 2: Varnish + Redis for Full Page Cache at the same time?

My question is to Magento Pros: Can I use Varnish and Redis for FPC (Full Page Cache) at the same time? My current setup looks like this: SSL termination > Varnish Full Page Cache > Apache &...
Mark's user avatar
  • 993
13 votes
1 answer
3k views

Multiple Cart or Split Quote in Magento2

I want to show two cart for normal products and vendor products. I don't think it possible to create multiple cart either by splitting quote or creating multiple quote. Because Magento 2 separate ...
Krishnan Daiva's user avatar
13 votes
3 answers
845 views

Improve performance on SOAP calls

I have a performance problem with Magento 2.1 In my shop, I have 90.000 products. I added these products to soap. When I did this it took round about 7 seconds for each article (product?) (Request>...
tadeus's user avatar
  • 351
13 votes
1 answer
849 views

Fedex Shipping Weight and Value is not setting while creating order programmatically

I'm trying to create orders programmatically using the FedEx shipping method. other methods are working fine. when I'm setting the FedEx getting the error like please specify the shipping method. ...
Ramki's user avatar
  • 401
13 votes
2 answers
3k views

Magento 2.1.1 - Improve security with Content Security Policy

I have a store running fine with the latest version of Magento (currently 2.1.1), and I'm trying to improve security through Content Security Policy on Apache 2.4.7 (Ubuntu 14.04). I removed all <...
Luiz Junior's user avatar
12 votes
7 answers
15k views

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

When you change an attribute in a configurable product the product image changes dynamically but the SKU doesn't change. Also, if you add a configured product to your basket it gives you the image of ...
QuestionsQuestions's user avatar
12 votes
9 answers
16k views

Magento 2 Get selected simple product id in configurable product

We have a configurable product on the front-end with two drop-downs (size and color) How can I get the final simple product id once the user has made their selections We have done this in Magento 1 ...
Vish Vaghela's user avatar
12 votes
2 answers
10k views

How to create a Magento 2 Modal popup that cannot be closed?

I'm trying to create a modal popup that cannot be closed. It has a button that takes you to the next page by clicking on it, but I don't want users to be able to close it. The modal popup can be ...
7ochem's user avatar
  • 7,532
12 votes
5 answers
11k views

Magento 2 Store switcher error in "section-config.js" Uncaught TypeError: Cannot read property '*' of undefined(…)

I'm implementing a custom store switcher in my custom theme. Block template is as follow: <?php if (count($block->getStores())>1): ?> <?php $id = $block->getIdModifier() ? '-' ....
davideghz's user avatar
  • 683
12 votes
2 answers
33k views

Magento 2: How to get current language of store?

I'm trying to show a custom block for each store view / language. Therefore I want to create switch statement like: $lang = // Get language code or store view code here; switch ($lang) { case '...
Rick's user avatar
  • 452
12 votes
5 answers
9k views

Magento 2 Difference between Order Invoice, Cancel, Void, Hold and Ship

Can anyone explain with some examples that how Magento process any order for different steps in Invoice, Cancel, Void, Hold and Ship.
Amit Singh's user avatar
  • 1,765
12 votes
1 answer
25k views

Using the default Magento 2 template block class in a Module

I'm tying to add a simple block to the header using the default template class with the following code <block class="Magento\Framework\View\Element\Template" name="test.trigger" template="trigger....
Chris Morris's user avatar
  • 1,517
12 votes
2 answers
2k views

Why some classes define injections in both their constructor and di.xml?

I don't understand why, in some classes, their dependency injections are declared twice - once in the di.xml and in the concrete class's constructor. For instance in Magento\Backend\Model\Url, its di....
xenon's user avatar
  • 895
12 votes
5 answers
9k views

Hide messages after certain interval

How to hide notification messages like success message after adding product to cart or any error messages or notices after few seconds after they appear on the the frontend using knockout js. Example ...
Anshu Mishra's user avatar
  • 8,960
12 votes
2 answers
15k views

Magento 2: Filter Product Collection by Multiple Categories (Magento 2.1)

I'm using Magento 2.1.0 and I'm currently having difficulties in filtering product collection with multiple categories. I've used more than a couple of ways to make it work but it won't. Assuming: $...
Morgy's user avatar
  • 265
12 votes
1 answer
4k views

How to dynamically enable/disable <preference> in di.xml?

I currently have the following <preference/> in one of my di.xml file: <preference for="Magento\Contact\Controller\Index\Post" type="RadTest\TestModule\Controller\Contact\Post" /> I have ...
xenon's user avatar
  • 895
12 votes
3 answers
2k views

Remove a block from layout without a name

I want to remove a block from the layout in magento 2 that is declared in a third party extension, but the block does not have a name. Can I do that? The block is declared like this <...
Marius's user avatar
  • 198k
12 votes
6 answers
7k views

Migrate data from Magento 1 to Magento 2

Best way to Migrate data from Magento 1 to Magento 2. I found below tools provided by Magento and some third party but don't know exactly which one to follow and what is the best way. Magento tool: ...
ImranSheik's user avatar
12 votes
1 answer
11k views

Magento 2.x PHP memory_limit requirements

I noticed that Magento 2.1 manual recommends memory_limit=2G in php.ini. That is a crazy amount of memory, isn't that memory allowed per HTTP request? I doubt there is any hosting provider that ...
MarkE's user avatar
  • 1,479
12 votes
1 answer
2k 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" >> &...
Fabian Schmengler's user avatar
12 votes
2 answers
2k views

Magento2: Conditionally replace block template and class the right way

This rather trivial requirement turns out to be quite a pain for us in recent days, as we couldn't find a satisfying existing solution, yet. The Task We are trying to replace certain blocks with a ...
Riccardo Baral's user avatar
11 votes
4 answers
46k views

Magento2 creating and calling modal widget

I want to create custom modal popup widget and call on my .phtml file. How can I do that? What will be the whole procedure for creating modal and accessing it from the .phtml file?
akshay billore's user avatar
11 votes
7 answers
7k views

How to auto update to the current year in footer Magento 2?

How to auto update the copyright year in the footer section of the site in Magento 2.
MazeStricks's user avatar
  • 1,255
11 votes
4 answers
7k views

How to specify skin image path in Knockout HTML template?

I'm trying to add an icon image in the Magento_Paypal/web/template/payment/paypal-express.html template. The icon is located in web/images. I would like to use the equivalent of the following code, ...
thdoan's user avatar
  • 728
11 votes
6 answers
23k views

How to get placeholder image url Magento2?

How to get the placeholder image URL on my template file of product listing page?
Navin Bista's user avatar
  • 1,093
11 votes
3 answers
25k views

Magento 2 How to get all active shipping methods?

My magento version is 2.1.0. How can i get all active shipping method list? Any help would be highly appreciate
Prashant Valanda's user avatar
11 votes
3 answers
26k views

Magento2 MySQL Recommeded Configurations

I was looking for the best practices and recommended configuration settings for configuring a MySQL server for hosting a Magento2 Application.
Atish Goswami's user avatar
11 votes
3 answers
8k views

how to save custom field in custom database table while editing product from back-end?

I have created a custom module to display custom tab on product form in back-end. I used this solution. Now on tab i am adding custom fields to save in custom database table. say <input type="...
HungryDB's user avatar
  • 906
11 votes
4 answers
37k views

How to get customer address by customer ID?

How to get customer address/billing address by customer ID? here's what I've done so far: $customerId = $_POST["customer_id"]; $customer = $this->_customerRepository->getById($customerId); $...
simple guy's user avatar
  • 2,484
11 votes
4 answers
11k views

How to save only specific attribute value rather than saving the whole product in Magento2

As you guys already know that we used to have this below method in magento to save a specific attribute value like this. // saving product attribute $product = Mage::getModel('catalog/product')->...
Kingshuk Deb's user avatar
  • 1,204
11 votes
6 answers
7k views

Exclude custommodule Js from minification of Js in Magento2

I am trying to minify JS in Magento 2. There is an option in the Backend: Stores -> Configuration -> Advanced -> Developer to minify js. I did that and JS got minified but it also includes my custom ...
Murali Raj's user avatar
11 votes
3 answers
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 ...
magin's user avatar
  • 515
11 votes
3 answers
4k views

MAGE_DIRS bootstrap parameters in CLI

In pub/index.php, the following code is used to set change URLs for media and static assets to omit "/pub": $params[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS] = [ DirectoryList::PUB => [...
Fabian Schmengler's user avatar
11 votes
1 answer
5k views

Magento 2: get a list of all plugins (interceptors) and preferences

Is there a way I can retrieve the list of all plugins (with the methods they're plugged onto) and all preferences (and their original class) on a Magento 2 install.
Raphael at Digital Pianism's user avatar
11 votes
2 answers
6k views

Magento 2 Use Symlink In Default or Production Mode for Pub Static Files

Situation: I am running some free trials of Magento 2 and have limited HD space on the VPS. For this reason to cut down on HD space I want to have Magento symlink the files in default or production ...
Kevin Chavez's user avatar
11 votes
3 answers
7k views

Right way to implement getExtensionAttributes()

I was wondering, what's the right way to implement an extensible EAV model. I see that in Magento\Catalog\Model\Product, the method getExtensionAttributes() is implemented like this: public function ...
Fabian Schmengler's user avatar
11 votes
1 answer
2k views

Magento 2 - block name vs as name

I've been doing some work in Magento 2 and have been overwriting some modules i've installed ( on the frontend ). However today i've just come across something that I've not encountered before. The ...
andy jones's user avatar
  • 1,383