spree_volume_pricing
spree_volume_pricing copied to clipboard
Partial only ever displays master variant pricing
Steps to repeat:
-
Install spree 2.1
-
load spree sample data
-
Install this gem (2.1)
-
Create examples in the admin interface (these examples from the README.md)
Variant Name Range Amount Position ------------------------------------------------------------------------------- Rails T-Shirt 1-5 (1..5) 19.99 1 Rails T-Shirt 6-9 (6...10) 18.99 2 Rails T-Shirt 10 or more (10+) 17.99 3
-
Create your own product page (copy it from the spree gem): app/views/spree/products/show.html.erb
-
add the partial to you overridden product page
'spree/products/volume_pricing', :locals => { :product => @product } %>
-
start your webserver
-
Navigate to the product page
The problem: Strictly a display issue only: clicking the different images of the product changes the product image, but the partial only ever displays the pricing from the master.
As far as I can tell the correct price is used when you click the variant and add to your cart, but it'd be confusing for a user if you had different volume prices per variant but they are only displayed the master one.
Gemfile
source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.0.2' # Use sqlite3 as the database for Active Record gem 'sqlite3' # Use SCSS for stylesheets gem 'sass-rails', '~> 4.0.0' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use CoffeeScript for .js.coffee assets and views gem 'coffee-rails', '~> 4.0.0' # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby # Use jquery as the JavaScript library gem 'jquery-rails' # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks gem 'turbolinks' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 1.2' group :doc do # bundle exec rake doc:rails generates the API under doc/api. gem 'sdoc', require: false end # Use ActiveModel has_secure_password # gem 'bcrypt-ruby', '~> 3.1.2' # Use unicorn as the app server # gem 'unicorn' # Use Capistrano for deployment # gem 'capistrano', group: :development # Use debugger # gem 'debugger', group: [:development, :test] # spree stuff gem 'spree', git: 'https://github.com/spree/spree.git', :branch => '2-1-stable' gem 'spree_paypal_express', :git => 'https://github.com/radar/better_spree_paypal_express.git', :branch => '2-1-stable' gem 'spree_gateway', :git => 'https://github.com/spree/spree_gateway.git', :branch => '2-1-stable' gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '2-1-stable' gem 'spree_volume_pricing', :git => 'https://github.com/spree/spree_volume_pricing.git', :branch => '2-1-stable'
@jhirbour I tried to parse this issue today but I couldn't. Can you show me some screenshots of what is happening? I think that would help me understand.
Setup 2 variants with volume pricing:
-
Variant ID 17: http://i.imgur.com/7vPSoSk.png
-
Variant ID 24: http://i.imgur.com/nMaOIog.png
-
Verify in the DB
sqlite> SELECT * FROM spree_volume_prices WHERE variant_id IN (24,17); id variant_id name range amount position created_at updated_at discount_type ---------- ---------- ---------- ---------- ---------- ---------- -------------------------- -------------------------- ------------- 3 17 10-20 (11..20) 5 1 2014-03-06 15:06:04.838933 2014-03-06 15:38:44.739249 price 4 17 0-10 (1..10) 3 2 2014-03-06 15:06:04.842051 2014-03-06 15:38:44.742184 price 11 24 10-20 (11..20) 20 3 2014-03-26 13:24:59.829500 2014-03-26 13:24:59.829500 price 12 24 0-10 (1..10) 10 1 2014-03-26 13:24:59.834423 2014-03-26 13:24:59.834423 price sqlite>
-
Add the volume pricing partial: https://gist.github.com/53509634715865307ca6
-
The "bulk pricing" partial never updates when you click the radio boxes (and yes I <3 Snaggit): http://i.imgur.com/b5SBWrA.png
It seems like there needs to be some javascript in this Gem like the javascript in store/product.js that re-renders the price and pictures