Skip to content

Setup Local Magento

Adjust env.php and config.php

After getting your production files to local, don’t forget to change your env.php and also config.php to your local environment credentials.

app/etc/env.php
app/etc/config.php

Get Npm and Grunt Going

Magento 2 is using npm and Grunt to compile LESS file. Therefore it’s important to make sure that Gruntfile.js and package.json exist in your Magento 2 root directory. If it’s missing for some reason, you can always copy the original file from the sample file provided within the Magento 2 root directory.

Gruntfile.js (copied from Gruntfile.js.sample)
package.json (copied from package.json.sample)
Then you can run (Important that you have npm and grunt is also installed within your local environment)
npm install
grunt exec:child
grunt less:child

Developer Mode (Disable Production Mode Optimization)

After getting database dump from production or staging environment normally comes with optimize caching configuration which are not helpful during development. You can easily undo these setting by running the command below for every new database dump.

php bin/magento de:mo:set developer
php bin/magento config:data:import vendor/storeframe/runner/config/store dev/developer

Production Mode Optimization (Configuration Reset)

In case you wanted to know which performance optimization is applied or how StoreFrame Framework make your production environment optimization setting, you can check the yaml configuration we have or simply run the command below:

php bin/magento config:data:import vendor/storeframe/runner/config/store init/init
You can find the yaml configuration here:
vendor/storeframe/runner/config/store/init/init/storeframe.yaml
During StoreFrame initial deployment, all StoreFrame Framework will have production optimize setting. This setting will remain as long as there is no new database sync from local back to production. If you do so, then you have to activate those optimization setting manually. If you re-run the command above, it will reset all setting to the StoreFrame Framework default configuration.

Collect Missing Translations

Through Experius missing translation module you can collect missing translation by running the command below. This would generate a new language file within app/etc/i18n with the missing translation strings. Further more you can also collect missing translation by using cronjob. This would allow you to work with translation using Magento 2 admin (database translation).

php bin/magento experius_missingtranslations:collect --magento --locale nl_NL

Set Locale Languages

Due to the limitation of Magento 2 in production mode, a static content deploy is required to add a new language into your webshop. You can easily change your default Magento 2 store locale from one language to another by running this command (ie: English to Dutch in default storeview).

php bin/magento config:set general/locale/code nl_NL
In case your base shop is in English and you wanted to have your new storeview in German (using “de” as the defined store code in Magento 2 admin)
php bin/magento config:set --scope=store --scope-code=de general/locale/code de_DE

Additional Menu Custom Block Identifier

The default standard Magento 2 main menu doesn’t allow you to easily add a new navigation (only based on your webshop categories). Therefore we have created a special identifier static block that you can add within your Magento 2 admin.

Block identifier name
custom-menu-block