Skip to content

Instantly share code, notes, and snippets.

@brandonsheppard
Created July 6, 2014 23:26
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 brandonsheppard/74e203d1e25a8af20255 to your computer and use it in GitHub Desktop.
Save brandonsheppard/74e203d1e25a8af20255 to your computer and use it in GitHub Desktop.
Standard Neto Shipping Calculator
<div class="panel panel-default" id="shipbox">
<div class="panel-heading">
<h3 class="panel-title">Calculate Shipping</h3>
</div>
<div class="panel-body">
<div class="row btn-stack">
<div class="col-xs-12 col-md-3">
<input type="number" name="input" id="n_qty" value="[@qty@]" size="2" class="form-control" placeholder="Qty">
</div>
<div class="col-xs-12 col-md-3">
<select id="country" class="form-control">
<!--##[%countries%]
[%PARAM *body%]##-->
<option value="[@country_code@]" [%DATA id:'country_code' if:'eq' value:'[@ship_country@]'%]selected[%END DATA%]>[@country_name@]</option>
<!--##[%END PARAM%]
[%END countries%]##-->
</select>
</div>
<div class="col-xs-12 col-md-3">
<input type="text" name="input" id="zip" value="[%SESSION id:'ship_zip'%][%END SESSION%]" size="5" class="form-control" placeholder="Post Code">
</div>
<div class="col-xs-12 col-md-3">
<button type="button" class="btn btn-block btn-primary btn-loads" data-loading-text="<i class='fa fa-refresh fa-spin' style='font-size: 14px'></i>" onClick="javascript:$.load_ajax_template('_buying_options', {'showloading': '1', 'qty': $('#n_qty').val() , 'ship_zip': $('#zip').val(), 'ship_country': $('#country').val()}),$(this).button('loading');" title="Calculate"><i class="fa fa-refresh"></i> Calculate</button>
</div>
</div>
<!--##[%SESSION id:'ship_zip' if:'ne' value:''%]##-->
<!--##[%shipping_methods sortby:'delivery_time' sku:'[@SKU@]' qty:'[@qty@]' zip:'[@ship_zip@]' country:'[@ship_country@]'%]
[%PARAM *header%]##-->
<br />
<!--##[%END PARAM%]
[%PARAM *body%]##-->
<hr />
<strong>[@shipping_method@]</strong> - <!--##[%format type:"currency"%]##-->[@cost@]<!--##[%END format%]##--> <!--##[%IF [@delivery_time@]%]##-->(ETA: [@delivery_time@] days)<!--##[%END IF%]##--><br />
<i class="text-muted">[@shipping_description@]</i>
<!--##[%END PARAM%]
[%PARAM *footer%]##-->
</p>
<!--##[%END PARAM%]
[%PARAM *ifempty%]##-->
<p class="alert alert-danger alert-shipping-error">Shipping not available to selected location.</p>
<!--##[%END PARAM%]
[%END shipping_methods%]##-->
<!--##[%END SESSION%]##-->
</div>
</div>
@TAARKS
Copy link

TAARKS commented Mar 13, 2023

Hi,

Is it possible to add a state selection to this code? Similar to what the checkout has?

@brandonsheppard
Copy link
Author

@TAARKS most likely. The same inputs from the cart would probably work on product pages: https://github.com/NetoECommerce/Skeletal/blob/master/src/templates/cart/includes/shipping_calc.template.html#L38

I'd reach out to Maropost support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment