drhenner / ror_ecommerce

Ruby on Rails Ecommerce platform, perfect for your small business solution.
www.ror-e.com
MIT License
1.21k stars 409 forks source link

Cannot add international addresses #81

Closed TopperH closed 11 years ago

TopperH commented 11 years ago

In app/views/myaccount/addresses/_form.html.erb around line 42, there is no possibility to add an International address:

      <% if nil %>
        <div class="field four">
          <%= f.label :state_name %>
          <%= f.text_field :state_name %>                      
        </div>
      <% end %>
      <% if Settings.require_state_in_address %>               
        <div class="field four columns">
          <%= f.label    :state_id, "State/Province" %>        
          <%= f.select   :state_id, @states,
                        :include_blank => true %>              
        </div> 
      <% end %>

Here is a quick fix that works for me, but makes a lot of tests to fail. I wish my rails skills were good enough to send a proper fix :(

      <% if nil %>
        <div class="field four">
          <%= f.label :state_name %>
          <%= f.text_field :state_name %>                      
        </div>
      <% end %>
      <% if Settings.require_state_in_address %>               
        <div class="field four columns">
          <%= f.label    :state_id, "State/Province" %>        
          <%= f.select   :state_id, @states,
                        :include_blank => true %>              
        </div> 
      <% else %>
        <div class="field column">
          <%= f.label    :country_id, "Country" %>
          <%= f.select   :country_id, select_countries,
                        :include_blank => true %>
        </div>
      <% end %>
drhenner commented 11 years ago

Ah yes... I rarely test in this mode. I'll do a copy paste or feel free to do a pull request.

TopperH commented 11 years ago

I'm not very familiar with git. Please copy/paste it yourself. Thank you.

drhenner commented 11 years ago

Will do thanks for everything

drhenner commented 11 years ago

Should be good.. thanks

TopperH commented 11 years ago

I would go with something like this, to make clear to eventual foreign users that they can buy only if they have an address in the default country:

      <% elsif countries.size == 1 %>                          
        <div class="field column"> 
          <%= f.label :country_id, "Country" %>                
          <%= countries.first.name %>
          <%= f.hidden_field   :country_id %>                  
        </div>
drhenner commented 11 years ago

yes... I'll do that now

drhenner commented 11 years ago

all good