当我安装 magento2 时,我无法安装示例数据,“使用示例数据”被禁用。我无法安装示例数据。我该如何解决?
注意:我能够在没有示例数据的情况下安装 magento2。
在文档http://devdocs.magento.com/guides/v2.0/install-gde/install/composer-clone.html中有一个框说
We're aware of issues with installing optional sample data after cloning the develop branch. If you plan to use sample data, clone the master branch.
您可以点击此处的链接了解问题:http ://devdocs.magento.com/guides/v2.0/install-gde/trouble/tshoot_sample-data.html
然后抓取master分支,
您可能对示例数据有更好的运气:http: //devdocs.magento.com/guides/v2.0/install-gde/install/sample-data.htm
您可以在 magento 设置之后或之前安装 magento 示例数据。
请按照本教程中的步骤进行操作。这是工作。
当您按照步骤并在 magento 设置之前完成安装 magento 示例数据时,magento 'Use Sample Data' 将为您启用。如果您已经安装了没有示例数据的 magento,您也可以在安装 magento 之后安装示例数据。
您可以通过命令行安装示例数据:
php <your Magento install dir>/bin/magento sampledata:deploy
- 使用作曲家下载 Magento 项目
composer create-project --repository-url=https://repo.magento.com/magento/project-community-edition=2.4.0
- 使用命令安装 Magento 2
php bin/magento setup:install --base-url="http://localhost/magento240" --db-host="localhost" --db-name=magento240_db --db-user=root --db-password =admin --admin-firstname="Admin" --admin-lastname="Magento" --admin-email="admin@gmail.com" --admin-user="admin" --admin-password="admin @123" --use-rewrites="1" --backend-frontname="admin"
安装示例数据模块:
composer.json
项: composer require magento/module-bundle-sample-data magento/module-widget-sample-data magento/module-theme-sample-data magento/module-catalog-sample-data magento/module-customer-sample -data magento/module-cms-sample-data magento/module-catalog-rule-sample-data magento/module-sales-rule-sample-data magento/module-review-sample-data magento/module-tax-sample-数据 magento/module-sales-sample-data magento/module-grouped-product-sample-data magento/module-downloadable-sample-data magento/module-msrp-sample-data magento/module-configurable-sample-data magento/模块产品链接样本数据 magento/模块愿望清单样本数据 magento/模块样本数据样本数据 magento/样本数据媒体 magento/模块离线航运样本数据 --no-update您现在可以在安装软件之前或之后安装 Magento 2 示例数据,使用主(更稳定)或开发(更新)分支。如果您使用设置向导,则不再有使用示例数据复选框。
请注意,通过 GA,还将有一个命令行安装选项。
步骤总结:
如果 Magento 已经安装,运行:
php /bin/magento 设置:升级
参考:http ://devdocs.magento.com/guides/v2.0/install-gde/install/web/install-web-sample-data.html
只需使用
<php -dmemory_limit=6G /bin/magento sampledata:deploy>
命令,然后升级和设置静态内容。不要忘记刷新缓存
对于示例数据,创建一个新数据库。在设置 magento 之前,首先从这里下载“magento-sample-data-1.6.0.0.tar.gz”文件http://inchoo.net/magento/magento-sample-data/
解压它会有一个sql文件。将其从 phpmyadmin 或终端导入到您新创建的数据库中。还将 media/catalog 文件夹复制到您的 magento 的媒体中
然后使用相同的数据库名称安装 magento。
在 Magento 设置后安装示例数据。使用此命令安装示例数据
php bin/magento sampledata:deploy
此处系统将需要您的 magento.com 的用户名和密码。使用您的 magento 存储公钥和私钥作为用户名和密码。比运行这个命令
php bin/magento setup:upgrade
比运行这个命令
php bin/magento setup:static-content:deploy -f