Category: Magento

  • Magento 1 Password Reset

    To reset the password for the admin user in Magento 1 installation, go to phpMyAdmin, run the following SQL command.

    UPDATE admin_user SET `password` = CONCAT(MD5('xxPASSOWRD_HERE'), ':xx') WHERE `username` = 'admin';
    

    In the above SQL command, replace PASSOWRD_HERE with your new password.

    If you don’t know Magento backend URL, you can find it in file app/etc/local.xml

        
            
                
                    
                        
                    
                
            
        
    

    In this case, Magento backend URL is yourdomain.com/2XwA5Vb6PW

    See Magento

  • Magento 2 Unable to proceed: the maintenance mode is enabled

    Magento 2 Unable to proceed: the maintenance mode is enabled

    When i visit a Magento 2 site, i get error

    1 exception(s):
    Exception #0 (Exception): Unable to proceed: the maintenance mode is enabled. 
    
    Exception #0 (Exception): Unable to proceed: the maintenance mode is enabled. 
    
    #1 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\Http\Interceptor#000000003459ecdd0000000028ca744b#) called at [index.php:39]
    

    magento 2 maintanance mode

    To fix this, login to the server using SSH, run following command.

    php bin/magento maintenance:disable
    

    This will disable Magento 2 maintenance mode.

    If you need maintenance mode enabled, you can run

    php bin/magento maintenance:enable 
    

    See Magento

  • Install Elasticsearch 7 on Ubuntu for Magento 2.3

    To install Elasticsearch, add the key

    wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg

    Install apt-transport-https

    sudo apt-get install apt-transport-https

    Add apt repository

    echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list

    install elasticsearch with apt

    apt-get update
    apt-get install elasticsearch

    Set elasticsearch to start on boot

    systemctl daemon-reload
    systemctl enable elasticsearch

    Elasticsearch can be started and stopped as follows:

    systemctl start elasticsearch
    systemctl stop elasticsearch

    Verify Elasticsearch is running with

    systemctl status elasticsearch

    or with

    curl localhost:9200

    if it fails to start, you can debug it with

    journalctl --unit elasticsearch

    Official install instructions at

    https://www.elastic.co/guide/en/elasticsearch/reference/8.3/deb.html

    See elasticsearch

  • Set Magento 2 in Production Mode

    To see current mode in Magento 2, run

    php bin/magento deploy:mode:show
    

    Example

    Magento 2 mode

    To set Magento 2 in production mode, run

    php bin/magento deploy:mode:set production
    

    See Magento 2

  • Magento 2 Change Email of an Admin user

    To change email address of an admin user, run following SQL in MySQL command promt or in phpMyAdmin

    update admin_user set email='NEW_EMAIL_ADDR_HERE' where email='OLD_EMAIL_ADDR_HERE';
    

    See Magento 2

  • Magento 2 Disable Two-Factor Authentication

    Magento 2.4.0 come with Two-Factor authentication. Once you installed Magento 2.4.0 or latest you will be asked to setup Two-Factor Autentication.

    magento 2

    To Disable Two-Factor Authentication, edit file

    vi app/etc/config.php
    

    Find

            'Magento_TwoFactorAuth' => 1,
    

    Replace with

            'Magento_TwoFactorAuth' => 0,
    

    Run commands

    php bin/magento setup:upgrade
    php bin/magento setup:static-content:deploy -f
    

    Now you will be able to login to Magento Admin with out setting up Two-Factor autentication.

    See Magento 2

  • Magento 2 list enabled modules

    To list Modules in Magento 2, run

    php bin/magento module:status
    

    Example

    [markt-24@server public_html]$ php bin/magento module:status
    List of enabled modules:
    Magento_AdminAnalytics
    Magento_Store
    Magento_AdobeIms
    Magento_AdobeImsApi
    Magento_AdobeStockAdminUi
    Magento_MediaGallery
    Magento_AdobeStockAssetApi
    Magento_AdobeStockClient
    Magento_AdobeStockClientApi
    Magento_AdobeStockImage
    Magento_Directory
    Magento_AdobeStockImageApi
    Magento_AdvancedPricingImportExport
    Magento_Theme
    Magento_Amqp
    Magento_AmqpStore
    Magento_Config
    Magento_Backend
    Magento_Authorization
    Magento_Search
    Magento_Backup
    Magento_Eav
    Magento_Variable
    Magento_BundleImportExport
    Magento_CacheInvalidate
    Magento_Customer
    Magento_AdminNotification
    Magento_Indexer
    Magento_Security
    Magento_GraphQl
    Magento_EavGraphQl
    Magento_Cms
    Magento_CatalogImportExport
    Magento_Catalog
    Magento_CatalogInventory
    Magento_Rule
    Magento_Payment
    Magento_CatalogRuleGraphQl
    Magento_CatalogRule
    Magento_CatalogUrlRewrite
    Magento_StoreGraphQl
    Magento_Widget
    Magento_Quote
    Magento_SalesSequence
    Magento_CheckoutAgreementsGraphQl
    Magento_MediaGalleryUi
    Magento_CmsGraphQl
    Magento_CmsUrlRewrite
    Magento_CmsUrlRewriteGraphQl
    Magento_ComposerRootUpdatePlugin
    Magento_User
    Magento_Msrp
    Magento_Sales
    Magento_CatalogGraphQl
    Magento_Checkout
    Magento_Contact
    Magento_Cookie
    Magento_Cron
    Magento_Csp
    Magento_CurrencySymbol
    Magento_CatalogCustomerGraphQl
    Magento_Integration
    Magento_Downloadable
    Magento_CustomerGraphQl
    Magento_CustomerImportExport
    Magento_Deploy
    Magento_Developer
    Magento_Dhl
    Magento_Captcha
    Magento_DirectoryGraphQl
    Magento_QuoteGraphQl
    Magento_DownloadableGraphQl
    Magento_ImportExport
    Magento_ConfigurableProduct
    Magento_BundleGraphQl
    Magento_CatalogSearch
    Magento_AdvancedSearch
    Magento_Elasticsearch
    Magento_Email
    Magento_EncryptionKey
    Magento_Fedex
    Magento_GiftMessage
    Magento_GoogleAdwords
    Magento_GoogleAnalytics
    Magento_Ui
    Magento_GoogleShoppingAds
    Magento_CatalogCmsGraphQl
    Magento_PageCache
    Magento_GroupedProduct
    Magento_GroupedImportExport
    Magento_GroupedCatalogInventory
    Magento_GroupedProductGraphQl
    Magento_DownloadableImportExport
    Magento_Bundle
    Magento_InstantPurchase
    Magento_Analytics
    Magento_Inventory
    Magento_InventoryAdminUi
    Magento_InventoryAdvancedCheckout
    Magento_InventoryApi
    Magento_InventoryBundleImportExport
    Magento_InventoryBundleProduct
    Magento_InventoryBundleProductAdminUi
    Magento_InventoryBundleProductIndexer
    Magento_InventoryCatalog
    Magento_InventorySales
    Magento_InventoryCatalogAdminUi
    Magento_InventoryCatalogApi
    Magento_InventoryCatalogSearch
    Magento_InventoryConfigurableProduct
    Magento_InventoryConfigurableProductAdminUi
    Magento_InventoryConfigurableProductIndexer
    Magento_InventoryConfiguration
    Magento_InventoryConfigurationApi
    Magento_InventoryDistanceBasedSourceSelection
    Magento_InventoryDistanceBasedSourceSelectionAdminUi
    Magento_InventoryDistanceBasedSourceSelectionApi
    Magento_InventoryElasticsearch
    Magento_InventoryExportStockApi
    Magento_InventoryIndexer
    Magento_InventorySalesApi
    Magento_InventoryGroupedProduct
    Magento_InventoryGroupedProductAdminUi
    Magento_InventoryGroupedProductIndexer
    Magento_InventoryImportExport
    Magento_InventoryInStorePickupApi
    Magento_InventoryInStorePickupAdminUi
    Magento_InventorySourceSelectionApi
    Magento_InventoryInStorePickup
    Magento_InventoryInStorePickupGraphQl
    Magento_Shipping
    Magento_InventoryInStorePickupShippingApi
    Magento_InventoryInStorePickupQuoteGraphQl
    Magento_InventoryInStorePickupSales
    Magento_InventoryInStorePickupSalesApi
    Magento_InventoryInStorePickupQuote
    Magento_InventoryInStorePickupShipping
    Magento_InventoryInStorePickupShippingAdminUi
    Magento_Multishipping
    Magento_Webapi
    Magento_InventoryCache
    Magento_InventoryLowQuantityNotification
    Magento_Reports
    Magento_InventoryLowQuantityNotificationApi
    Magento_InventoryMultiDimensionalIndexerApi
    Magento_InventoryProductAlert
    Magento_InventoryRequisitionList
    Magento_InventoryReservations
    Magento_InventoryReservationCli
    Magento_InventoryReservationsApi
    Magento_InventoryExportStock
    Magento_InventorySalesAdminUi
    Magento_CatalogInventoryGraphQl
    Magento_InventorySalesFrontendUi
    Magento_InventorySetupFixtureGenerator
    Magento_InventoryShipping
    Magento_InventoryShippingAdminUi
    Magento_InventorySourceDeductionApi
    Magento_InventorySourceSelection
    Magento_InventoryInStorePickupFrontend
    Magento_LayeredNavigation
    Magento_LoginAsCustomer
    Magento_LoginAsCustomerAdminUi
    Magento_LoginAsCustomerApi
    Magento_LoginAsCustomerFrontendUi
    Magento_LoginAsCustomerLog
    Magento_LoginAsCustomerPageCache
    Magento_LoginAsCustomerQuote
    Magento_LoginAsCustomerSales
    Magento_Marketplace
    Magento_MediaContent
    Magento_MediaContentApi
    Magento_MediaContentCatalog
    Magento_MediaContentCms
    Magento_MediaContentSynchronization
    Magento_MediaContentSynchronizationApi
    Magento_MediaContentSynchronizationCatalog
    Magento_MediaContentSynchronizationCms
    Magento_AdobeStockAsset
    Magento_MediaGalleryApi
    Magento_MediaGalleryCatalog
    Magento_MediaGalleryIntegration
    Magento_MediaGallerySynchronization
    Magento_MediaGallerySynchronizationApi
    Magento_AdobeStockImageAdminUi
    Magento_MediaGalleryUiApi
    Magento_MediaStorage
    Magento_MessageQueue
    Magento_CatalogRuleConfigurable
    Magento_MsrpConfigurableProduct
    Magento_MsrpGroupedProduct
    Magento_InventoryInStorePickupMultishipping
    Magento_MysqlMq
    Magento_NewRelicReporting
    Magento_Newsletter
    Magento_OfflinePayments
    Magento_SalesRule
    Magento_GraphQlCache
    Magento_CardinalCommerce
    Magento_Vault
    Magento_Paypal
    Magento_PaypalGraphQl
    Magento_Persistent
    Magento_ProductAlert
    Magento_ProductVideo
    Magento_CheckoutAgreements
    Magento_QuoteAnalytics
    Magento_ConfigurableProductGraphQl
    Magento_ReCaptchaAdminUi
    Magento_ReCaptchaCheckout
    Magento_ReCaptchaContact
    Magento_ReCaptchaCustomer
    Magento_ReCaptchaFrontendUi
    Magento_ReCaptchaMigration
    Magento_ReCaptchaNewsletter
    Magento_ReCaptchaPaypal
    Magento_ReCaptchaReview
    Magento_ReCaptchaSendFriend
    Magento_ReCaptchaUi
    Magento_ReCaptchaUser
    Magento_ReCaptchaValidation
    Magento_ReCaptchaValidationApi
    Magento_ReCaptchaVersion2Checkbox
    Magento_ReCaptchaVersion2Invisible
    Magento_ReCaptchaVersion3Invisible
    Magento_RelatedProductGraphQl
    Magento_ReleaseNotification
    Magento_InventoryLowQuantityNotificationAdminUi
    Magento_RequireJs
    Magento_Review
    Magento_ReviewAnalytics
    Magento_Robots
    Magento_Rss
    Magento_Elasticsearch6
    Magento_ConfigurableProductSales
    Magento_SalesAnalytics
    Magento_SalesGraphQl
    Magento_SalesInventory
    Magento_OfflineShipping
    Magento_ConfigurableImportExport
    Magento_UrlRewrite
    Magento_Elasticsearch7
    Magento_CustomerAnalytics
    Magento_Securitytxt
    Magento_SendFriend
    Magento_SendFriendGraphQl
    Magento_InventoryInStorePickupSalesAdminUi
    Magento_Sitemap
    Magento_UrlRewriteGraphQl
    Magento_CustomerDownloadableGraphQl
    Magento_Swagger
    Magento_SwaggerWebapi
    Magento_SwaggerWebapiAsync
    Magento_Swatches
    Magento_SwatchesGraphQl
    Magento_SwatchesLayeredNavigation
    Magento_Tax
    Magento_TaxGraphQl
    Magento_TaxImportExport
    Magento_AsynchronousOperations
    Magento_ThemeGraphQl
    Magento_Tinymce3
    Magento_Translation
    Magento_GoogleOptimizer
    Magento_Ups
    Magento_SampleData
    Magento_CatalogUrlRewriteGraphQl
    Magento_CatalogAnalytics
    Magento_Usps
    Magento_InventoryGraphQl
    Magento_PaypalCaptcha
    Magento_VaultGraphQl
    Magento_Version
    Magento_InventoryInStorePickupWebapiExtension
    Magento_WebapiAsync
    Magento_WebapiSecurity
    Magento_Weee
    Magento_WeeeGraphQl
    Magento_CatalogWidget
    Magento_Wishlist
    Magento_WishlistAnalytics
    Magento_WishlistGraphQl
    Amazon_Core
    Amazon_Login
    Amazon_Payment
    Dotdigitalgroup_Email
    Dotdigitalgroup_Chat
    Klarna_Core
    Klarna_Ordermanagement
    Klarna_Onsitemessaging
    Klarna_Kp
    Magefan_Community
    Magefan_Blog
    Magefan_WysiwygAdvanced
    PayPal_Braintree
    PayPal_BraintreeGraphQl
    Sm_BackEnd
    Sm_CartQuickPro
    Sm_Categories
    Sm_CategoriesMenu
    Sm_FilterProducts
    Sm_ListingTabs
    Sm_Market
    Sm_MegaMenu
    Sm_SearchBox
    Sm_ShopBy
    Temando_ShippingRemover
    Vertex_Tax
    Vertex_AddressValidation
    Yotpo_Yotpo
    
    List of disabled modules:
    Magento_TwoFactorAuth
    
    [markt-24@server public_html]$
    

    See Magento 2

  • Magento Change URL

    Magento Change URL

    Magento store website URL in table core_config_data. This is the same for Magento 1 and Magento 2. To see the current URL, in phpMyAdmin or MySQL command line, run

    select * from core_config_data where path like '%_url';

    Normally this shows 2 entries. If it shows more than 2 entries, it is because you have more store configured in your Magento installation. In such a case, you should be careful to change the correct URL.

    To change the URL, run

    UPDATE core_config_data SET value = 'https://NEW_URL_HERE/' WHERE path = 'web/unsecure/base_url';
    UPDATE core_config_data SET value = 'https://NEW_URL_HERE/' WHERE path = 'web/secure/base_url';

    Replace https://NEW_URL_HERE/ with your new website URL.

    Magento 2

    If you move a site from one site to another with a different folder structure, some static resources may not work as they use symlink and the path does not exist. To fix this, you need to redeploy the static assets.

    Clear the pub/static directory (excluding the .htaccess file):

    rm -rf var/www/html/pub/static/* 

    Clear generated directory:

    rm -rf var/www/html/generated/*

    Generate static files.

    php -d memory_limit=-1 bin/magento setup:static-content:deploy -f

    If you have multiple languages, you can use

    php -d memory_limit=-1 bin/magento setup:static-content:deploy -f en_US en_GB

    Clear cache with the command

    php bin/magento cache:flush

    Magento 1

    If you use Magento 1, use the following command to flush the cache.

    php -r 'require "app/Mage.php"; Mage::app()->getCacheInstance()->flush();'

    See Magento

  • Magento 1 Command Line Tool

    Magento 1 Command Line Tool

    Magento 2 comes with command line tool to manage magento installation. This help you to do many tasks like clearning cache, install extension easier.

    Magento 1 CLI is available from

    https://github.com/netz98/n98-magerun

    To install Magento 1 command line tool, go to Magento install folder and run

    wget https://files.magerun.net/n98-magerun.phar
    chmod +x ./n98-magerun.phar
    

    Now you will be able to use the command line with

    ./n98-magerun.phar
    

    Here is an example how to Upgrade an Extension using CLI

    # ./n98-magerun.phar extension:upgrade Auctane_ShipStation
    Checking dependencies of packages
    Starting to download Auctane_ShipStation-1.3.47.tgz ...
    ...done: 46,264 bytes
    Installing package community/Auctane_ShipStation 1.3.47
    Package community/Auctane_ShipStation 1.3.47 installed successfully
    Package upgraded: community/Auctane_ShipStation 1.3.47
    
    # 
    
  • Enable SSL in Magento 1.9

    To enable SSL in Magento, go to System > Configuration

    Magento 1.9 SSL

    Click on “Web” link on left menu.

    Magento Configuration

    On this page, set Auto-redirect to Base URL to No.

    Magento Auto-redirect to Base URL

    Under “Unsecure” option, change the URL to use HTTPS.

    Magento HTTPS

    Under “Secure” option, set “https” for Base URL. Set “Yes” for both “Use Secure URLs in Frontend” and “Use Secure URLs in Admin”.

    Magento enable SSL

    If your Home page is linking to non HTTPS link, this is because Default page is set to CMS page, you need to edit and replace content of CMS page to use HTTPS links under Magento Admin > CMS > Pages.

  • Change Magento 1.9  admin URL

    Change Magento 1.9 admin URL

    To change Magento admin URL, login to Magento Admin area.

    Go to System > Configuration

    On next page, from side menu, click on Admin menu.

    On next page

    Use Custom Admin Path = Yes
    Custom Admin Path = okadmin
    

    Replace “okadmin” with whatever folder name you need for your magento admin area.

    Click “Save Config”

    Edit file

    vi app/etc/local.xml
    

    Find

    < ![CDATA[admin]]>
    

    Replace admin with your new folder name for admin area.

    Now you need to Clean magento cache. This can be done with command

    cd /path/to/magento/install/dir
    rm -rf var/cache
    

    Now you admin area will work on new URL.

    Doing it with MySQL

    Here is the changes made on database when i changed a sites admin folder path to “localsense”.

    Some useful SQL

    select * from core_config_data where path like "%url";
    select * from core_config_data where path like "%custom_path%";
    

    You can just set the value for “admin/url/use_custom_path” to 1 and “admin/url/custom_path” to the new admin folder name you need.