承接 sherlockode/sylius-wishlist-bundle 相关项目开发

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

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

sherlockode/sylius-wishlist-bundle

Composer 安装命令:

composer require sherlockode/sylius-wishlist-bundle

包简介

Wishlist bundle for Sylius e-commerce platform.

README 文档

README

This bundle adds wishlist functionality to Sylius e-commerce platform. It can be configured to use single or multiple wishlists per user, which can be public or private.

Installation

  1. require the bundle with Composer:
$ composer require sherlockode/sylius-wishlist-bundle
  1. enable the bundle in app/AppKernel.php:
public function registerBundles()
{
  $bundles = [
    // ...
    new \Sherlockode\Sylius\WishlistBundle\SherlockodeSyliusWishlistBundle(),
    // ...
  ];
}
  1. add configuration to the top of app/config/config.yml:
imports:
    - { resource: "@SherlockodeSyliusWishlistBundle/Resources/config/config.yml" }

Among other things, this provides configuration entries which can then be overriden in your app's config.yml.

sherlockode_sylius_wishlist:
    multiple: true           # multiple wishlist mode
    default_public: false    # used for automatically created wishlists
  1. register routes in app/config/routing.yml
sherlockode_wishlist:
  resource: "@SherlockodeSyliusWishlistBundle/Resources/config/routing.yml"

sherlockode_wishlist_front:
  resource: "@SherlockodeSyliusWishlistBundle/Resources/config/routingFront.yml"
  prefix: /wishlist

sherlockode_wishlist_account:
  resource: "@SherlockodeSyliusWishlistBundle/Resources/config/routingAccount.yml"
  prefix: /account/wishlists

As you can see, there are three groups of routes, the main resource (administration) routes, frontend routes, and user account routes where the user can manage their wishlist(s), create new ones, mark them public/private, etc...

  1. The bundle should now be fully integrated, but it still requires database tables to be created. For this, we recommend using migrations.
$ bin/console doctrine:migrations:diff
$ bin/console doctrine:migrations:migrate

Or if you don't use migrations, you can update the database schema directly.

  $ bin/console doctrine:schema:update
  1. If you're integrating this bundle into an existing project, your existing users will not have any wishlists associated. This is not an issue as wishlists are automatically created when needed. All new users will automatically have a wishlist created for them from the start.

If you want to make sure all your users have wishlists, you can run a command which will create initial wishlists for all existing users which do not already have one.

$ bin/console sherlockode:sylius-wishlist-bundle:create-initial

Integration on shop pages

Now that you've installed and integrated the bundle, the users can view their wishlists, create new ones, etc, depending on bundle configuration, but they still have no way of adding products to wishlists. Since each project will have custom product pages, this implementation is up to you. It can be done in two ways.

  1. Simple

Since 'add to wishlist' functionality is almost the same as adding items to cart, the simplest way to finalize integration is to add a new 'Add to wishlist' button next to the 'Add to cart' button in the existing form.

Open the template containing your 'add to cart' form, most likely in: app/Resources/SyliusShopBundle/Resources/views/Product/Show/_addToCart.html.twig

Find the 'add to cart' button, by default:

<button type="submit" class="ui huge primary icon labeled button"><i class="cart icon"></i> {{ 'sylius.ui.add_to_cart'|trans }}</button>

And under it, add the following line.

{% include '@SherlockodeSyliusWishlist/Frontend/Shop/_addToWishlist.html.twig' %}

This will include the 'Add to Wishlist' button, and all required functionality. It will also feature a dropdown if the user has more than one wishlist, to enable the user to select which wishlist they want to add the item to.

The dropdown will only be rendered if the user has more than one wishlist.

  1. Custom AJAX implementation

An alternative is to implement your own, fully custom 'add to wishlist' functionality. To accomplish this, submit data to the sherlockode_wishlist_frontend_add_item route.

$.ajax({
    url: '/wishlist/item/',
    type: 'POST',
    data: {
        productVariantId: 123,
        wishlistId: 456 // optional
    },
    success: // ...
});

You can also submit the data in the same format as in the first example (the 'add-to-cart' form), both examples use the same route, and both accept variant data to be resolved (first example), or an already resolved productVariantId.

Wishlist badge

You might also want to feature a badge in your header which links to the wishlist and shows the current number of items added, similar to the existing cart badge.

To do this, just add this line to the bottom of the same file app/Resources/SyliusShopBundle/Resources/views/Cart/_widget.html.twig

{% include '@SherlockodeSyliusWishlist/Frontend/Shop/_badge.html.twig' %}

Translations and naming

The bundle has multilingual support, and language files can be overridden as with any other bundle, by creating translation files in the app/Resources/SherlockodeSyliusWishlistBundle/translations directory.

To get started, check the bundle's main language file in: Resources/translations/messages.en.yml

License

This bundle is available under the MIT license.

To-do

  • Tests

sherlockode/sylius-wishlist-bundle 适用场景与选型建议

sherlockode/sylius-wishlist-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 290 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 03 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「symfony」 「sylius」 「wishlist」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 sherlockode/sylius-wishlist-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 sherlockode/sylius-wishlist-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 sherlockode/sylius-wishlist-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-22