Skip to content

Commit ae29b7f

Browse files
committed
Merge branch 'develop' of github.corp.ebay.com:magento2/sample-data into VM
2 parents 5495e0c + c5a5e07 commit ae29b7f

File tree

1,134 files changed

+8671
-14291
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,134 files changed

+8671
-14291
lines changed

README.md

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,83 @@
1-
#Introduction
1+
# Introduction
22

33
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.
44

55
Installing sample data is optional; you can install it before or after you install the Magento software.
66

7-
#Deployment
7+
# Deployment
88

9-
##From Composer
10-
To deploy sample data from Composer, use:
9+
Deployment of Sample Data can be performed in three ways: using Magento CLI, composer and from GitHub repository.
1110

12-
1. In your composer.json, specify the following:
13-
- repository:
14-
```
15-
{
16-
"repositories": [
17-
{
18-
"type": "composer",
19-
"url": "http://packages.magento.com/"
20-
}
21-
],
22-
}
23-
```
11+
## Using CLI
2412

25-
- packages:
26-
```
27-
{
28-
"require": {
29-
"magento/sample-data": "{version}"
30-
}
31-
}
32-
```
33-
34-
where version is either an exact version or semantic version syntax.
35-
2. From your Magento root directory, run composer update.
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:
3614

37-
##From repository
38-
To deploy sample data from repository, use:
39-
40-
1. Clone the sample data repository. For example, git clone [https://github.com/magento/magento2-sample-data.git](https://github.com/magento/magento2-sample-data.git)
41-
2. Link the sample data repository with your Magento CE repository as follows:
42-
```
43-
php -f <sample-data-root>/dev/tools/build-sample-data.php -- --ce-source="path/to/magento/ce/edition"
44-
```
15+
```
16+
# bin/magento sampledata:deploy
17+
```
4518

46-
#Installation
19+
CLI command collects suggest node from composer.json files of modules which suggest to install sample data:
4720

48-
Once deployed, the sample data can be installed using the Magento Setup Wizard (web installation) or using CLI (console installation).
21+
```
22+
"suggest": {
23+
"magento/module-catalog-sample-data": "Sample Data version:1.0.0-beta"
24+
}
25+
```
4926

50-
###Web Installation
27+
## Using Composer
5128

52-
When installing the Magento application using the Magento Setup Wizard, you can choose to install the sample data at Step 4. Customize Your Store by selecting the *Use Sample Data* check box.
29+
Also it's possible to add needed sample data modules manually (via composer require or editing main composer.json file)
5330

54-
###Console Installation
31+
1. Specify packages
32+
```
33+
{
34+
"require": {
35+
...
36+
"magento/module-catalog-sample-data": "{version}",
37+
"magento/module-configurable-sample-data": "{version}",
38+
"magento/module-cms-sample-data": "{version}",
39+
"magento/module-sales-sample-data": "{version}"
40+
....
41+
}
42+
}
43+
{version} - Go to packages.magento.com and write down suitable versions of magento/sample-data and magento/sample-data-media (typically, you should choose the most recent version).
44+
```
45+
2. Run composer update from your Magento root directory
5546

56-
The steps required to install sample data are different depending on whether the Magento application itself is installed:
47+
## From GitHub Repository
5748

58-
- If the Magento application is not installed, you can install it with sample data at once. Use the following code sample as an example:
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
5951
```
60-
php -f index.php install --base-url=http://localhost/magento2/ \
61-
--backend-frontname=admin \
62-
--db-host=localhost --db-name=magento --db-user=magento --db-password=magento \
63-
--admin-firstname=Magento --admin-lastname=User --admin-email=[email protected] \
64-
--admin-user=admin --admin-password=iamtheadmin --language=en_US \
65-
--currency=USD --timezone=America/Chicago
66-
--use-sample-data
52+
php -f <sample-data-ce-root>/dev/tools/build-sample-data.php -- --ce-source="path/to/magento/ce/edition"
6753
```
68-
- If the Magento application is already installed, to install the sample data, enter the following commands in the order shown:
54+
55+
# Installing
56+
57+
Being once deployed the Sample Data is available for installation through the Magento Setup Wizard or using CLI.
58+
59+
## Web Installation
60+
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
62+
63+
## Console Installation
64+
65+
Use Magento CLI installation command to install Magento as usual.
66+
67+
# Uninstalling
68+
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):
70+
6971
```
70-
<path to Magento 2 bin dir>/magento setup:upgrade
71-
<path to Magento 2 bin dir>/magento sampledata:install <your Magento administrator user name>
72+
# bin/magento sampledata:remove
7273
```
7374

74-
For example,
75+
# Re-installation
76+
77+
To prepare sample data for re installation process run:
78+
7579
```
76-
/var/www/magento2/bin/magento setup:upgrade
77-
/var/www/magento2/bin/magento sampledata:install admin
80+
# bin/magento sampledata:reset
7881
```
7982

80-
#Removing Sample Data
81-
82-
There are no special scripts that assist in uninstalling of sample data.
83-
To remove sample data, you must delete the database and re-install Magento with a new empty database
83+
Then install or upgrade Magento as usual
File renamed without changes.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
Academic Free License ("AFL") v. 3.0
3+
4+
This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
5+
6+
Licensed under the Academic Free License version 3.0
7+
8+
1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
9+
10+
1. to reproduce the Original Work in copies, either alone or as part of a collective work;
11+
12+
2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
13+
14+
3. to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License;
15+
16+
4. to perform the Original Work publicly; and
17+
18+
5. to display the Original Work publicly.
19+
20+
2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
21+
22+
3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
23+
24+
4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
25+
26+
5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
27+
28+
6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
29+
30+
7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
31+
32+
8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
33+
34+
9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
35+
36+
10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
37+
38+
11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
39+
40+
12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
41+
42+
13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
43+
44+
14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
45+
46+
15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
47+
48+
16. Modification of This License. This License is Copyright � 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\BundleSampleData\Model;
7+
8+
use Magento\Framework\Setup\SampleData\Context as SampleDataContext;
9+
10+
/**
11+
* Setup bundle product
12+
*/
13+
class Product extends \Magento\CatalogSampleData\Model\Product
14+
{
15+
/**
16+
* @var string
17+
*/
18+
protected $productType = \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE;
19+
20+
/**
21+
* @param SampleDataContext $sampleDataContext
22+
* @param \Magento\Catalog\Model\ProductFactory $productFactory
23+
* @param \Magento\Catalog\Model\ConfigFactory $catalogConfig
24+
* @param Product\Converter $converter
25+
* @param \Magento\CatalogSampleData\Model\Product\Gallery $gallery
26+
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
27+
*/
28+
public function __construct(
29+
SampleDataContext $sampleDataContext,
30+
\Magento\Catalog\Model\ProductFactory $productFactory,
31+
\Magento\Catalog\Model\ConfigFactory $catalogConfig,
32+
\Magento\BundleSampleData\Model\Product\Converter $converter,
33+
\Magento\CatalogSampleData\Model\Product\Gallery $gallery,
34+
\Magento\Store\Model\StoreManagerInterface $storeManager
35+
) {
36+
parent::__construct(
37+
$sampleDataContext,
38+
$productFactory,
39+
$catalogConfig,
40+
$converter,
41+
$gallery,
42+
$storeManager
43+
);
44+
}
45+
46+
/**
47+
* @inheritdoc
48+
*/
49+
protected function prepareProduct($product, $data)
50+
{
51+
$product
52+
->setCanSaveConfigurableAttributes(true)
53+
->setCanSaveBundleSelections(true)
54+
->setPriceType(0);
55+
56+
return $this;
57+
}
58+
}

app/code/Magento/SampleData/Module/Bundle/Setup/Product/Converter.php renamed to app/code/Magento/BundleSampleData/Model/Product/Converter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
namespace Magento\SampleData\Module\Bundle\Setup\Product;
7+
namespace Magento\BundleSampleData\Model\Product;
88

99
/**
1010
* Convert data for bundle product
1111
*/
12-
class Converter extends \Magento\SampleData\Module\Catalog\Setup\Product\Converter
12+
class Converter extends \Magento\CatalogSampleData\Model\Product\Converter
1313
{
1414
/**
1515
* Convert CSV format row to array
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Magento_BundleSampleData module consists of installation scripts and fixtures.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\BundleSampleData\Setup;
8+
9+
use Magento\Framework\Setup;
10+
11+
class InstallData implements Setup\InstallDataInterface
12+
{
13+
/**
14+
* @var Setup\SampleData\Executor
15+
*/
16+
protected $executor;
17+
18+
/**
19+
* @var Installer
20+
*/
21+
protected $installer;
22+
23+
public function __construct(Setup\SampleData\Executor $executor, Installer $installer)
24+
{
25+
$this->executor = $executor;
26+
$this->installer = $installer;
27+
}
28+
29+
/**
30+
* {@inheritdoc}
31+
*/
32+
public function install(Setup\ModuleDataSetupInterface $setup, Setup\ModuleContextInterface $moduleContext)
33+
{
34+
$this->executor->exec($this->installer);
35+
}
36+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\BundleSampleData\Setup;
7+
8+
use Magento\Framework\Setup;
9+
10+
/**
11+
* Launches setup of sample data for Bundle module
12+
*/
13+
class Installer implements Setup\SampleData\InstallerInterface
14+
{
15+
/**
16+
* Setup class for bundle products
17+
*
18+
* @var \Magento\BundleSampleData\Model\Product
19+
*/
20+
protected $bundleProduct;
21+
22+
/**
23+
* @param \Magento\BundleSampleData\Model\Product $bundleProduct
24+
*/
25+
public function __construct(
26+
\Magento\BundleSampleData\Model\Product $bundleProduct
27+
) {
28+
$this->bundleProduct = $bundleProduct;
29+
}
30+
31+
/**
32+
* {@inheritdoc}
33+
*/
34+
public function install()
35+
{
36+
$this->bundleProduct->install(
37+
['Magento_BundleSampleData::fixtures/yoga_bundle.csv'],
38+
['Magento_BundleSampleData::fixtures/images_yoga_bundle.csv']
39+
);
40+
}
41+
}

0 commit comments

Comments
 (0)