ryandotsmith / spree-extensions

an extension for an affiliate program among other things.

This URL has Read+Write access

name age message
file README.markdown Thu Jul 02 11:50:21 -0700 2009 updated the readme [Ryan Smith]
file Rakefile Wed Jun 10 12:30:03 -0700 2009 initial import after extracting from spree app [ryandotsmith]
directory app/ Thu Jul 02 11:43:19 -0700 2009 updated the reporting for discount codes and se... [Ryan Smith]
directory config/ Thu Jul 02 11:43:19 -0700 2009 updated the reporting for discount codes and se... [Ryan Smith]
directory db/ Wed Jun 10 12:30:03 -0700 2009 initial import after extracting from spree app [ryandotsmith]
directory lib/ Thu Jul 02 11:43:19 -0700 2009 updated the reporting for discount codes and se... [Ryan Smith]
directory script/ Wed Jun 10 12:30:03 -0700 2009 initial import after extracting from spree app [ryandotsmith]
directory spec/ Thu Jul 02 11:43:19 -0700 2009 updated the reporting for discount codes and se... [Ryan Smith]
file tft_extension.rb Thu Jul 02 11:43:19 -0700 2009 updated the reporting for discount codes and se... [Ryan Smith]
README.markdown

Affiliate System

works with 0.8.3 only

extensions

This extension creates a DiscountCode resource.

discount_code belongs_to :user 
order has_many :discount_codes

We also will add some columns to the Order model.

order.discount_code_id
order.discount_total => once the discount is calculated it is stored on the order 
order.commission_total => likewise 

The methods added:

order.calculate_discount
order.calculate_commission

theory

A user can become an affiliate by adding a discount_code. @user.is_affilliate?

Not all products are created equal. When the discount_total is calculated, the method only considers products that have a taxon with a name == "Discountable"