定制 openbuildings/promotions 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

openbuildings/promotions

Composer 安装命令:

composer require openbuildings/promotions

包简介

Promotions for Purchases

README 文档

README

Build Status Scrutinizer Quality Score Code Coverage Latest Stable Version

This module gives the ability to define promotions with a set of requirements that add themselves to purchases, based on these rules. Each promotion can have a static or dynamic/configurable amount.

Promotions can also have ontime or multiple time uses for promo_codes

Usage

Add a behavior to the purchase and brand_purchase models:

class Model_Brand_Purchase extends Kohana_Model_Brand_Purchase {

	public static function initialize(Jam_Meta $meta)
	{
		parent::initialize($meta);

		$meta
			->behaviors(array(
				'promotable_brand_purchase' => Jam::behavior('promotable_brand_purchase'),
			));
	}
}
// ...
class Model_Purchase extends Kohana_Model_Purchase {

	public static function initialize(Jam_Meta $meta)
	{
		parent::initialize($meta);

		$meta
			->behaviors(array(
				'promotable_purchase' => Jam::behavior('promotable_purchase'),
			));
	}
}

And you'll need to add actual promotions to the database. The promtion modle uses single table inheritence to have a different class for each promotion. Each of these has to define "applies_to" and "price_for_purchase_item" which your promotions will have to implement. There is also the Model_Promotion_Promocode class which gives the promotion the ability to use promo codes which exhaust themselves when are used.

There are 2 availbale predefined promotions:

  • Model_Promotion_Promocode_Giftcard - to use it you'll need to enter requirement - the minimum price where the promotion applies, and amount - the amount (Jam_Price) to be reducted from the purchase
  • Model_Promotion_Promocode_Percent - get a static reduction of some percent (amount). Amount is a value from 0 to 1.

promo_code_text

The promotable_purchase behavior adds a promo_code_text field to the purchase (its not in the database). When you set a promocode to this field it would try to find it, and then run "validate_purchase" of the appropriate promotion, if found. If everything checks out, the promotion associated with this promocode will be added to the purchase.

License

Copyright (c) 2012-2013, OpenBuildings Ltd. Developed by Yasen Yanev as part of clippings.com

Under BSD-3-Clause license, read LICENSE file.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2013-09-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固