Sha256: da94657c33133e29d95fa4482f6457df5bb378dd362849633bb41abe37c4a287

Contents?: true

Size: 868 Bytes

Versions: 69

Compression:

Stored size: 868 Bytes

Contents

module Spree::ZonePricing::CountriesController

  def self.included(target)
    target.class_eval do

      # Change the currently selected country
      def set
        country = Country.find(params[:id])
        if request.referer && request.referer.starts_with?("http://" + request.host)
          session[:return_to] = request.referer
        end
        if country
          # Store country in the session
          session[:zone_pricing_country] = country.id
          # Update prices for the current order
          if session[:order_id]
            order = Order.find(session[:order_id])
            order.update_zone_prices(get_user_country_id)
          end
          flash[:notice] = t("country_changed")
        else
          flash[:error] = t("country_not_changed")
        end
        redirect_back_or_default(root_path)
      end

    end
  end
  
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
spree_zone_pricing-0.1.69 lib/spree/zone_pricing/countries_controller.rb
spree_zone_pricing-0.1.68 lib/spree/zone_pricing/countries_controller.rb
spree_zone_pricing-0.1.66 lib/spree/zone_pricing/countries_controller.rb
spree_zone_pricing-0.1.65 lib/spree/zone_pricing/countries_controller.rb
spree_zone_pricing-0.1.64 lib/spree/zone_pricing/countries_controller.rb
spree_zone_pricing-0.1.63 lib/spree/zone_pricing/countries_controller.rb
spree_zone_pricing-0.1.62 lib/spree/zone_pricing/countries_controller.rb
spree_zone_pricing-0.1.61 lib/spree/zone_pricing/countries_controller.rb
spree_zone_pricing-0.1.60 lib/spree/zone_pricing/countries_controller.rb
spree_zone_pricing-0.1.59 lib/spree/zone_pricing/countries_controller.rb
spree_zone_pricing-0.1.58 lib/spree/zone_pricing/countries_controller.rb
spree_zone_pricing-0.1.57 lib/spree/zone_pricing/countries_controller.rb
spree_zone_pricing-0.1.56 lib/spree/zone_pricing/countries_controller.rb
spree_zone_pricing-0.1.55 lib/spree/zone_pricing/countries_controller.rb
spree_zone_pricing-0.1.54 lib/spree/zone_pricing/countries_controller.rb
spree_zone_pricing-0.1.53 lib/spree/zone_pricing/countries_controller.rb
spree_zone_pricing-0.1.52 lib/spree/zone_pricing/countries_controller.rb
spree_zone_pricing-0.1.51 lib/spree/zone_pricing/countries_controller.rb
spree_zone_pricing-0.1.50 lib/spree/zone_pricing/countries_controller.rb
spree_zone_pricing-0.1.49 lib/spree/zone_pricing/countries_controller.rb