Code Monkey home page Code Monkey logo

solidus_flexi_variants's Introduction

Build Status

SolidusFlexiVariants

This extension solves two use cases related to variants. I call them Ad Hoc Options and Product Customizations.

Ad Hoc Options

Use these when have numerous (possibly price-altering) product options and you don't want to create variants for each combination.

You can also restrict certain combinations of options from coexisting. These are called Ad Hoc Exclusions.

Product Customizations

Use these when you want the ability to provide a highly customized product e.g. "Cut to length 5.82cm", "Engrave 'thanks for the memories'", "Upload my image". Full control over pricing is provided by the Spree calculator mechanism.

Version Notes

TODO I have only tested with V2.0, unsure if compatible with other versions as of yet.

Installation

# see the notes in Versionfile if you are using an older version of spree
gem 'solidus_flexi_variants', github: 'boomerdigital/solidus_flexi_variants', branch: 'master'

bundle install

bundle exec rails g solidus_flexi_variants:install

Examples

Build a 'Cake' product using Ad Hoc Options and Product Customizations

Cake

Build a 'Necklace' product using Ad Hoc Options and Product Customizations

Necklace

Build a 'Pizza' product using Ad Hoc Options. Note that the 'multi' option checkboxes come from a partial named after the option name (see app/views/products/ad_hoc_options/_toppings.html.erb)

Picture Frame

See the wiki for more detail.

solidus_flexi_variants's People

Contributors

acreilly avatar adammathys avatar binaryphile avatar bryanmtl avatar ccschmitz avatar charredutensil avatar chunkerchunker avatar daemonsy avatar dhonig avatar eniwito avatar greendog avatar hugosantosred avatar jdutil avatar jsqu99 avatar jwoertink avatar kappiah avatar kpitn avatar krismartin avatar locke23rus avatar masonjeffreys avatar metade avatar mroach avatar mscottford avatar nicalpi avatar nostopbutton avatar peterberkenbosch avatar piotr-radzikowski avatar quintinadam avatar robinclowers avatar samuelkobe avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

solidus_flexi_variants's Issues

Not working on solidus_core (= 2.10.0.beta1)

Hi There,

If anyone can help me here I'd appreciate it. Fresh solidus store on local dev. version 2.19.0.beta.

When I try to run the install I get:

rake aborted!
NoMethodError: undefined method `add_class' for #Spree::Core::Environment::Calculators:0x00007fd602dbe478

help me obi-wan, you're my only hope.

Product javascript not being inserted into product page

Hi,

I have a problem where the javascript used to calculate the price of the product has stopped working in production mode. It seems to run fine and then just stopped. Viewing the source code the javascript required to update the price when a dropdown is selected is not there. There are no errors in the production log or the browser console.

An example page can be seen here: https://www.yournewbed.co.uk/products/kozee-sleep-limited-edition-2-drawer-set?taxon_id=6

Any thoughts?

Thanks.

Is this maintained? Should it move to solidisio_contrib?

Per Slack discussion:

This extension appears to be out-of-date. For example, the various buttons in its requisite tabs do not match the style of the current dashboard. Additionally some aspects of of the admin interface may be broken or outdated.

This fork has some more recent updates but has visible issues, at least in the admin interface.

Solidus 3

This project appears abandoned as it has not been updated in some time. I wanted to open an issue to see if there was anyone left that had any interest in upgrading it to work with current solidus version. @acreilly

Separate into core, frontend, and backend engines (like Solidus)

I have been modifying a fork of this gem to separate the solidus_flexi_variants gem into core, frontend, and backend engines. It's a similar format to the solidus path. I went down this path because I wanted to use the models, business logic, and admin views but not the frontend stuff.

In fact, if a person isn't using solidus_frontend, they may not be able to get the existing solidus_flexi_variants gem to work because it depends on standard solidus/spree frontend controllers.

Are you interested in a pull request for this separation? I'll probably need some help to finish it.

undefined method `ad_hoc_option_values'

I'm having trouble with this gem. I have it working in my development environment but when I push it to the server I get this error whenever I try to view / edit an order.

[2019-04-09T16:48:39.640103 #5915] FATAL -- : [63f9bd8d-3d90-4b9b-8b6b-2aaa6bfacec1] ActionView::Template::Error (undefined method `ad_hoc_option_values' for #<Spree::ShippingManifest::ManifestItem:0x0000563a415f1168>):
F, [2019-04-09T16:48:39.640353 #5915] FATAL -- : [63f9bd8d-3d90-4b9b-8b6b-2aaa6bfacec1]     1: <div class='customizations'>
[63f9bd8d-3d90-4b9b-8b6b-2aaa6bfacec1]     2:   <%# TODO: group multi-select options (e.g. toppings) %>
[63f9bd8d-3d90-4b9b-8b6b-2aaa6bfacec1]     3:   <ul class='list-group list-unstyled'>
[63f9bd8d-3d90-4b9b-8b6b-2aaa6bfacec1]     4:     <% item.ad_hoc_option_values.each do |ad_hoc_option_value| %>
[63f9bd8d-3d90-4b9b-8b6b-2aaa6bfacec1]     5:       <li><b><%= ad_hoc_option_value.option_value.option_type.presentation %>:</b> <%= ad_hoc_option_value.option_value.presentation %></li>
[63f9bd8d-3d90-4b9b-8b6b-2aaa6bfacec1]     6:     <% end %>
[63f9bd8d-3d90-4b9b-8b6b-2aaa6bfacec1]     7:     <% item.product_customizations.each do |customization| %>

Factories are defined twice

I ran into a problem this morning where I was getting some errors about factories being defined twice. I then noticed that most of the factories are defined both in lib/solidus_flexi_variants/factories.rb and in individual files under spec/factories. I don't know if this is a recent change in factory_bot or a convention with which I'm not familiar (I am used to looking for one factories file in a gem).

I am happy to remove one set or the other.

Getting tests working

I'm having trouble getting tests to pass for this project. There were a few issues with FactoryBot and JavaScript Assets. My branch is located at: https://github.com/jeremygpeterson/solidus_flexi_variants

The branch has updates for:

  • upgrade FactoryGirl to FactoryBot
  • add rails_jquery to solidus_flexi_variants.gemspec
  • add jquery.validate.min.js to vendor/assets/javascripts/jquery.validate/

Steps to reproduce test:

  • rake test_app
  • rake

Failed Tasks:
rspec ./spec/models/spree/order_contents_decorator_spec.rb:36
rspec ./spec/models/spree/order_contents_decorator_spec.rb:40
rspec ./spec/features/admin/ad_hoc_option_plus_exclusions_spec.rb:13
rspec ./spec/features/admin/ad_hoc_option_plus_exclusions_spec.rb:78
rspec ./spec/features/admin/product_customizations_spec.rb:22
rspec ./spec/features/product_page_ad_hoc_opts_and_exclusions_feature_spec.rb:20
rspec ./spec/features/product_page_ad_hoc_opts_and_exclusions_feature_spec.rb:47
rspec ./spec/features/product_page_ad_hoc_opts_and_exclusions_feature_spec.rb:41

More than one customizable product on a page causes issues.

Showing more than one customizable product at a time causes issues like:

  • Scrolling over one variant changes all pictures
  • Price calculations for one product affect all products

The javascript involved on the frontend of the gem should be reworked to be scoped to a single product, rather than the entire dom.

Happy to work on this. Perhaps some direction could be provided.
Thanks,
Jeff

undefined method `with_indifferent_access'

Creating a new app with solidus and solidus_flexi_variants, I'm unable to a product to cart with an Ad Hoc Option Type.

Steps to Reproduce:

  1. Select a product with an Ad Hoc Option Type
  2. Choose an Ad Hoc Option TYpe
  3. Click "Add to Cart"

Error Message:
undefined method `with_indifferent_access' for #ActionController::Parameters:0x007fd1408ffa20

actionpack (5.1.4) lib/action_controller/metal/strong_parameters.rb:235:in `initialize'
/Users/jpeterson/.rvm/gems/ruby-2.4.1/bundler/gems/solidus_flexi_variants-2c5e29a49211/app/models/spree/order_contents_decorator.rb:15:in `new'
/Users/jpeterson/.rvm/gems/ruby-2.4.1/bundler/gems/solidus_flexi_variants-2c5e29a49211/app/models/spree/order_contents_decorator.rb:15:in `add_to_line_item'
solidus_core (2.4.2) app/models/spree/order_contents.rb:23:in `add'
/Users/jpeterson/.rvm/gems/ruby-2.4.1/bundler/gems/solidus_flexi_variants-2c5e29a49211/app/controllers/spree/orders_controller_decorator.rb:16:in `populate'
actionpack (5.1.4) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
actionpack (5.1.4) lib/abstract_controller/base.rb:186:in `process_action'
actionpack (5.1.4) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (5.1.4) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (5.1.4) lib/active_support/callbacks.rb:108:in `block in run_callbacks'
activesupport (5.1.4) lib/active_support/callbacks.rb:135:in `run_callbacks'
actionpack (5.1.4) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (5.1.4) lib/action_controller/metal/rescue.rb:20:in `process_action'
actionpack (5.1.4) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (5.1.4) lib/active_support/notifications.rb:166:in `block in instrument'
activesupport (5.1.4) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.1.4) lib/active_support/notifications.rb:166:in `instrument'
actionpack (5.1.4) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (5.1.4) lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
activerecord (5.1.4) lib/active_record/railties/controller_runtime.rb:22:in `process_action'
actionpack (5.1.4) lib/abstract_controller/base.rb:124:in `process'
actionview (5.1.4) lib/action_view/rendering.rb:30:in `process'
actionpack (5.1.4) lib/action_controller/metal.rb:189:in `dispatch'
actionpack (5.1.4) lib/action_controller/metal.rb:253:in `dispatch'
actionpack (5.1.4) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (5.1.4) lib/action_dispatch/routing/route_set.rb:31:in `serve'
actionpack (5.1.4) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (5.1.4) lib/action_dispatch/journey/router.rb:33:in `each'
actionpack (5.1.4) lib/action_dispatch/journey/router.rb:33:in `serve'
actionpack (5.1.4) lib/action_dispatch/routing/route_set.rb:834:in `call'
railties (5.1.4) lib/rails/engine.rb:522:in `call'
railties (5.1.4) lib/rails/railtie.rb:185:in `public_send'
railties (5.1.4) lib/rails/railtie.rb:185:in `method_missing'
actionpack (5.1.4) lib/action_dispatch/routing/mapper.rb:17:in `block in <class:Constraints>'
actionpack (5.1.4) lib/action_dispatch/routing/mapper.rb:46:in `serve'
actionpack (5.1.4) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (5.1.4) lib/action_dispatch/journey/router.rb:33:in `each'
actionpack (5.1.4) lib/action_dispatch/journey/router.rb:33:in `serve'
actionpack (5.1.4) lib/action_dispatch/routing/route_set.rb:834:in `call'
versioncake (3.3.0) lib/versioncake/rack/middleware.rb:17:in `call'
warden (1.2.7) lib/warden/manager.rb:36:in `block in call'
warden (1.2.7) lib/warden/manager.rb:35:in `catch'
warden (1.2.7) lib/warden/manager.rb:35:in `call'
rack (2.0.3) lib/rack/etag.rb:25:in `call'
rack (2.0.3) lib/rack/conditional_get.rb:38:in `call'
rack (2.0.3) lib/rack/head.rb:12:in `call'
rack (2.0.3) lib/rack/session/abstract/id.rb:232:in `context'
rack (2.0.3) lib/rack/session/abstract/id.rb:226:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.1.4) lib/active_record/migration.rb:556:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
activesupport (5.1.4) lib/active_support/callbacks.rb:97:in `run_callbacks'
actionpack (5.1.4) lib/action_dispatch/middleware/callbacks.rb:24:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
web-console (3.5.1) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.5.1) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.5.1) lib/web_console/middleware.rb:18:in `catch'
web-console (3.5.1) lib/web_console/middleware.rb:18:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.1.4) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.1.4) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.1.4) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.1.4) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.1.4) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.1.4) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.0.3) lib/rack/method_override.rb:22:in `call'
rack (2.0.3) lib/rack/runtime.rb:22:in `call'
activesupport (5.1.4) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.4) lib/action_dispatch/middleware/static.rb:125:in `call'
rack (2.0.3) lib/rack/sendfile.rb:111:in `call'
railties (5.1.4) lib/rails/engine.rb:522:in `call'
puma (3.11.0) lib/puma/configuration.rb:225:in `call'
puma (3.11.0) lib/puma/server.rb:624:in `handle_request'
puma (3.11.0) lib/puma/server.rb:438:in `process_client'
puma (3.11.0) lib/puma/server.rb:302:in `block in run'
puma (3.11.0) lib/puma/thread_pool.rb:120:in `block in spawn_thread'

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.