Coder Social home page Coder Social logo

Comments (4)

mtomov avatar mtomov commented on May 22, 2024

👍 It would be especially good if the emails fit well on on a mobile device screen.

@BenMorganIO had a huge contribution on getting the emails to work with Foundation Ink, so it should be rather easy to add a bit of style.

from solidus.

BenMorganIO avatar BenMorganIO commented on May 22, 2024

I'd rather move the HTML emails to something like Blot this way a lot of the email templating is just automagically created and there's not tons of HTML tables to look at.

from solidus.

jhawthorn avatar jhawthorn commented on May 22, 2024

Closing due to staleness. (though I would still like better default templates)

from solidus.

gildardoperez avatar gildardoperez commented on May 22, 2024

Tutorial on how to customize your email confirmations in Solidus: https://www.bradient.com/posts/how-to-customize-your-email-confirmations-in-solidus-open-source-ecommerce

Order Confirm Email HTML Template:

<!-- app/views/spree/order_mailer/confirm_email.html.erb -->
<table>
  <tr>
    <td>
      <p>&nbsp;</p>
      <p class="lede">
        <% if @order.billing_firstname %>
          Dear <%= @order.billing_firstname %>,
        <% else %>
          <%= t('.dear_customer') %>
        <% end %>
      </p>
      <p>
        Thank you for your purchase from <%= @store.url %>. Please review and retain the following order information for your records.
        <%#= t('.instructions') %>
      </p>
      <p>&nbsp;</p>
      <p>Order Number: &#x23;<%= @order.number %></p>
      <p>Order Date: <%= @order.created_at.strftime("%m/%d/%Y") %></p>
      <p>&nbsp;</p>
      <p><b><%= t('.order_summary').upcase %></b></p>
      <br>
      <table>
          <thead>
            <tr>
              <th width="30%"></th>
              <th width="17%">Sku</th>
              <th width="17%">Name</th>
              <th width="8%">Qty</th>
              <th width="14%">Price</th>
              <th width="14%">Total</th>
            </tr>
            <tr>
              <th colspan="6">
                <hr>
              </th>
            </tr>
          </thead>
        <% @order.line_items.each do |item| %>
          <tr>
            <td>
              <%= render 'spree/admin/shared/image', image: item.variant.display_image, size: :mini %>
            </td> 
            <td><%= item.variant.sku %></td>
            <td>
              <%= item.variant.product.name %>
              <br>
              <%= item.variant.options_text -%>
            </td>
            <td><%=item.quantity%></td>
            <td><%= item.single_money %></td>
            <td><%= item.display_amount %></td>
          </tr>
        <% end %>
        <tr>
          <td colspan="6">
            <hr>
          </td>
        </tr>
        <tr>
          <td colspan="3"></td>
          <td colspan="2">
            <%= t('.subtotal') %>
          </td>
          <td>
            <%= @order.display_item_total %>
          </td>
        </tr>
        <% if @order.line_item_adjustments.exists? %>
          <% if @order.all_adjustments.promotion.eligible.exists? %>
            <% @order.all_adjustments.promotion.eligible.group_by(&:label).each do |label, adjustments| %>
              <tr>
                <td colspan="3"></td>
                <td colspan="2">
                  <%= t('spree.promotion') %> <%= label %>:
                </td>
                <td><%= Spree::Money.new(adjustments.sum(&:amount), currency: @order.currency) %></td>
              </tr>
            <% end %>
          <% end %>
        <% end %>
        <% @order.shipments.group_by { |s| s.selected_shipping_rate.try(:name) }.each do |name, shipments| %>
          <tr>
            <td colspan="3"></td>
            <td colspan="2">
              <%= t('spree.shipping') %> <%= name %>:
            </td>
            <td><%= Spree::Money.new(shipments.sum(&:total_before_tax), currency: @order.currency) %></td>
          </tr>
        <% end %>
        <% if @order.all_adjustments.eligible.tax.exists? %>
          <% @order.all_adjustments.eligible.tax.group_by(&:label).each do |label, adjustments| %>
            <tr>
              <td colspan="3"></td>
              <td colspan="2">
                <%#= t('spree.tax') %> <%= label %>
              </td>
              <td><%= Spree::Money.new(adjustments.sum(&:amount), currency: @order.currency) %></td>
            </tr>
          <% end %>
        <% end %>
        <% @order.adjustments.eligible.each do |adjustment| %>
          <% next if (adjustment.source_type == 'Spree::TaxRate') and (adjustment.amount == 0) %>
          <tr>
            <td colspan="3"></td>
            <td colspan="2">
              <%= adjustment.label %>
            </td>
            <td><%= adjustment.display_amount %></td>
          </tr>
        <% end %>
          <tr>
            <td colspan="3"></td>
            <td colspan="2">
              <%= t('.total') %>
            </td>
            <td>
              <%= @order.display_total %>
            </td>
          </tr>
      </table>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>We will notify you when your order ships. If you have any questions, please contact us at <u><%= @store.mail_from_address %></u>.
        <%#= t('.thanks') %>
      </p>
    </td>
    <td class="expander"></td>
  </tr>
</table>

Preview Template:
http://localhost:3000/rails/mailers/spree/mailer_previews/order/confirm

from solidus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.