brille24/sylius-tierprice-plugin 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

brille24/sylius-tierprice-plugin

Composer 安装命令:

composer require brille24/sylius-tierprice-plugin

包简介

A plugin that allows to add tierprices to Sylius

README 文档

README

Sylius Tier Price Plugin

Build Status

This plugin adds tier pricing to Sylius one product has different prices based on the quantity.

Installation

  • Install the bundle via composer composer require brille24/sylius-tierprice-plugin
  • Register the bundle in your bundles.php:
return [
    //...

    Brille24\SyliusTierPricePlugin\Brille24SyliusTierPricePlugin::class => ['all' => true],
];
  • Add the config.yaml to your local config/config.yaml
imports:
    ...
    - { resource: '@Brille24SyliusTierPricePlugin/config/config.yaml'}
  • For API functionality add the bundle's routes.yml to the local app/config/routes.yml
...
brille24_tierprice_bundle:
    resource: '@Brille24SyliusTierPricePlugin/config/routes.yml'
  • Go into your ProductVariant class and add the following trait and add one method call to the constructor
class ProductVariant extends BaseProductVariant implements \Brille24\SyliusTierPricePlugin\Entity\ProductVariantInterface
{
    use \Brille24\SyliusTierPricePlugin\Traits\TierPriceableTrait;

    public function __construct() {
        parent::__construct(); // Your constructor here

        $this->initTierPriceableTrait(); // "Constructor" of the trait
    }

    protected function createTranslation(): ProductVariantTranslationInterface
    {
        return new ProductVariantTranslation();
    }
}
  • Finally update the database, install the assets and update the translations:
bin/console doctrine:schema:update --force
bin/console assets:install
bin/console translation:update <locale> --force

Integration

  • This bundle decorates the sylius.calculator.product_variant_price service. If you wish to change that, you could register a compiler pass.
  • This bundle decorates the sylius.order_processing.order_prices_recalculator service. If you wish to use your own order processor or change its priority, you could register a compiler pass.

Usage

First of all you have to set up a product with as many variants as you want. Then in each of these variants you can set the tier pricing based on the channels. The table automatically sorts itself to provide a better overview for all different tiers, you configured.

In the frontend the user will see a nice looking table right next to the "add to cart" button that shows the discount for the different tiers like so:

Creating data

You can easily create the tier prices with fixtures like that.

sylius_fixtures:
    suites:
        my_suite:
            fixtures:
                tier_prices:
                    options:
                        custom:
                            - product_variant: "20125148-54ca-3f05-875f-5524f95aa85b"
                              channel: US_WEB
                              quantity: 10
                              price: 5

For this the products need to be created first and the product variant must also exist.

brille24/sylius-tierprice-plugin 适用场景与选型建议

brille24/sylius-tierprice-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 179.75k 次下载、GitHub Stars 达 47, 最近一次更新时间为 2018 年 04 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 brille24/sylius-tierprice-plugin 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 179.75k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 47
  • 点击次数: 7
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 47
  • Watchers: 3
  • Forks: 38
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-04-06