【问题标题】:Spree change default currency and Country大礼包更改默认货币和国家
【发布时间】:2012-09-21 04:57:11
【问题描述】:

我正在使用 Spree for India 开发电子商务应用程序。因此,所有价格都以“卢比”为单位,州和地区与印度有关。我在 Spree 1.2.0 中轻松编辑了它们,但在 1.1.3 中找不到这些选项。如何在 1.1.3 中自定义这个

【问题讨论】:

    标签: ruby-on-rails spree


    【解决方案1】:

    您可以在 app/config/initializers/spree.rb 中设置这些选项

    Spree.config do |config|
    
      # Set country name and currency like this (Note: you will need to
      # run 'rake db:seed' before this. Change country name in
      # Spree::Country.find_by_name('Germany') replace Germany to your desired one)
    
      config.currency = 'EUR'
      country = Spree::Country.find_by_name('Germany')
      config.default_country_id = country.id if country.present?
    
      # You can also set following options too.
    
      config.site_name = "Todo Store"
      config.override_actionmailer_config = true
      config.enable_mail_delivery = true
    end
    

    【讨论】:

    • 非常有用,谢谢。是否有可以通过这种方式配置的其他内容的列表?我在想你是否显示“状态”等。
    • 这导致 db:schema:load 失败。将最后一行更改为 end if Spree::Country.table_exists? 修复它
    • 注意:它实际上是 config/initializers/spree.rb (我试图改变它,但编辑被拒绝)有人帮忙吗?
    【解决方案2】:

    您可以在 app/config/initializers/spree.rb 中设置这些选项

    Spree.config do |config|
      config.currency = 'Rs'  
      config.default_country_id = 105 # Your default country id 
    end
    

    【讨论】:

      猜你喜欢
      • 2015-05-10
      • 1970-01-01
      • 2012-05-08
      • 1970-01-01
      • 1970-01-01
      • 2019-03-04
      • 1970-01-01
      • 2010-09-19
      • 2023-04-04
      相关资源
      最近更新 更多