spree/spree — pull request #2236 by gmacdougall (2012-11-23 19:52:05+00:00)
Title: current_currency Product Searching

This change defines a controller helper method called current_currency (which in this case is simply the value of Spree::Config[:currency]). This change will allow a extension writer to override current_currency in order to return a value based on different information (session values, request domain, locale, etc.).

The value of current_currency is passed in to the searcher retrieve_products, so that products will only be found if they have a matching currency entry.

Partials which display the price for a product also explicitly look for a price listed in current_currency.

The default for current_currency is Spree::Config[:currency], and the searcher class will use Spree::Config[:currency] if a value for current_currency is not passed in via an accessor. This should maintain the current functionality, but provide benefits to extension writers wishing to make currency based decisions.