diff --git a/Gemfile b/Gemfile index a45bcd5a69..00dcd00b2b 100644 --- a/Gemfile +++ b/Gemfile @@ -39,6 +39,7 @@ end gem 'jquery-rails' + group :test, :development do # Pretty printed test output gem 'turn', '~> 0.8.3', :require => false @@ -51,5 +52,6 @@ group :test, :development do gem 'spork', '~> 1.0rc' gem 'pry-debugger' gem 'awesome_print' + gem "letter_opener" end diff --git a/Gemfile.lock b/Gemfile.lock index 94871fbd9d..852d464b57 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -214,6 +214,10 @@ GEM activesupport (>= 3.0.0) railties (>= 3.0.0) kgio (2.7.4) + launchy (2.1.2) + addressable (~> 2.3) + letter_opener (1.0.0) + launchy (>= 2.0.4) libv8 (3.3.10.4) libwebsocket (0.1.5) addressable @@ -365,6 +369,7 @@ DEPENDENCIES faker haml jquery-rails + letter_opener pg pry-debugger rails (= 3.2.11) diff --git a/app/views/spree/order_mailer/confirm_email.text.erb b/app/views/spree/order_mailer/confirm_email.text.erb index 1502123479..29549e4ffa 100644 --- a/app/views/spree/order_mailer/confirm_email.text.erb +++ b/app/views/spree/order_mailer/confirm_email.text.erb @@ -1,10 +1,11 @@ -Dear Customer, +Dear <%= @order.bill_address.firstname %>, Please review and retain the following order information for your records. ============================================================ Order Summary ============================================================ +Order for: <%= @order.bill_address.full_name %> <% @order.line_items.each do |item| %> <%= item.variant.sku %> <%= raw(item.variant.product.name) %> <%= raw(item.variant.options_text) -%> (<%=item.quantity%>) @ <%= number_to_currency item.price %> = <%= number_to_currency(item.price * item.quantity) %> <% end %> @@ -15,15 +16,22 @@ Subtotal: <%= number_to_currency @order.item_total %> <% end %> Order Total: <%= number_to_currency(@order.total) %> +<% if @order.payment_method.name.include? "EFT" %> ============================================================ -Delivery Details +Payment Details +============================================================ +<%= @order.payment_method.description.html_safe %> + +<% end %> +============================================================ +Collection / Delivery Details ============================================================ Address: <%= @order.distributor.name %> <% address = @order.distributor.address %> <%= address.address1 %> <%= ",\n #{address.address2}" unless address.address2.blank? %> <%= [address.city, address.state_text, address.zipcode, address.country.name].compact.join ', ' %> -Colection time: +Collection time: <%= @order.distributor.next_collection_at %> Contact: <%= @order.distributor.contact %> diff --git a/config/environments/development.rb b/config/environments/development.rb index 349ffc0a72..dfd2d7b171 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -27,6 +27,9 @@ Openfoodweb::Application.configure do # Expands the lines which load the assets config.assets.debug = true + + # Show emails using Letter Opener + config.action_mailer.delivery_method = :letter_opener end