Magento2 – Encrypt & Decrypt Configuration Settings Value using N98-magerun2 CLI

This article shows how you can encrypt and decrypt Magento configuration settings values using the n98-magerun2 command line (CLI) tool. Get configuration settings value in plain text n98-magerun2.phar config:store:get path/of/config/setting Get configuration settings value on store level n98-magerun2.phar config:store:get –scope=stores –scope-id=2 config/setting/path Get decrypted configuration settings value n98-magerun2.phar config:store:get –decrypt config/setting/path Set configuration settings value … Read more

Magent 2: Load Configurable Product with Options pre-selected

This article shows how you can load any configurable product in Magento with the configurable options pre-selected. We can append the Attribute-OptionValue hash value (#Attribute_ID=Value_ID) at the end of the configurable product URL. For example, let’s suppose that the configurable product URL is: https://example.com/my-configurable-product.html We can add the attribute option values like this: https://example.com/my-configurable-product.html#802=130&805=187 #Attribute_ID=Value_ID … Read more

Magento 2: Add Custom Console CLI Command in your Module

Magento allows to create custom console commands to the Symfony-like command-line interface (CLI). The Console component allows you to create command-line commands. You can create custom console commands for any task like import, export, or other batch jobs. In this article, I will be creating a custom Magento2 module and will add a custom console … Read more

Magento 2 ElasticSearch: No alive nodes found in your cluster / Types cannot be provided in put mapping requests

Problem: There was the following error related to ElasticSearch / OpenSearch while reindexing the catalogsearch in Magento. bin/magento indexer:reindex catalogsearch_fulltext could not validate a connection to elasticsearch. no alive nodes found in your cluster Another similar error during catalogsearch reindex: bin/magento indexer:reindex catalogsearch_fulltext Catalog Search index process error during indexation process: {"error":{ "root_cause":[{ "type":"illegal_argument_exception", "reason":"Types … Read more

Set up Magento 2 Development Environment with Docker & Warden

Warden is a CLI utility for orchestrating Docker-based developer environments and enables multiple local environments to run simultaneously without port conflicts. docker-compose is used to control everything that Warden runs. Using Warden, a custom environment can be set up for each project. The environment can also be overridden or extended. Warden supports the following applications … Read more

Backup & Restore Magento2 Database using N98-magerun2

n98-magerun is a handy CLI tool to work on Magento from command line. Backup/Dump Database Backup Database in a plain SQL File n98-magerun2.phar db:dump var/projectName_date.sql Print only the MySQL command. Do not execute it. This can be done by using the –only-command option. n98-magerun2.phar db:dump –only-command var/projectName_date.sql You may also use the time command which … Read more

Magento 2: Disable Admin Password Expiration/Change

Magento’s backend/admin password expires in 90 days by default. So, in every 90 days, when you login to admin, you will be asked to change your admin user’s password. This is a useful security feature in production/live site. However, this can be annoying to have in a development/testing site. This article shows on how you … Read more

Magento2: Reset Admin 2FA (Two-Factor Authentication)

This article shows how you can reset your Magento 2 Admin User’s 2FA (Two-Factor Authentication). Get your admin user ID from admin_user table. SELECT user_id from admin_user WHERE username = 'YOUR_ADMIN_USERNAME'; OR, SELECT user_id from admin_user WHERE email = 'YOUR_ADMIN_EMAIL'; For e.g. My admin user id = 299 username: MukeshChapagain Check two-factor authentication related table … Read more

Magento 2: ERR_TOO_MANY_REDIRECTS After Importing Database

Problem: Getting 302 redirects (ERR_TOO_MANY_REDIRECTS error) after I imported the server’s database into the local Magento setup. I am getting the redirect error on both backend and frontend. Investigation: I checked for the values for the web/ page in core_config_data table. MariaDB [magento]> SELECT * FROM core_config_data WHERE path LIKE "web/%"; +———–+———+———-+———————————————+——————————+———————+ | config_id | … Read more