GithubHelp home page GithubHelp logo

shubham-kaushal / spree_variant_options Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tcnet/spree_variant_options

0.0 0.0 0.0 297 KB

Spree Variant Options groups your variants by option types and values

Home Page: https://rubygems.org/gems/spree_variant_options

License: BSD 3-Clause "New" or "Revised" License

Ruby 55.73% JavaScript 6.02% CSS 23.42% HTML 6.79% Gherkin 8.03%

spree_variant_options's Introduction

Spree Variant Options

Spree Variant Options is a very simple spree extension that replaces the radio-button variant selection with groups of option types and values. To get a better idea let's let a few images do the explaining.

Deploy

When no selection has been made:

Spree Variant Options - No selection

After "Large" is selected, "Large Blue" is out of stock:

Spree Variant Options - Option Type/Value selected

And after "Green" is selected:

Spree Variant Options - Variant Selcted

To see it in action, follow the steps for "Demo" below.


Installation

To install Spree Variant Options, just add the following to your Gemfile:

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

Now, bundle up with:

bundle

Next, run the install generator to copy the necessary migration to your project and migrate your database:

rails g spree_variant_options:install
rake db:migrate

Configuration Options

Spree Variant Options comes with some handy options:

  • allow_select_outofstock (default : false) When using extension like (spree_wishlist), you might want to allow your customer to add out of stock product by selecting out of stock variant options :

      <%= form_for Spree::WishedProduct.new, :html => {:"data-form-type" => "variant"} do |f| %>
        <%= f.hidden_field :variant_id, :value => @product.master.id %>
        <button type="submit" class="medium blue awesome">
          <%= t(:add_to_wishlist) %>
        </button>
      <% end %>

    By setting allow_select_outofstock to true, when an user selects variant options it will automatically update any form's input variant_id with an data-form-type="variant" attribute.

  • default_instock (default: false) If this is option is set to true, it will automatically preselect in-stock variant options.

These configuration options can be set in a config/initializers/spree_variant_options.rb file for example :

SpreeVariantOptions::VariantConfig.allow_select_outofstock = true
SpreeVariantOptions::VariantConfig.default_instock = true

Storage options

Like in spree core there is support for storage of images on S3. Storage on S3 is enabled with the same configuration as in spree core.

Example: config/initializers/spree.rb

Spree.config do |config|
  config.use_s3 = true
  config.s3_bucket = <bucket_name>
  config.s3_access_key = <aws_access_key>
  config.s3_secret = <aws_secret_key>
end

Testing

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

bundle install
bundle exec rake test_app
bundle exec rspec spec

Contributors

If you'd like to help out feel free to fork and send me pull requests!


License

Copyright (c) 2011 - 2012 Spencer Steffen and Citrus, released under the New BSD License All rights reserved.

spree_variant_options's People

Contributors

ajjahn avatar argami avatar baracek avatar citrus avatar danmorin avatar himanshumishra31 avatar jatin-baweja avatar jynti avatar maxim-filimonov avatar nishant-cyro avatar rbrown avatar sawangupta92 avatar sbounmy avatar tcnet avatar vinay-mittal avatar

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.