Skip to content

Commit

Permalink
Refer to selected shipping rates directly
Browse files Browse the repository at this point in the history
This means that rates can be available on shipments, but not shipping methods

Useful for extensions like spree_easypost which only set rates and don't have shipping methods
  • Loading branch information
radar committed Jun 19, 2014
1 parent ac56524 commit 8bd2ece
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions backend/app/views/spree/admin/orders/_shipment.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
<% end %>

<tr class="show-method total">
<% if shipment.shipping_method %>
<% if rate = shipment.selected_shipping_rate %>
<td colspan="4">
<strong><%= shipment.shipping_method.name %></strong>
<strong><%= rate.name %></strong>
</td>
<td class="total" align="center">
<span><%= shipment.display_cost %></span>
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/views/spree/shared/_order_details.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<% order.shipments.each do |shipment| %>
<div>
<i class='fa fa-truck'></i>
<%= Spree.t(:shipment_details, :stock_location => shipment.stock_location.name, :shipping_method => shipment.shipping_method.name) %>
<%= Spree.t(:shipment_details, :stock_location => shipment.stock_location.name, :shipping_method => shipment.selected_shipping_rate.name) %>
</div>
<% end %>
</div>
Expand Down Expand Up @@ -108,7 +108,7 @@
<% end %>

<tfoot id='shipment-total'>
<% order.shipments.group_by { |s| s.shipping_method.name }.each do |name, shipments| %>
<% order.shipments.group_by { |s| s.selected_shipping_rate.name }.each do |name, shipments| %>
<tr class="total" data-hook='shipment-row'>
<td colspan="4"><%= Spree.t(:shipping) %>: <strong><%= name %></strong></td>
<td class="total"><span><%= Spree::Money.new(shipments.sum(&:discounted_cost), currency: order.currency).to_html %></span></td>
Expand Down

0 comments on commit 8bd2ece

Please sign in to comment.