spree-contrib / spree_fancy

SpreeFancy is a responsive theme for Spree Commerce.
http://guides.spreecommerce.org
BSD 3-Clause "New" or "Revised" License
86 stars 187 forks source link

show_zero_stock_products preference not defined #93

Closed GarPit closed 10 years ago

GarPit commented 10 years ago

Spree from 2-1-stable branch, Rails 4.0.2.

The reason is app/overrides/spree/products/_cart_form/replace_varaints_selection_markup_to_fit_for_jquery_ui.html.erb.deface

radar commented 10 years ago

I'm surprised that nobody picked up on this before. Can you please share with us your Gemfile?

Thanks!

On Tue, Feb 11, 2014 at 7:44 PM, PitOn notifications@github.com wrote:

Spree from 2-1-stable branch, Rails 4.0.2.

The reason is app/overrides/spree/products/_cart_form/replace_varaints_selection_markup_to_fit_for_jquery_ui.html.erb.deface

Reply to this email directly or view it on GitHub: https://github.com/spree/spree_fancy/issues/93

GarPit commented 10 years ago
source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.2'

gem 'pg'

# 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

group :development do
  gem 'byebug'
  # Use Capistrano for deployment
  gem 'capistrano'
  gem 'capistrano-bundler'
  gem 'capistrano-rvm'
  gem 'capistrano3-unicorn'
  gem 'capistrano-rails', '~> 1.1'
  gem 'thin'
end

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the app server
gem 'unicorn'

# Use debugger
# gem 'debugger', group: [:development, :test]

gem 'haml-rails'
gem 'spree', :git => 'https://github.com/spree/spree.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_i18n', :git => 'https://github.com/spree/spree_i18n.git', :branch => '2-1-stable'
gem 'spree_scrapers', path: 'spree_scrapers' 
gem 'spree_pricelists', :github => "webgradus/spree_pricelists"
gem 'spree_fancy', :github => 'spree/spree_fancy', :branch => '2-1-stable'
gem 'spree_plitkashop', path: 'spree_plitkashop'
gem 'sinatra', '>= 1.3.0', :require => nil
radar commented 10 years ago

Hi @GarPit, I tried reproducing this issue today but was unable to. I suspect this is supposed to show up on the Products#show action, but I am not sure.

This is the section I believe that the override replaces: ruby on rails baseball jersey - spree demo site 2014-03-03 11-00-00 2014-03-03 11-00-19

Please let me know if you're still seeing this problem and, if so, what steps you're using on your machine to see it.

Thanks!

mugoyal commented 10 years ago

I'm facing same problem. I think error is because Spree::Config[:show_zero_stock_products] is not defined or not loading properly. Need help.

radar commented 10 years ago

@mugoyal I need some steps to reproduce this problem. I investigated it before but couldn't see the problem. Please provide the info from https://github.com/spree/spree/tree/master/CONTRIBUTING.md if you want us to help with it.

mugoyal commented 10 years ago

@radar 1) Whenever we create multiple variants for a product from admin section and then if we go to the products' show page from user end I got this this error.

2) I'm using rails '4.0.3', spree '2-2-stable' and spree_fancy 'master' branch.

3) Here is my complete Gemfile source 'https://rubygems.org'

gem 'rails', '4.0.3'

gem 'pg'

gem 'sass-rails', '~> 4.0.0'

gem 'uglifier', '>= 1.3.0'

gem 'coffee-rails', '~> 4.0.0'

gem 'jquery-rails'

gem 'turbolinks'

gem 'jbuilder', '~> 1.2'

group :doc do gem 'sdoc', require: false end

gem 'debugger', group: [:development, :test]

gem 'spree', github: 'spree/spree', branch: '2-2-stable' gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '2-2-stable' gem 'spree_fancy', :github => 'spree/spree_fancy'

gem 'aws-s3' gem 'fog' gem 'unf'

Godweed commented 10 years ago

The same issue with rails 4.0.3 spree 2-2-stable, fancy 2-2 stable,

NoMethodError in Spree::Products#show

Showing /var/www/SanalHarikalarFabrikasi/vendor/bundle/ruby/2.0.0/gems/spree_frontend-2.2.0/app/views/spree/products/_cart_form.html.erb where line #9 raised:

show_zero_stock_products preference not defined

Extracted source (around line #9):

6 7 8 9 10 11 12

<% has_checked = false @product.variants.active(current_currency).each_with_index do |v,index| next if v.option_values.empty? || (!v.in_stock? && !Spree::Config[:show_zero_stock_products]) checked = !has_checked && (v.in_stock? || Spree::Config[:allow_backorders]) has_checked = true if checked %><%= radio_button_tag "products[#{@product.id}]", v.id, checked, :disabled => !v.in_stock? && !Spree::Config[:allow_backorders], 'data-price' => v.price_in(current_currency).display_price %>
mugoyal commented 10 years ago

@radar : Any update on this? Need this to be resolved ASAP.

Thanks.

maco commented 10 years ago

That pull request makes it show all the variants but grey out the ones that are unavailable, as if :show_zero_stock_products (which no longer exists) was set to true.

mugoyal commented 10 years ago

@radar : After updating spree_fancy, now I'm getting this error wrong number of arguments (2 for 1) (in /home/enbake/.rvm/gems/ruby-2.1.1@spree/bundler/gems/spree-205813af2eac/frontend/app/assets/stylesheets/spree/frontend/screen.css.scss). Please help.

mugoyal commented 10 years ago

I think this is because of commit https://github.com/spree/spree_fancy/commit/bbf18587194a97b735759205f26c175677398d79. I'm using spree_core, 2.2.1.beta Why did you change the spree_core dependency in master branch?

radar commented 10 years ago

@mugoyal Please show us your complete Gemfile. I suspect you're using the master branch for spree and spree_fancy and running into troubles there due to our recent preference changes.

mugoyal commented 10 years ago

Here is my complete Gemfile source 'https://rubygems.org'

gem 'rails', '4.0.3'

gem 'pg'

gem 'sass-rails', '~> 4.0.0'

gem 'uglifier', '>= 1.3.0'

gem 'coffee-rails', '~> 4.0.0'

gem 'jquery-rails'

gem 'turbolinks'

gem 'jbuilder', '~> 1.2'

group :doc do gem 'sdoc', require: false end

gem 'debugger', group: [:development, :test]

gem 'spree', github: 'spree/spree', branch: '2-2-stable' gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '2-2-stable' gem 'spree_fancy', :github => 'spree/spree_fancy', :branch => '2-2-stable'

gem 'aws-s3' gem 'fog' gem 'unf'

radar commented 10 years ago

@mugoyal When exactly do you see this error? When booting the application? Navigating to a specific route?

mugoyal commented 10 years ago

@radar I've solved it using following set of spree gems gem 'spree', github: 'spree/spree', branch: '2-2-stable' gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '2-2-stable' gem 'spree_fancy', :github => 'spree/spree_fancy'

Thanks for your responses :-)