{% extends "commerce/_layouts/cp" %} {% set crumbs = [ { label: "Commerce Settings"|t('commerce'), url: url('commerce/settings') }, { label: "Shipping Methods"|t('commerce'), url: url('commerce/shipping/shippingmethods') }, ] %} {% set selectedSubnavItem = 'shipping' %} {% set fullPageForm = true %} {% import "_includes/forms" as forms %} {% set tabs = { 0: {'label':'Shipping Method'|t('commerce'),'url':'#shipping-method-tab'} } %} {% if shippingMethod.id %} {% set tabs = tabs|merge({1: {'label':'Rules'|t('commerce'),'url':'#rules'}}) %} {% endif %} {% block saveButton %} {% endblock %} {% block content %}
{{ redirectInput('commerce/shipping/shippingmethods/{id}#rules') }} {% if shippingMethod.id %} {% endif %} {{ forms.textField({ first: true, label: "Name"|t('commerce'), instructions: "What this shipping method will be called in the CP."|t('commerce'), id: 'name', name: 'name', value: shippingMethod.getName(), errors: shippingMethod.getErrors('name'), autofocus: true, required: true, }) }} {{ forms.textField({ first: true, label: "Handle"|t('commerce'), instructions: "How this shipping method will be referred to in templates and forms."|t('commerce'), id: 'handle', class: 'code', name: 'handle', value: shippingMethod.handle, errors: shippingMethod.getErrors('handle'), required: true, }) }} {{ forms.lightSwitchField({ label: "Enable this shipping method on the front end"|t('commerce'), id: 'enabled', name: 'enabled', on: shippingMethod.enabled, errors: shippingMethod.getErrors('enabled') }) }}
{% endblock %} {% js %} {% if not shippingMethod.id %}new Craft.HandleGenerator('#name', '#handle');{% endif %} var adminTable = new Craft.AdminTable({ tableSelector: '#shipping-rules', noObjectsSelector: '#no-shipping-rules', deleteAction: 'commerce/shipping-rules/delete', sortable: true, reorderAction: 'commerce/shipping-rules/reorder', reorderSuccessMessage: Craft.t('commerce', 'Rules reordered.') , reorderFailMessage: Craft.t('commerce', 'Couldn’t reorder rules..') , confirmDeleteMessage: Craft.t('commerce', 'Are you sure you want to delete “{name}”?') , deleteSuccessMessage: Craft.t('commerce', '“{name}” deleted.') , deleteFailMessage: Craft.t('commerce', 'Couldn’t delete “{name}”.') , }); {% endjs %}