🚨 Warning: While this code is in production use, it leaves a lot to be desired. It is currently compatible with Solidus 1.3. Expect significant and breaking changes without warning. 🚨
Solidus Reffiliate is a Solidus Extension that adds the referral and affiliate features to your Solidus Store. Users are going to be able to share a unique hyperlink with their friends to gain benefits and you'll be able to create affiliate campaigns through the Solidus Administrator and configure it to your needs.
Solidus Reffiliate was forked from Spree Reffiliate and modified to work with Solidus.
- User can share a unique URL
- User can signup as a referred user
- Referred user can have promotions
- Admin is able to see referred users and orders from user
- Admin is able to create an affiliate with a custom path
- Customize the affiliate view with a partial
- Users are going to be able to signup as an affiliated user
- Affiliated user can have individual promotions
- Admin is able to see affiliated users and orders from affiliate
gem 'solidus_reffiliate', git: 'https://github.com/Glowforge/solidus_reffiliate.git'
Bundle your dependencies and run the installation generator:
bundle
bundle exec rails g solidus_reffiliate:install
If you already have users within your database, you'll need to run the following command to generate the referral registry for your users:
bundle exec rake reffiliate:generate
Referral path is /r/:code
and Affiliate path (assigned in the admin) is /a/:path
Once installed, you'll be able to access the following methods.
- referred_by => user record
- referral_count => user count
- referred? => boolean
- affiliate? => boolean
- affiliate => affiliate record
- referral => referral record
- code => referral code
- referred_users => array of users
- referred_orders => array of orders
- referred_count => user count
- referral_activated_users => users with completed orders
- referred_users => array of users
- referred_orders => array of orders
- referred_count => user count
Important: in both referrals and affiliates, do not fill in the promotion code for the promotion itself to be applied automatically to the user's order. If you add a promotion code, the user will need to apply the for promotion manually.
First bundle your dependencies, then run rake
. rake
will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using rake test_app
.
bundle
bundle exec rake
When testing your applications integration with this extension you may use it's factories. Simply add this require statement to your spec_helper:
require 'solidus_reffiliate/factories'
Copyright (c) 2016 Glowforge, Inc. released under the New BSD License