承接 barbieswimcrew/sw6-ux-plugin 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

barbieswimcrew/sw6-ux-plugin

最新稳定版本:v1.0.1

Composer 安装命令:

composer require barbieswimcrew/sw6-ux-plugin

包简介

Example for the use of symfony/ux twig components in Shopware6 plugin scope

README 文档

README

Example for the use of symfony/ux Twig Components in Shopware6 plugin scope

🚀 How to install

This repository delivers a sample plugin for your Shopware 6 project to show you how to use Symfony UX Twig Components to get data into the Shopware 6 storefront.

Composer install (recommended)

composer require barbieswimcrew/sw6-ux-plugin
bin/console plugin:refresh
bin/console plugin:install --activate MyPlugin

Registering the TwigComponentBundle

By requiring the barbieswimcrew/sw-6-ux-plugin via composer the symfony/ux-twig-component dependency has been added, too.

This package is an ordinary Symfony bundle. Thus, we need to add the TwigComponentBundle manually to the list of bundles defined in config/bundles.php which you'll find in your project's root directory.

Just add the following line to the array of registered bundles:

// config/bundles.php

<?php declare(strict_types=1);
$bundles = [
  ...
  Symfony\UX\TwigComponent\TwigComponentBundle::class => ['all' => true]
];
...

👨‍💻 Just have a look

Installation process might be done. Great! After refreshing the storefront in your browser window you should see an additional text output in the footer section which looks like this:

This shop offers you 15 products

And this is what the plugin actually does:

  • Register a custom Shopware 6 plugin
  • Register a so-called Twig Component ProductCountComponent which outputs the number of all active products in the database
  • Extending the storefront/layoutfooter/footer.html.twig file and call the Twig Component via {{ component('product-count', {'context': context}) }}

But why this example?

This example is inspired by the official Shopware 6 docs on how to Add data to storefront page.

As you might see, the lines of code in this example are much less than in the Shopware docs "how to".

In contrast to the Shopware example, the Twig Component implemented here can be used anywhere in the storefront because there are no dependencies on specific events, pagelets or API routes.

Wanna find out more about Symfony UX Twig Components?

Please check out the official Symfony docs about Twig Components under https://symfony.com/bundles/ux-twig-component/current/index.html

👷‍ Contribution

Please help with code, love, shares, feedback and bug reporting.

⚖️ Licence

This plugin is licensed under the MIT licence.

统计信息

  • 总下载量: 85
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-09-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固