2017 © Pedro Peláez
 

kohana-module promotions

Promotions for Purchases

image

openbuildings/promotions

Promotions for Purchases

  • Monday, October 23, 2017
  • by hkdobrev
  • Repository
  • 10 Watchers
  • 2 Stars
  • 40,948 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 0 Forks
  • 0 Open issues
  • 33 Versions
  • 11 % Grown

The README.md

Promotions Module

Build Status Scrutinizer Quality Score Code Coverage Latest Stable Version, (*1)

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., (*2)

Promotions can also have ontime or multiple time uses for promo_codes, (*3)

Usage

Add a behavior to the purchase and brand_purchase models:, (*4)

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., (*5)

There are 2 availbale predefined promotions:, (*6)

  • 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., (*7)

License

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

Under BSD-3-Clause license, read LICENSE file., (*9)

The Versions

24/11 2016

0.7.3

0.7.3.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

24/11 2016

dev-clippings-commission-fix

dev-clippings-commission-fix https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

10/11 2016

0.7.2

0.7.2.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

06/11 2015

0.7.1

0.7.1.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

29/09 2015

0.7.0

0.7.0.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

31/08 2015

0.6.2

0.6.2.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

20/05 2015

0.6.1

0.6.1.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

27/03 2015

0.6.0

0.6.0.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

09/02 2015

0.6.0-rc.1

0.6.0.0-RC1 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

16/12 2014

0.5.0

0.5.0.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

11/12 2014

0.5.0-rc.1

0.5.0.0-RC1 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

28/11 2014

0.5.0-alpha.1

0.5.0.0-alpha1 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

23/10 2014

0.4.0

0.4.0.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

01/03 2014

0.3.8

0.3.8.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

26/02 2014

0.3.7

0.3.7.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

26/02 2014

0.3.6

0.3.6.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

05/02 2014

0.3.5

0.3.5.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

28/01 2014

0.3.4

0.3.4.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

27/01 2014

0.3.3

0.3.3.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

18/11 2013

0.3.2

0.3.2.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

18/11 2013

0.3.1

0.3.1.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

15/11 2013

0.3.0

0.3.0.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

14/11 2013

0.2.6

0.2.6.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

13/11 2013

0.2.5

0.2.5.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

01/11 2013

0.2.4

0.2.4.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

01/11 2013

0.2.3

0.2.3.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

14/10 2013

0.2.2

0.2.2.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

09/10 2013

0.2.1

0.2.1.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

09/10 2013

0.2.0

0.2.0.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions

23/09 2013

0.1.0

0.1.0.0 https://github.com/OpenBuildings/promotions

Promotions for Purchases

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Yasen Yanev

purchase cart store kohana basket jam promotions