|
1 |
| -# Introduction |
| 1 | +Magento sample data includes a sample store, complete with more than 250 products (about 200 of them are configurable products), categories, promotional price rules, CMS pages, banners, and so on. Sample data uses the Luma theme on the storefront. |
2 | 2 |
|
3 |
| -Magento sample data uses the responsive Luma theme to display a sample store, complete with products, categories, promotional price rules, CMS pages, banners, and so on. You can use the sample data to come up to speed quickly and see the power and flexibility of the Magento storefront. |
| 3 | +Installing sample data is optional. |
4 | 4 |
|
5 |
| -Installing sample data is optional; you can install it before or after you install the Magento software. |
| 5 | +Technically, sample data is a set of regular Magento modules, which can be deployed and installed together with the Magento instance, or later in the scope of upgrade. |
6 | 6 |
|
7 |
| -# Deployment |
| 7 | +## Deploy Sample Data |
| 8 | +You can deploy sample data from one of the following sources: |
8 | 9 |
|
9 |
| -Deployment of Sample Data can be performed in three ways: using Magento CLI, composer and from GitHub repository. |
| 10 | +* From the Magento composer repository, optionally using Magento CLI |
| 11 | +* From the Magento GitHub repository |
10 | 12 |
|
11 |
| -## Using CLI |
| 13 | +If your Magento code base was cloned from the `master` branch, you can use either source of the sample data. If it was cloned from the `develop` branch, use the GitHub repository and choose to get sample data modules from the `develop` branch. |
12 | 14 |
|
13 |
| -SampleData module is included to default scope of Magento CE modules. To deploy other sample data modules (e.g. ConfigurableSampleData, CatalogSampleData e.t.c) Magento CLI command can be used: |
| 15 | +### Deploy Sample Data from Composer Repository |
14 | 16 |
|
15 |
| -``` |
16 |
| -# bin/magento sampledata:deploy |
17 |
| -``` |
18 |
| - |
19 |
| -CLI command collects suggest node from composer.json files of modules which suggest to install sample data: |
20 |
| - |
21 |
| -``` |
22 |
| -"suggest": { |
23 |
| - "magento/module-catalog-sample-data": "Sample Data version:1.0.0-beta" |
24 |
| -} |
25 |
| -``` |
| 17 | +To deploy sample data from the Magento composer repository using Magento CLI: |
26 | 18 |
|
27 |
| -## Using Composer |
| 19 | +1. If your Magento instance is already installed, skip this step. Otherwise, in the Magento root directory, run: `# composer install`. |
| 20 | +2. In the Magento root directory, run: `# bin/magento sampledata:deploy`. This command collects the dependencies from the `suggest` sections of the `composer.json` files of modules, which suggest to install sample data (like `Magento_Catalog`, `Magento_Sales`, and so on). |
28 | 21 |
|
29 |
| -Also it's possible to add needed sample data modules manually (via composer require or editing main composer.json file) |
| 22 | +To deploy sample data from the Magento composer repository without Magento CLI: |
30 | 23 |
|
31 |
| -1. Specify packages |
| 24 | +1. Specify sample data packages in the `require` section of the root `composer.json` file, for example: |
32 | 25 | ```
|
33 | 26 | {
|
34 | 27 | "require": {
|
35 |
| - ... |
36 |
| - "magento/module-catalog-sample-data": "{version}", |
| 28 | + ... |
| 29 | + "magento/module-catalog-sample-data": "{version}", |
37 | 30 | "magento/module-configurable-sample-data": "{version}",
|
38 | 31 | "magento/module-cms-sample-data": "{version}",
|
39 | 32 | "magento/module-sales-sample-data": "{version}"
|
40 | 33 | ....
|
41 | 34 | }
|
42 |
| - } |
43 |
| -{version} - Go to repo.magento.com and write down suitable versions of magento/sample-data and magento/sample-data-media (typically, you should choose the most recent version). |
| 35 | +} |
44 | 36 | ```
|
45 |
| -2. Run composer update from your Magento root directory |
46 | 37 |
|
47 |
| -## From GitHub Repository |
| 38 | +Where `<version>` is the version of the packages; it should correspond to the version of the Magento instance. |
48 | 39 |
|
49 |
| -1. Clone Sample Data from https://github.com/magento/magento2-sample-data |
50 |
| -2. Link Sample Data and Magento Edition using tool <sample-data-ce-root>/dev/tools/build-sample-data.php |
51 |
| -``` |
52 |
| -php -f <sample-data-ce-root>/dev/tools/build-sample-data.php -- --ce-source="path/to/magento/ce/edition" |
53 |
| -``` |
| 40 | +Each package corresponds to a sample data module. The complete list of available modules can be viewed in the [sample data GitHub repository] (https://github.com/magento/magento2-sample-data/tree/develop/app/code/Magento) |
54 | 41 |
|
55 |
| -# Installing |
| 42 | +2. To update the dependencies, in the Magento root directory, run: `# composer update` |
56 | 43 |
|
57 |
| -Being once deployed the Sample Data is available for installation through the Magento Setup Wizard or using CLI. |
| 44 | +### Deploy Sample Data from GitHub Repository |
58 | 45 |
|
59 |
| -## Web Installation |
| 46 | +To deploy sample data from the GitHub repository: |
60 | 47 |
|
61 |
| -Deployed SampleData modules have been selected to be installed by default. To prepare installation Magento with SampleData finish installation as you do it usual. In success page user will be notified about successfully installed SampleData |
| 48 | +1. Clone sample data from `https://github.com/magento/magento2-sample-data`. If your Magento instance was cloned from the `master` branch, choose the `master` branch when cloning sample data; choose the `develop` branch if Magento was cloned from `develop`. |
| 49 | +2. Link the sample data and your Magento instance by running: `# php -f <sample-data_clone_dir>/dev/tools/build-sample-data.php -- --ce-source="<path_to_your_magento_instance>"` |
62 | 50 |
|
63 |
| -## Console Installation |
| 51 | +## Install Sample Data |
| 52 | +Once the sample data is deployed, it will be installed automatically when you install or upgrade your Magento instance either by using the Magento Setup Wizard or from the command line. |
64 | 53 |
|
65 |
| -Use Magento CLI installation command to install Magento as usual. |
| 54 | +## Uninstall Sample Data |
| 55 | +To remove the sample data modules from the code base, run one of the following commands from the Magento root directory: |
66 | 56 |
|
67 |
| -# Uninstalling |
| 57 | +* If sample data was deployed from the composer repository, run: `# bin/magento sampledata:remove` |
| 58 | +* If sample data was deployed from the GitHub repository and linked to your Magento instance, run: |
| 59 | +`# php -f <sample-data_clone_dir>/dev/tools/build-sample-data.php – --command=unlink --ce-source="<path_to_your_magento_instance>"` |
68 | 60 |
|
69 |
| -There is CLI command which allows to remove all sample data modules from Magento (only for case when sample data was installed via composer): |
| 61 | +To delete all the products and other entities provided by the sample data modules, delete the database and reinstall Magento with a clean database. |
70 | 62 |
|
71 |
| -``` |
72 |
| -# bin/magento sampledata:remove |
73 |
| -``` |
| 63 | +## Reinstall Sample Data |
| 64 | +If you have deleted certain entities provided by sample data and want to restore them, take the following steps: |
74 | 65 |
|
75 |
| -# Re-installation |
| 66 | +1. From the Magento root directory, run the following command: `# bin/magento sampledata:reset` |
| 67 | +2. Upgrade Magento as usual. |
76 | 68 |
|
77 |
| -To prepare sample data for re installation process run: |
78 |
| - |
79 |
| -``` |
80 |
| -# bin/magento sampledata:reset |
81 |
| -``` |
| 69 | +The deleted sample data entities will be restored. Those entities, which were changed, will preserve these changes and will not be restored to the default view. |
82 | 70 |
|
83 |
| -Then install or upgrade Magento as usual |
| 71 | +## Documentation |
| 72 | +You can find the more detailed description of sample data manipulation procedures at [http://devdocs.magento.com/guides/v2.0/install-gde/install/cli/install-cli-sample-data.html](http://devdocs.magento.com/guides/v2.0/install-gde/install/cli/install-cli-sample-data.html) |
0 commit comments