Skip to content

Instantly share code, notes, and snippets.

@summersab
Created August 12, 2018 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save summersab/42cfa224647519dbeb76dfb8bbc917a2 to your computer and use it in GitHub Desktop.
Save summersab/42cfa224647519dbeb76dfb8bbc917a2 to your computer and use it in GitHub Desktop.
CN22 TWIG template for Order Desk
<!DOCTYPE html>
<html>
<head>
<title>{{ store_name }} CN22</title>
<link rel="stylesheet" href="{{ base_url }}/css/receipt.css">
<style>
h1,
h2,
p {
font-family: Arial, serif;
}
h1 {
font-size: 14px;
font-weight: bold;
margin: -2px;
}
h2 {
font-family: Arial, serif;
margin-top: 5px;
margin-bottom: 5px;
font-size: 17px;
font-weight: normal;
text-align: center;
}
h3 {
font-size: 10px;
font-weight: normal;
margin: -1px;
}
h3.bold {
font-weight: bold;
}
p {
font-size: 9px;
margin: -2px;
}
td {
padding: 0px;
border-spacing: 0px;
}
tr {
border-spacing: 0px;
}
hr {
height: 0px;
color: black;
background: transparent;
margin: 4px 0px 4px 0px;
border: none;
border-top: solid 1px black;
border-bottom: solid 1px black;
display: block;
}
.cn22 {
width: 398px;
height: 600px;
padding: 5px;
}
checkbox {
font-size: 28px;
line-height: 16px;
}
body {
margin: 0px;
}
</style>
</head>
<body id="printpage">
<a href="#" onclick="window.print(); return false;" id="printbutton" class="btn noprint">Print</a>
{% for key, order in orders %}
{% for shipment in order.order_shipments %}
{% if shipment.carrier_code == "USPS" %}
{% set tracking_number = shipment.tracking_number %}
{% set tracking_number_chunks = tracking_number|split('', 4) %}
<div class="cn22">
<img height="55px" style="display:block; margin-left:auto; margin-right:auto; width:75%" src="http://generator.barcodetools.com/barcode.png?gen=0&w=&h=120&btype=7&text=0&data={{ tracking_number}}">
<h2>{% for chunk in tracking_number_chunks %} {{ chunk }} {% endfor %}</h2>
<table>
<tr>
<td style="width:200px">
<h1>FROM</h1>
</td>
<td>
<h1>SHIP TO</h1>
</td>
</tr>
<tr>
<td>
<h3>{{ order.return_address.name|upper }}</h3>
</td>
<td>
<h3>{{ order.shipping.first_name|upper }} {{ order.shipping.last_name|upper }}</h3>
</td>
</tr>
<tr>
<td style="width:160px">
<h3>{{ order.return_address.company|upper }}</h3>
</td>
<td>
<h3>
{% if order.shipping.company is empty %}
{{ order.shipping.first_name|upper }} {{ order.shipping.last_name|upper }}
{% else %}
{{ order.shipping.company|upper }}
{% endif %}
</h3>
</td>
</tr>
<tr>
<td>
<h3>{{ order.return_address.address1|upper }}</h3>
</td>
<td>
<h3>{{ order.shipping.address1|upper }}</h3>
</td>
</tr>
<tr>
<td>
<h3>{{ order.return_address.city|upper }} {{ order.return_address.state|upper }} {{ order.return_address.postal_code|upper }}</h3>
</td>
<td>
<h3>{{ order.shipping.city|upper }} {{ order.shipping.state|upper }} {{ order.shipping.postal_code }}</h3>
</td>
</tr>
<tr>
<td>
<h3>UNITED STATES</h3>
</td>
<td>
<h3>UNITED STATES</h3>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
</table>
<hr>
<table>
<tr>
<td style="width:250px">
<h3 class="bold">United States Postal Service</h3>
</td>
<td>
<h3 class="bold" style="text-align: right !important">CN 22</h3>
</td>
</tr>
<tr>
<td>
<h3 class="bold">Customs Declaration</h3>
</td>
<td>
<h3 class="bold" style="text-align: right !important">May be opened officially</h3>
</td>
</tr>
</table>
<hr>
<table>
<tr>
<td style="width: 10%">
<checkbox>
{% if order.checkout_data.gift == 1 %}
{% else %}
{% endif %}
</checkbox>
</td>
<td style="width: 40%">
<h3 class="bold">Gift</h3>
</td>
<td style="width: 10%">
<checkbox>
{% if order.checkout_data.commercial_sample == 1 %}
{% else %}
{% endif %}
</checkbox>
</td>
<td style="width: 40%">
<h3 class="bold">Commercial Sample</h3>
</td>
</tr>
<tr>
<td style="width: 10%">
<checkbox>
{% if order.checkout_data.documents == 1 %}
{% else %}
{% endif %}
</checkbox>
</td>
<td style="width: 40%">
<h3 class="bold">Documents</h3>
</td>
<td style="width: 10%">
<checkbox>
{% if order.checkout_data.other == 1 %}
{% else %}
{% endif %}
</checkbox>
</td>
<td style="width: 40%">
<h3 class="bold">Other:</h3>
<h3>
{% if order.checkout_data.other_val is defined %}
{{ order.checkout_data.other_val }}
{% endif %}
</h3>
</td>
</tr>
</table>
<table>
<tr>
<td rowspan="2" style="vertical-align: bottom; width: 20px">
<p>Qty</p>
</td>
<td rowspan="2" style="vertical-align: bottom; width: 250px">
<p>Detailed description of contents</p>
</td>
<td style="width: 70px">
<p>Weight</p>
</td>
<td rowspan="2" style="vertical-align: bottom; width: 50px">
<p>Value (US$)</p>
</td>
</tr>
<tr>
<td>
<p>Lbs Oz</p>
</td>
</tr>
</table>
<hr>
<table style="height: 150px">
{% for item in order.order_items %}
<tr>
<td style="vertical-align: top; width: 20px">
<p>{{ item.quantity }}</p>
</td>
<td style="vertical-align: top; width: 250px">
<p>{{ item.name -}}
{%- if item.variation_list|length > 0 -%}
{%- for val in item.variation_list -%}
, {{ val }}
{%- endfor -%}
{% endif %}</p>
</td>
<td style="vertical-align: top; width:70px">
{% set weight = item.weight|split('.') %}
<p>{{ weight[0] }} Lbs {{ (item.weight - weight[0]) * 16 }} Oz</p>
</td>
<td style="vertical-align: top; width: 50px">
<p>{{ item.price|number_format(2) }}</p>
</td>
</tr>
{% endfor %}
<tr style="height:100%"></tr>
</table>
<hr>
<table style="margin: 5px 0px 5px 0px">
<tr>
<td style="width:270px">
<p>For commercial use only. If known, HS tariff
<br> number and country of origin goods.
</p>
</td>
<td style="width:70px; vertical-align: bottom">
<p>Total Weight</p>
</td>
<td style="width:50px">
<p>Total Value
<br> (US$)
</p>
</td>
</tr>
</table>
<hr>
<table style="margin: 5px 0px 5px 0px">
<tr>
<td style="width:270px">
<p>US</p>
</td>
<td style="width:70px">
{% set weight_total = order.weight_total|split('.') %}
<p>{{ weight_total[0] }} Lbs {{ (order.weight_total - weight_total[0]) * 16 }} Oz</p>
</td>
<td style="width:50px">
<p>{{ order.order_total|number_format(2) }}</p>
</td>
</tr>
</table>
<hr>
<table>
<tr>
<td style="width:200px">
<h3>Exemption/Exclusion Legend</h3>
</td>
<td>
<h3>NOEEI § 30.37(a)</h3>
</td>
</tr>
</table>
<hr>
<div style="margin: 2px 5px 2px 2px">
<p>I certify the particulars given in this customs declaration are correct. This item does not contain any dangerous article, or articles prohibited by legislation or by postal or customs regulations. I have met all applicable export filing requirements under the Foreign Trade Regulations.</p>
</div>
<hr>
<p style="margin-left: 0px">Sender's Signature and Date</p>
<table>
<tr>
<td style="width: 320px">
<img height="40px" style="display:block; src="">
</td>
<td>
<h3>{{ "now"|date('Y-m-d') }}
</td>
</tr>
</table>
<hr>
</div>
<p style="page-break-after: always;"></p>
{% endif %}
{% endfor %}
{% endfor %}
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment