The following shell command (executed from your Magento 2 root folder) allows you to create a database backup of your Magento 2 store. php bin/magento setup:backup –db
Reindexing URL rewrites (Magento 2)
Magento 2 URL rewrites are not updated simply by rebuilding the indexes. If you want to rebuild them from the command line, I recommend using https://github.com/olegkoval/magento2-regenerate_url_rewrites. This extension lets you regenerate all Magento 2 URL rewrites from the shell. Afterwards,…
Creating a database backup from the command line (Magento 2)
To back up your Magento 2 database from the command line, run this command from the root directory of your Magento 2 installation:
|
1 |
php bin/magento setup:backup --db |
Logging in Magento 2
You can write messages to Magento 2′s system.log using the following code:
|
1 |
$this->_logger->info('... message ... '); |
Fixing Allowed memory size exhausted during compilation (Magento 2)
If you receive the message Allowed memory size of 123456789 bytes exhausted during Magento 2 compilation, you can try increasing the available memory by specifying -dmemory_limit=5G . The command might look like this:
|
1 |
php -dmemory_limit=5G bin/magento setup:di:compile |
Checking the Magento version via the command line
The following command displays the Magento 2 version in your shell. Run it from the Magento 2 root directory.
|
1 |
php bin/magento --version |
Enabling template hints in Magento 2
In Magento 2, you can find Template Hints under Shops > Erweitert > Entwickler > Debuggen. Easy once you know where to look
Show address data (like company, name) on registration form (Magento 2)
By default, the Magento 2 registration form does not show address data such as the company, name or street. To change that, simply create customer_account_create.xml in the folder app/design/Your Vendor/Your Theme/Magento_Customer/layout and add the following code:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<?xml version="1.0"?> <!-- /** * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="customer_form_register"> <arguments> <argument name="show_address_fields" xsi:type="string">1</argument> </arguments> </referenceBlock> </body> </page> |
Now just clear…
Showing address fields during registration (Magento 2)
To request address details during registration, create the file customer_account_create.xml im Verzeichnis app/design/YourVendor/YourTheme/Magento_Customer/layout and insert the following content:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<?xml version="1.0"?> <!-- /** * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="customer_form_register"> <arguments> <argument name="show_address_fields" xsi:type="string">1</argument> </arguments> </referenceBlock> </body> </page> |
Clear the cache afterwards. Address fields should then appear when registering a new account.
Starting the reindex process (Magento 2)
To start the Magento 2 reindexing process, run the following shell command:
|
1 |
php bin/magento indexer:reindex |