标签: shopware6

通过 Shopware 6 API 添加图片

我有一个 Shopware 6.3 商店,需要使用集成 API 将图像迁移到它。

我应该如何为媒体上传构建一个主体?我需要将文件放在某处还是只传递链接?

我设法通过这里的指南将新产品推入 Shopware:https ://docs.shopware.com/en/shopware-platform-dev-en/admin-api-guide/writing-entities?category = shopware-platform-dev -en/admin-api-guide#creating-entities但我不确定如何处理媒体。在本指南中,仅解释了如何在已上传的媒体文件与此处的产品之间创建链接https://docs.shopware.com/en/shopware-platform-dev-en/admin-api-guide/writing-entities? category=shopware-platform-dev-en/admin-api-guide#media-handling但没有关于如何实际推送媒体文件的示例。

我有我需要的每个图像的 URL(在数据库中,以及产品 ID 和图像位置)。

实体模式将媒体描述为:

    "media": {
        "name": "media",
        "translatable": [
            "alt",
            "title",
            "customFields"
        ],
        "properties": {
            "id": {
                "type": "string",
                "format": "uuid"
            },
            "userId": {
                "type": "string",
                "format": "uuid"
            },
            "mediaFolderId": {
                "type": "string",
                "format": "uuid"
            },
            "mimeType": {
                "type": "string",
                "readOnly": true
            },
            "fileExtension": {
                "type": "string",
                "readOnly": true
            },
            "uploadedAt": {
                "type": "string",
                "format": "date-time",
                "readOnly": true
            },
            "fileName": …
Run Code Online (Sandbox Code Playgroud)

media api image shopware shopware6

1
推荐指数
2
解决办法
2359
查看次数

如何在 Shopware 6 Storefront Controller 或 Subscriber 中检查用户是否已登录?

我正在寻找如何检查用户是否在 Shopware 6 店面中登录的正确方法。我正在编写一个插件(不是应用程序),并且想在控制器和/或订阅者中使用它。

我是不是该:

  1. 使用店面 API?(但是如何?走哪条路?)
  2. 使用默认的symfony方式?(isGranted) - 但有哪些角色?难道角色处理不一样吗?
  3. 使用一些内置功能,例如我可以通过依赖注入获取的特殊服务(但是是哪一个?)?

解决方案:

感谢@Uwe Kleinmann,我找到了一个解决方案,可以在这样的订阅者中工作:

public static function getSubscribedEvents()
{
  return [
    ProductPageLoadedEvent::class => 'onProductPageLoaded'
  ];
}
    
public function onProductPageLoaded(ProductPageLoadedEvent $event): void
{
  $saleschannelContext = $event->getSaleschannelContext();
  $customer = $saleschannelContext->getCustomer();

  if(NULL === $customer) {
    $customer = 'not-logged-in';
  }

  $event->getPage()->addExtension(
    'myextension', new ArrayStruct([
      'test' => $customer
    ])
  );
}
Run Code Online (Sandbox Code Playgroud)

authentication storefront shopware shopware6

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

Shopware 6 - 如何保存购物车中的商品?

我希望我能帮助您解决在 Shopware 6 中遇到的有关将已删除的商品保存到购物车中的问题。

在我当前的实现中,我使用 CartProcessorInterface 并在收集函数中添加行项目。但是,我遇到了一个问题,如果用户从购物车中删除这些商品,它们会在页面重新加载或购物车重新加载时重新添加。

我渴望找到一种解决方案来防止用户删除这些项目后再次添加它们。是否有一种方法或途径来存储商品已从购物车中删除且不应再次添加的信息?

预先感谢您的帮助!

cart shopware shopware6

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

如何将自定义订单状态添加到商店 6

对于 shopware 6,我想向核心添加一些自定义订单状态。

使用 DAL 我设法在激活我的插件时添加这些,但现在在管理中无法选择。所以我无法将订单更改为这个新的自定义状态。

谁能帮我选择这个状态?

symfony shopware shopware6

0
推荐指数
1
解决办法
631
查看次数

无法使用 npm 8.11 构建 Shopware 6 admin

运行时bin/build-administration.sh我们得到

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: eslint-config-airbnb-base@13.2.0
npm ERR! Found: eslint@7.10.0
npm ERR! node_modules/eslint
npm ERR!   dev eslint@"7.10.0" from the root project
npm ERR!   peer eslint@"^6.0.0 || ^7.0.0 || ^8.0.0" from @typescript-eslint/eslint-plugin@5.1.0
npm ERR!   node_modules/@typescript-eslint/eslint-plugin
npm ERR!     @typescript-eslint/eslint-plugin@"5.1.0" from the root project
npm ERR!   14 more (@typescript-eslint/experimental-utils, eslint-utils, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@"^4.19.1 || ^5.3.0" from eslint-config-airbnb-base@13.2.0
npm ERR! …
Run Code Online (Sandbox Code Playgroud)

npm eslint shopware6

0
推荐指数
1
解决办法
877
查看次数

Shopware 6 应用程序 - 覆盖 .../storefront/page/product-detail/buy-widget.html.twig

当我尝试覆盖 buy-widget.html.twig 文件时。Shopware 什么也不做。只有索引覆盖有效。但不是子文件。我的代码是:

{% sw_extends '@Storefront/storefront/page/product-detail/buy-widget.html.twig' %}


{% block page_product_detail_buy_form %}
    <h1 style="background: green;">Test</h1>
{% endblock %}

Run Code Online (Sandbox Code Playgroud)

为什么这不起作用?

shopware6 shopware6-app

0
推荐指数
1
解决办法
125
查看次数

Shopware 6:顾客添加到愿望清单中的商品可以保存多长时间?

顾客添加到愿望清单中的商品可以保存多长时间?

我希望我的客户能得到简短的答复。愿望清单存储多长时间,甚至在缓存中保存多长时间

shopware6

0
推荐指数
1
解决办法
132
查看次数

如何在 Shopware 6.4.x 的开始/索引页面上放置/插入横幅/图像?

我需要在 Shopware 6.4.20.0 商店的起始页上放置/插入横幅图像,但我找不到如何执行此操作的说明

在商店软件常见问题解答中,我只找到了商店软件 5 的描述 另一种描述说转到营销 >> 横幅,但商店软件 6 中不存在横幅链接

我使用的是免费版本

是否可以通过免费插件、脚本或来自 cms 来实现?

banner shopware6

0
推荐指数
1
解决办法
136
查看次数

插件配置中媒体组件的 Z-Index 问题

插件配置中的媒体组件存在一些 z-index 问题。

在此输入图像描述

错误/功能?

似乎是商店软件的错误。

shopware shopware6

-1
推荐指数
1
解决办法
63
查看次数