dhllabel: Add support to generate DHL CSV files to be uploaded
This allows to download a CSV file that can be uploaded to DHL.de. This should kill the need to copy and paste shipping labels.
This commit is contained in:
parent
fdd048d1e3
commit
003ed11c14
|
@ -0,0 +1,11 @@
|
|||
Admin::ShipmentsController.class_eval do
|
||||
def dhllabel
|
||||
load_shipment
|
||||
name = '%s_dhllabel.csv' % [@order.number]
|
||||
headers["Content-type"] = "text/plain"
|
||||
headers["Cache-Control"] = "no-cache, max-age=0, must-revalidate"
|
||||
headers["Pragma"] = "no-cache"
|
||||
headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
|
||||
headers["Content-Disposition"] = "attachment; filename=\"%s\"" % name
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
<% if @shipment.can_ship? %>
|
||||
<li>
|
||||
<%= button_link_to t(:dhl_label), dhllabel_admin_order_shipment_url(:format => :txt)%>
|
||||
</li>
|
||||
<% end %>
|
|
@ -0,0 +1,2 @@
|
|||
SEND_NAME1,SEND_NAME2,SEND_STREET,SEND_HOUSENUMBER,SEND_PLZ,SEND_CITY,SEND_COUNTRY,RECV_NAME1,RECV_NAME2,RECV_STREET,RECV_HOUSENUMBER,RECV_PLZ,RECV_CITY,RECV_COUNTRY,PRODUCT,COUPON
|
||||
"sysmocom - s.f.m.c GmbH","Holger Freyther","Schivelbeinerstr.","5","10439","Berlin","DEU","<%= @shipment.address.firstname %> <%= @shipment.address.lastname %>","<%= @shipment.address.address2 %>","<%= @shipment.address.address1 %>","","<%= @shipment.address.zipcode %>","<%= @shipment.address.city %>","<%= @shipment.address.country.iso3 %>","",""
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
en:
|
||||
dhl: DHL
|
||||
dhl_label: "DHL Label (CSV)"
|
||||
dhls: DHL
|
||||
|
|
|
@ -4,7 +4,17 @@ Rails.application.routes.draw do
|
|||
resources :dhls do
|
||||
resources :coupons
|
||||
end
|
||||
|
||||
# Add access to the dhllabel function
|
||||
resources :orders do
|
||||
resources :shipments do
|
||||
member do
|
||||
get :dhllabel
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
match "/admin/dhl" => 'admin/dhls#index', :as => :admin
|
||||
end
|
||||
|
|
|
@ -3,4 +3,7 @@ class SysmocomDhlHooks < Spree::ThemeSupport::HookListener
|
|||
insert_after :admin_tabs do
|
||||
"<%= tab(:dhls) %>"
|
||||
end
|
||||
|
||||
# Add the DHL label download
|
||||
insert_after :admin_shipment_edit_buttons, 'admin/dhls/address_label'
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue