Kavya cheerala asks for help in the following situation via a Stack Exchange question. The author has added a custom entity in the default Magento 2 import. As a result of this improvement, it is necessary to display the Magento 2 delete confirmation popup upon the delete action when you click the import button. How to do that? You will find the answer below. We explain how to add Magento 2 confirmation popup and customize its text message.
How To Add ‘Delete Confirmation Popup’ In Magento 2 For Default Import Functionality
According to IZANOVA, you only need to add the following code to your file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<script> require([‘jquery’, ‘jquery/ui’], function($){ jQuery(‘.action-delete’).click(function(e) { if(confirm(‘Do you want to remove all records?’)) { return true; } else { return false; } }); }); </script> |
That’s it! But what about a custom message in your Magento 2 confirmation popup?
How To Customize The ‘Delete Confirmation Popup’ Message In Magento 2
Let’s return to the code posted above. In the fifth line, you can see the following text – ‘Do you want to remove all records?‘
Feel free to replace it with any text to customize your ‘Delete Confirmation Popup’ message in Magento 2. For instance, you can use something like ‘All records will be removed. Would you like to continue?‘
In this case, your Magento 2 confirmation popup code should look as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<script> require([‘jquery’, ‘jquery/ui’], function($){ jQuery(‘.action-delete’).click(function(e) { if(confirm(”All records will be removed. Would you like to continue?‘)) { return true; } else { return false; } }); }); </script> |
How To Import Custom Entities To Magento 2?
You need a third-party solution to enable the functionality invaluable in Magento 2 by default. Currently, the Improved Import & Export Magento 2 extension is the most powerful solution in its niche. It provides the ability to transfer all the core entities between your e-commerce website and other platforms. You can use mapping to adjust Magento 2 standards to external requirements and vice versa.
At the same time, the Improved Import & Export extension lets you automate data transfers. You just create a schedule and the module does all the work for you.
What about a Magento 2 confirmation popup, you will ask? We can customize the module as you wish, adding features that your business requires. Just drop us a message.
Follow the link below to get more ideas on what the Improved Import & Export Magento 2 extension is.
Get Improved Import & Export Magento 2 Extension
Also, don’t forget to check our Magento 2 Cookbook. You will find more useful tips like that there.