Magento is a robust ecommerce platform.
However studying tips on how to use Magento appropriately could be difficult. To simplify this activity, Adobe supplies a pattern information module for Magento 2 that transforms a Magento set up right into a demo Magento 2 retailer.
This information explains the fundamentals of the Magento 2 pattern information module and teaches you tips on how to set up it appropriately.
Right here’s what we cowl on this tutorial:
Magento pattern information is a module that transforms a Magento occasion right into a demo retailer. That retailer comes with pattern information resembling prospects, orders, classes, CMS pages, and pricing guidelines. Moreover that, it installs the free Luma Magento 2 theme and provides over 250 Magento 2 merchandise.
The pattern information module is a set of 19 packages for Magento Open Supply and 24 packages for Adobe Commerce.
You’ll be able to view the packages for Magento Open Supply contained in the pattern information repository.
Adobe Commerce customers get entry to these packages plus the next 5 modules for Commerce-specific options:
You’ll be able to set up Magento pattern information in 3 ways:
The Magento CLI and Composer set up strategies can be utilized if you’ve put in Magento 2 utilizing an archive file from Adobe or a Composer metapackage.
However these strategies received’t work for those who’ve put in Magento by cloning its GitHub archive.
That’s as a result of the composer.json file within the GitHub archive doesn’t comprise the “https://repo.magento.com” URL. For those who’ve put in Magento 2 by cloning a GitHub archive, you’ll want to put in pattern information by cloning its GitHub repository.
Adobe supplies you with the sampledata:take away CLI command to uninstall pattern information modules. Nonetheless, that command doesn’t delete Magento database entries.
The one strategy to take away the Magento 2 pattern information module solely is by dropping the database and reinstalling Magento 2 with a brand new database.
Observe these steps to put in pattern information in Magento 2.
Be aware: Don’t set up pattern information on a manufacturing server, as you can’t uninstall the module with out deleting the Magento database and reinstalling Magento.
Log in to your server over SSH, swap to the Magento file system person, and navigate to the Magento root listing. Then, allow developer mode utilizing:
$ php bin/magento deploy:mode:set developer
Then, clear beforehand generated lessons and proxies utilizing the next command:
$ rm -rf generated/code/* generated/metadata/*
Set up the Magento 2 pattern information module utilizing the next command:
$ php bin/magento sampledata:deploy
It’s best to see the next terminal output:
Be aware: You could must enter your Magento authentication keys at this level. Observe Adobe’s information to retrieve the private and non-private keys used to put in your Magento software and use the identical keys for the pattern information module set up.
As soon as the Magento 2 pattern information set up command executes efficiently, replace the Magento database and schema utilizing the beneath command:
$ php bin/magento setup:improve
After that, clear all Magento cache sorts utilizing:
$ php bin/magento cache:clear $ php bin/magento cache:flush
Lastly, entry your storefront in a browser. Right here’s the way it will look:
Listed below are three frequent errors you may encounter throughout pattern information set up and the steps to repair them.
File system permission errors are one of the vital frequent errors you may face if you set up Magento 2 pattern information.
As an illustration, you may encounter exceptions resembling:
For those who face such errors, you’ll must reset file system permissions primarily based in your deployment.
Observe Adobe’s information demonstrating the steps to set file system entry permissions and rerun the sampledata:deploy command.
Putting in Magento pattern information in manufacturing mode could cause a PHP Deadly error or the next error if you run the setup:improve command:
To forestall such errors, swap to developer mode and clear generated information prior to installing Magento 2 pattern information.
The Magento pattern information module set up course of is a resource-intensive activity. Relying in your server configuration, it could actually take anyplace from a number of seconds to a number of minutes.
Typically, it could actually fail silently when the max_execution_time in your PHP configuration file is insufficient for the pattern information script.
To repair this problem, swap to a person with root privileges and edit the php.ini file utilizing your most popular textual content editor.
As an illustration, in case your PHP model is 7.4, you possibly can run this code:
$ nano /and so on/php/7.4/fpm/php.ini
Discover the max_execution_time setting and replace its worth to 600 or extra. Save the file and restart PHP to replace its configuration.
After that, run the sampledata:deploy command and reset the max_execution_time worth to the unique worth as soon as the Magento 2 pattern information set up is accomplished.
We’ve defined the fundamentals of the Magento 2 pattern information module, demonstrated a step-by-step set up course of, and shared tricks to repair frequent errors.
It’s vital to recollect that you would be able to’t uninstall pattern information with out reinstalling Magento. So be sure you solely set up it in a staging atmosphere.
Don’t have a take a look at server?
Join managed Magento internet hosting with Nexcess and get entry to devoted staging websites at no additional price.
Browse our plans to be taught extra.