Giter Club home page Giter Club logo

spree_product_subscriptions's Introduction

Spree Product Subscriptions

Spree Product Subscriptions is an extension to let users have time interval based subscription of products in a spree application.

  • This extension allows the admin to create a subscribable product on the Admin end.

  • This product can then be bought one-time or as a subscription.

  • Once subscribed, subscription orders will automatically be created for the user at the selected time interval.

Demo

Try Spree Product Subscriptions for Spree master with direct deployment on Heroku:

Deploy

Try Spree Product Subscriptions for Spree 4 with direct deployment on Heroku:

Deploy

Try Spree Product Subscriptions for Spree 3-4 with direct deployment on Heroku:

Deploy

Installation

Add spree_product_subscriptions to your Gemfile:

gem 'spree_product_subscriptions', github: 'vinsol-spree-contrib/spree_product_subscriptions'

Bundle your dependencies and run the installation generator:

bundle
bundle exec rails g spree_product_subscriptions:install

You can also seed the default data with:

bundle exec rails g spree_product_subscriptions:seed

Working

  • Admin can mark a product as "subscribable" on the Admin -> Products -> Edit page. The admin will have to choose the subscription frequencies to be made available for that product.

  • Subscription frequencies are created by default when you seed data. You can also add subscription frequencies through Admin -> Configurations -> Subscription Frequencies -> New page.

  • When user is purchasing a subscribable product, he gets an option to make it a 'One Time Order' or a 'Subscription Order'.

  • When making a 'Subscription Order', the user will have to choose Delivery Interval, Total Deliveries, and Quantity. The first order will be made on checkout and remaining orders will automatically be created for the user at the selected time intervals.

  • The users can check their subscriptions on the 'My Account' page. They can update subscription info, pause or cancel their subscriptions via the Subscription -> Edit page.

  • A cron job needs to be run to process subscriptions

    bundle exec rake subscription:process
    

    This will run the pending subscriptions.

  • A cron job can also be run to notify users of upcoming subscriptions:

    bundle exec rake subscription:prior_notify
    

    This will inform users that they have a subscription that is coming up in 'x' days. The number of days can be changed on subscription edit page.

Here is a detailed article with screenshot http://vinsol.com/spreecommerce-subscription Testing

Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.

bundle
bundle exec rake test_app
bundle exec rspec spec

When testing your applications integration with this extension you may use it's factories. Simply add this require statement to your spec_helper:

require 'spree_product_subscriptions/factories'

See It In Action

Youtube Video Tutorial

Credits

vinsol.com: Ruby on Rails, iOS and Android developers

Copyright (c) 2016 vinsol.com, released under the New MIT License

spree_product_subscriptions's People

Contributors

adhirajgautam avatar aishmita-aggarwal avatar bansalakhil avatar himanshumishra31 avatar jatin-baweja avatar jitendra avatar manishrawat0212 avatar nishant-cyro avatar rishabhguptarishi avatar sachinmittal93 avatar sawangupta92 avatar shivamvinsol avatar tanmay3011 avatar vinay-mittal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spree_product_subscriptions's Issues

Rails 5.0 Error

I'm getting this error when trying to bundle with Rails 5.0

`Bundler could not find compatible versions for gem "spree_core":
In Gemfile:
spree (~> 3.2.0.rc1) was resolved to 3.2.0.rc1, which depends on
spree_core (= 3.2.0.rc1)

spree (~> 3.2.0.rc1) was resolved to 3.2.0.rc1, which depends on
  spree_core (= 3.2.0.rc1)

spree (~> 3.2.0.rc1) was resolved to 3.2.0.rc1, which depends on
  spree_core (= 3.2.0.rc1)

spree (~> 3.2.0.rc1) was resolved to 3.2.0.rc1, which depends on
  spree_core (= 3.2.0.rc1)

spree (~> 3.2.0.rc1) was resolved to 3.2.0.rc1, which depends on
  spree_core (= 3.2.0.rc1)

spree_gateway (~> 3.2.0.beta) was resolved to 3.2.0.beta, which depends on
  spree_core (< 4.0, >= 3.1.0)

spree_gateway (~> 3.2.0.beta) was resolved to 3.2.0.beta, which depends on
  spree_core (< 4.0, >= 3.1.0)

spree_product_subscriptions was resolved to 3.1.0, which depends on
  spree_core (~> 3.1.0)](url)`

This is my Spree install:
gem 'spree', '~> 3.2.0.rc1' gem 'spree_auth_devise', '~> 3.2.0.beta' gem 'spree_gateway', '~> 3.2.0.beta'

Is there a Rails 5.0 compatible version?

Compatibility with Spree 3.4?

Environment:

OS: Windows Ubuntu (Ubuntu 16.04.3 LTS)
Rails: 5.1.4
Bundler: 1.16.0
Ruby: 2.4.1p111

Trying to implement this extension with Spree 3.4.4 and I ran into dependency issues.

Bundler could not find compatible versions for gem "spree_core":
  In snapshot (Gemfile.lock):
    spree_core (= 3.4.4)

  In Gemfile:
    spree (~> 3.4.4) was resolved to 3.4.4, which depends on
      spree_core (= 3.4.4)

    spree_product_subscriptions was resolved to 3.2.0, which depends on
      spree_core (~> 3.2.0.rc2)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

Currently testing compatibility. I think updating the dependencies may be in order.

Do you guys have a specific way to contribute or test?

Migrate Spree::UsersController

I'm implementing spree_product_subscriptions to spree 3.7.
And I've encountered this error.

myapp/vendor/bundle/ruby/2.5.0/bundler/gems/spree_product_subscriptions-2dd9d1467f2b/app/controllers/spree/users_controller_decorator.rb:1:in `<top (required)>': uninitialized constant Spree::UsersController (NameError)

And users_controller_decorator.rb which described above is here.

Spree::UsersController.class_eval do

  before_action :load_subscriptions, only: :show

  private

    def load_subscriptions
      @orders = @user.orders.complete.order(completed_at: :desc)
      @subscriptions = Spree::Subscription.active.order(created_at: :desc).with_parent_orders(@orders)
    end

end

Actually, I have my own users already. What should I do?

Cart line item qty not updated correctly for subscriptions

Setup: Ruby 2.1.5, Rails 4.2, Spree 3.1

If a product is already in cart as a subscription, and then a user adds the same product to cart, quantity for cart line item is updated by one -- ignores user quantity input from product page.

Changing order to "Complete" from admin dashboard does not trigger Order#enable_subscription

If subscription order is initiated by customer on the front-end using manual payment or Spree::BogusGateway, and admin approves payment from the admin dashboard then the Order state is changed to "Complete" but subscription is not updated.

If Admin panel is changing order to "Complete" through ActiveRecord callbacks then State Machine is not invoked, so below is never triggered:

self.state_machine.after_transition to: :complete, do: :enable_subscriptions, if: :any_disabled_subscription?

See similar issue: https://stackoverflow.com/questions/22622254/spreeshipment-state-machine

Can't subscribe item after setting up subscription

I just set up spree_product_subscriptions on spree 3.7.2 along with installation procedure.
Here's my env.

I reviewed steps of github like this.

  • Add spree_product_subscriptions to your Gemfile:

    gem 'spree_product_subscriptions', github: 'vinsol-spree-contrib/spree_product_subscriptions'

  • Bundle your dependencies and run the installation generator:

    bundle
    bundle exec rails g spree_product_subscriptions:install

  • You can also seed the default data with:

  • bundle exec rails g spree_product_subscriptions:seed

After installation, started my app. And then configured the item like this.
AwesomeScreenshot-localhost-admin-products-ruby-on-rails-bag-edit-2019-08-08_6_45 (1)

Here's product page.
AwesomeScreenshot-localhost-products-ruby-on-rails-bag-2019-08-08_6_38 (1)

What happened? Tell me how to fix.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.