dynamic/silverstripe-foxy-discounts
Composer 安装命令:
composer require dynamic/silverstripe-foxy-discounts
包简介
Offer discounts on purchase conditions for your Foxy products.
关键字:
README 文档
README
Offer discounts on purchase conditions for your Foxy products.
Requirements
- SilverStripe ^4.0
- SilverStripe Foxy ^1.0
Installation
composer require dynamic/silverstripe-foxy-discounts
License
See License
Example configuration
Add the following extensions to your product classes:
Dynamic\Products\Page\Product: extensions: - Dynamic\Foxy\Discounts\Extension\ProductDataExtension PageController: extensions: - Dynamic\Foxy\Discounts\Extension\PageControllerExtension
Advanced Usage
You can limit discounts based on Product restrictions. The example below would add a "Discount only these products" and "These products should be excluded from the discount" type of logic:
note: This example has additional requirements such as GridFieldExtension be installed
<? namespace { use SilverStripe\ORM\DataExtension; use Dynamic\Products\Page\Product; class DiscountDataExtension extends DataExtension { /** * @var array */ private static $many_many = [ 'Products' => Product::class, 'ExcludeProducts' => Product::class, ]; /** * @param FieldList $fields */ public function updateCMSFields(FieldList $fields) { if ($this->owner->ID) { // Products $field = $fields->dataFieldByName('Products'); $fields->removeByName('Products'); $fields->addFieldToTab('Root.Included', $field); $field->setDescription('Limit the discount to these products. If no products specified, all products will receive the discount'); $config = $field->getConfig(); $config ->removeComponentsByType([ GridFieldAddExistingAutocompleter::class, GridFieldAddNewButton::class, GridFieldArchiveAction::class, ]) ->addComponents([ new GridFieldAddExistingSearchButton(), ]); $exclusions = $fields->dataFieldByName('ExcludeProducts'); $fields->removeByName('ExcludeProducts'); $fields->addFieldToTab('Root.Excluded', $exclusions); $exclusions->setDescription('Products in this list will ALWAYS be excluded from the discount, even if added to the "Included" tab.'); $excludeConfig = $exclusions->getConfig(); $excludeConfig ->removeComponentsByType([ GridFieldAddExistingAutocompleter::class, GridFieldAddNewButton::class, GridFieldArchiveAction::class, ]) ->addComponents([ new GridFieldAddExistingSearchButton(), ]); } } /** * @return array */ public function getRestrictions() { if ($this->owner->Products()->count() == 0) { $products = Product::get()->column(); } else { $products = $this->owner->Products()->column(); } foreach ($this->owner->ExcludeProducts()->column() as $id) { if (in_array($id, $products)) { $key = array_search($id, $products); unset($products[$key]); } } return $products; } } }
And apply to Discount in foxy.yml:
Dynamic\Foxy\Discounts\Model\Discount: extensions: - DiscountDataExtension
Maintainers
Bugtracker
Bugs are tracked in the issues section of this repository. Before submitting an issue please read over existing issues to ensure yours is unique.
If the issue does look like a new bug:
- Create a new issue
- Describe the steps required to reproduce your issue, and the expected outcome. Unit tests, screenshots and screencasts can help here.
- Describe your environment as detailed as possible: SilverStripe version, Browser, PHP version, Operating System, any installed SilverStripe modules.
Please report security issues to the module maintainers directly. Please don't file security issues in the bugtracker.
Development and contribution
If you would like to make contributions to the module please ensure you raise a pull request and discuss with the module maintainers.
dynamic/silverstripe-foxy-discounts 适用场景与选型建议
dynamic/silverstripe-foxy-discounts 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 561 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 10 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cms」 「silverstripe」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 dynamic/silverstripe-foxy-discounts 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dynamic/silverstripe-foxy-discounts 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 dynamic/silverstripe-foxy-discounts 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
GraphQL authentication for your headless Craft CMS applications.
Set Links with a specific language parameter
Supercharged text field validation.
Analytics chooser extensions for site settings.
Integrate with Snipcart.
统计信息
- 总下载量: 561
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2019-10-30