Skip to content
This repository has been archived by the owner on Feb 27, 2021. It is now read-only.

currency display does not work for variants #20

Open
zyferdigital opened this issue Mar 27, 2014 · 4 comments
Open

currency display does not work for variants #20

zyferdigital opened this issue Mar 27, 2014 · 4 comments

Comments

@zyferdigital
Copy link

Issue:

If you have "display currency" on, and product variants, changing the currency does not update the price or the currency code on the product detail page. Instead it shows the default currency price and code. The currency code and price show correctly on all other pages.

How to Replicate:

  1. ensure you have a product with multiple variants and with the prices set for each currency
  2. Turn on "display currency" in the general configurations
  3. go to the product detail page and switch to the non-default currency
  4. the price and variant prices will show in the default currency. the currency code will be the default currency.

Note:

adding the product to cart at this point will add the product at the right price for the selected currency. I've removed all non-essential extensions and the problem still exists so it's not a conflict issue.

Expected Result

Display the price and variant price(s) in the correct currency price with the correct currency code

Spree, Rails, Gems:

Spree 2.2-stable, Rails 4.0.3.

source 'https://rubygems.org'

gem 'rails', '4.0.3'
gem 'mysql2'

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

group :assets do
  gem 'therubyracer', '0.10.2', :platforms => :ruby
  gem 'libv8', '3.3.10.4'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'

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

gem 'rvm-capistrano'

gem 'spree', github: 'spree/spree', branch: '2-2-stable'
gem 'spree_gateway', github: 'spree/spree_gateway', branch: '2-2-stable'
gem 'spree_active_shipping', :git => "git://github.com/spree/spree_active_shipping", :branch => "2-2-stable"
gem 'spree_paypal_express', :github => "radar/better_spree_paypal_express", :branch => "2-2-stable"
gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '2-2-stable'
gem "spree_comments", github: 'spree/spree_comments', :branch => '2-2-stable'
gem 'spree_static_content', github: 'spree/spree_static_content', branch: '2-2-stable'
gem 'spree_print_invoice' , :git => 'git://github.com/spree/spree_print_invoice.git', branch: '2-2-stable'
gem 'spree_related_products', :git => 'git://github.com/spree/spree_related_products.git', branch: '2-2-stable'

gem 'spree_multi_currency', :github => "spree/spree_multi_currency", branch: '2-2-stable'
gem 'spree_abandoned_cart_email'
@JDutil
Copy link
Member

JDutil commented Mar 27, 2014

The issue is probably related to the fragment caching needing to switch based on current currency, which I thought I had fixed. Are you overriding the view templates at all? It should cache on currency like:
https://github.com/spree/spree/blob/master/frontend/app/views/spree/products/show.html.erb#L1

@zyferdigital
Copy link
Author

I am defacing the _cart_form view (setting some css classes, as well as replacing the add_to_cart div), but I did a clean install with no overrides and the problem exists in the vanilla version too. This only
happens if you have multiple variants. If you only have a master product it correctly changes.

@tomaswitek
Copy link

Hi I just ran into the same problems. And it seems that there was a bug in a Spree v 2.4.
It was solved in this commit: spree/spree@a86a20e.
So the solution for you is to update your deface override according to the commit.
Use variant.price_in(current_currency).money.

@aishmita-aggarwal
Copy link
Contributor

This issue does not exist in master.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants