标签: shopware6

shopware 6 插件的单元测试未找到自定义服务

我编写了一个插件,现在我想在其中创建测试。我按照官方文档并根据我的开发环境更改了 phpunit.xml.dist 。

测试正在运行,但容器不知道我的自定义定义/存储库。是不是我设置错了什么?

我尝试在标准 Dockware 容器上运行它。

phpunit.xml.dist

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/7.1/phpunit.xsd"
         colors="true"
         bootstrap="../../../vendor/shopware/core/TestBootstrap.php"
         cacheResult="false">

    <php>
        <ini name="error_reporting" value="-1"/>
        <server name="KERNEL_CLASS" value="Shopware\Production\Kernel"/>
        <env name="APP_ENV" value="test"/>
        <env name="APP_DEBUG" value="1"/>
        <env name="APP_SECRET" value="*"/>
        <env name="SHELL_VERBOSITY" value="-1"/>
    </php>

    <testsuites>
        <testsuite name="base">
            <directory>src/Test</directory>
        </testsuite>
        <testsuite name="employee">
            <directory>src/Components/Employee/Test</directory>
        </testsuite>
    </testsuites>

    <filter>
        <whitelist>
            <directory suffix=".php">./</directory>
        </whitelist>
    </filter>
</phpunit>
Run Code Online (Sandbox Code Playgroud)

错误:

$ bash ./bin/phpunit.sh 
PHPUnit 9.5.9 by Sebastian Bergmann and contributors.

Warning:       Your XML configuration validates against a deprecated schema.
Suggestion:    Migrate your XML configuration using …
Run Code Online (Sandbox Code Playgroud)

shopware shopware6

5
推荐指数
1
解决办法
1154
查看次数

将LogLevel设置为DEBUG而不设置APP_ENV进行调试

我需要在解决迁移中的问题时获得详细的日志记录。如果我像Shopware 6 教程APP_ENV中描述的那样设置调试,我会一直遇到内存问题,因为 Symfony 框架也会启用调试模式并导致巨大的内存消耗。这是运行迁移工具时的一个已知问题。

如何将记录器设置为更详细的日志记录级别,而不将整个堆栈设置为调试模式?

shopware shopware6

5
推荐指数
1
解决办法
941
查看次数

我如何知道在 shopware 6 商店 API 端点中可用的关联

我正在将 Shopware 6store-api用于我的无头应用程序。但我无法弄清楚 Shopware 中提供了哪些关联,store-api 例如:

  1. 我打电话store-api/account/customer但也想要例如最后的订单。

  2. 我打电话store-api/login,还想要客户的详细信息(如姓名、电子邮件等)。

  3. 我打电话store-api/seo-urls。如果routeName是的话frontend.detail.page我想获取产品详细信息

这可以在一次 api 调用中实现吗?或者我是否需要使用响应数据发出另一个请求?我将来如何检查这一点?

shopware shopware6

5
推荐指数
1
解决办法
1251
查看次数

Shopware 6 Docker Setup 添加 PHPMyAdmin

我完全是 Shopware 的初学者,我想将 PhpMyAdmin 用于我本地的 Shopware 6 设置。

对于下载,我使用了官方 Shopware 6 Development 存储库https://github.com/shopware/development

我已经看到 docker-compose.yml 已经实现了以下内容:

app_mysql:
    build: dev-ops/docker/containers/mysql
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USER: app
      MYSQL_PASSWORD: app
    networks:
      shopware:
        aliases:
          - mysql
Run Code Online (Sandbox Code Playgroud)

现在我想实现phpmyadmin。我尝试了以下方法:

phpmyadmin:
      image: phpmyadmin/phpmyadmin
      links:
          - app_mysql:mysql
      depends_on:
          - app_mysql
      ports:
          - 8181:80
      environment:
          PMA_HOST: app_mysql
          MYSQL_ROOT_PASSWORD: root
          MYSQL_USER: app
          MYSQL_PASSWORD: app
Run Code Online (Sandbox Code Playgroud)

phpmyadmin 在 localhost:8181 上可见,但是当我尝试登录时出现以下错误:

mysqli::real_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known mysqli::real_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known

我该如何解决?

phpmyadmin e-commerce docker shopware shopware6

4
推荐指数
1
解决办法
681
查看次数

来自数据库/MySQL 的 Shopware 6 媒体文件路径

在 Shopware 6 数据库的“media”表中,没有文件位置列。只有 file_name、file_extension 和 file_size。但没有file_path。

Shopware 必须以某种方式将信息从数据库转换为文件位置,以生成类似“public/media/8f/25/74/1653530151/242178_0569-1.jpg”的文件路径。

Shopware如何生成文件路径?有没有办法通过MySQL查询生成文件路径?

MySQL [dev]> select * from media where file_name='242178_0569-1'\G
*************************** 1. row ***************************
             id: 0191b9f8e7634a15a4e494d1206f797f
        user_id: NULL
media_folder_id: d798f70b69f047c68810c45744b43d6f
      mime_type: image/jpeg
 file_extension: jpg
      file_size: 2161002
      meta_data: {"hash": "7b082f5a1a79e2dd0f39a2c8c1062a1c", "type": 2, "width": 1300, "height": 1300}
      file_name: 242178_0569-1
     media_type: ...
  thumbnails_ro: ...
        private: 0
    uploaded_at: 2022-05-26 01:55:51.920
     created_at: 2022-05-26 01:55:51.401
     updated_at: 2022-05-26 01:55:54.428
Run Code Online (Sandbox Code Playgroud)

shopware shopware6

4
推荐指数
1
解决办法
2081
查看次数

禁用 Shopware 管理通知工作人员

现在,管理通知工作人员每 5 秒发送一次请求。当使用像 xdebug 这样的调试器进行调试时,这非常烦人,因为请求会堆积起来。
有没有办法(也许通过配置)来禁用通知的获取?

shopware6

4
推荐指数
1
解决办法
418
查看次数

Shopware 6 删除供应商的特定文件

当我运行构建管理时,我在“调用报告服务进行单次检查”步骤中收到以下错误。

无法找到 '/var/www/vendor/store.shopware.com/netinexteasycoupondesigns/src/Resources/app/administration/static/**/*' glob 时出现错误

插件供应商建议删除src/Resources/app插件源文件内的路径。由于它们是通过作曲家安装的,因此我无法在生产或其他环境中永久删除这些文件。

我怎样才能坚持这些改变?用作曲家补丁,还是有其他方法?

shopware shopware6

4
推荐指数
1
解决办法
664
查看次数

从shopware5迁移到shopware6时日志中出现SWAG_MIGRATION_RUN_EXCEPTION

PHP 版本: 8.1

商店软件版本: 6.4.13

预期行为: 数据迁移成功并在后端/前端可见。

实际行为: 迁移的数据在后端/前端中似乎不可见,并且日志中存在错误。

如何重现: 我正在尝试在虚拟环境中的本地开发环境中从带有演示数据的 shopware 5.7 迁移到 shopware 6.4。我已遵循网站 https://docs.shopware.com/en/migration-en/Migrationprocess?category=migration-en/shopware5中提到的所有说明 ,为此我使用了本地网关设置。

虽然迁移的状态是‘成功’。Shopware 6.4 后端看不到迁移的数据,并且迁移过程中的日志中存在错误。我附上了一份日志供参考。

错误日志:


[error] SWAG_MIGRATION_RUN_EXCEPTION
An exception occurred
Entity: language, sourceId: -
SwagMigrationAssistant\Migration\Logging\Log\ExceptionRunLog::__construct(): Argument #4 ($sourceId) must be of type ?string, int given, called in /var/www/webdev/shopware56/custom/plugins/SwagMigrationAssistant/Migration/Service/MigrationDataConverter.php on line 144

[error] SWAG_MIGRATION_RUN_EXCEPTION
An exception occurred
Entity: category, sourceId: -
SwagMigrationAssistant\Profile\Shopware\Converter\ShopwareConverter::getSourceIdentifier(): Return value must be of type string, int returned

[error] SWAG_MIGRATION_RUN_EXCEPTION
An exception occurred
Entity: customer_group, sourceId: -
SwagMigrationAssistant\Profile\Shopware\Converter\ShopwareConverter::getSourceIdentifier(): Return value …
Run Code Online (Sandbox Code Playgroud)

migration shopware6 shopware5

3
推荐指数
1
解决办法
604
查看次数

Shopware:有条件地取消将产品添加到购物车

我想实现一个进行外部 API 调用的功能,然后根据请求是否满足将产品线项目添加到购物车,否则它会向客户显示一条翻译后的闪存消息,表明无法添加产品出于 X 个原因加入购物车。

我尝试过的是订阅,BeforeLineItemAddedEvent但此时该订单项似乎已添加到购物车中,我不太确定如何实现闪存消息。

shopware shopware6 shopware6-api

3
推荐指数
1
解决办法
434
查看次数

如何在我的插件中可靠地使用 Showpare 6 商店插件中的服务而不会出现问题

我们已经通过 Composer 从 Shopware 6 商店安装了一个插件。对于我们自己的功能,我们希望使用插件中的服务。

由于 shopware 6 中的插件可以卸载和/或停用,因此我们无法可靠地使用我们自己的插件/捆绑包中 services.xml 中插件中的服务。如果商店插件仍然被卸载/未激活,我们会收到错误“服务“...”依赖于不存在的服务”。

这个例子说明了这种情况:


    <services>
        <service id="MyPlugin..." public="true">
            <!-- Service might be uninstalled/inactive. Conditional?-->
            <argument type="service" id="ThirdPartyPlugin"/>
        </service>
    </services>

Run Code Online (Sandbox Code Playgroud)

在 Shopware 中是否有任何最佳实践来处理这种情况?我们是否可以实现一个条件,即仅当第 3 方插件处于活动状态时才会定义我们的服务?

symfony shopware shopware6

3
推荐指数
1
解决办法
48
查看次数