{% extends "commerce/_layouts/cp" %} {% set title = productType.id ? productType.name : 'Create a new product type'|t('commerce') %} {% set crumbs = [ { label: "Commerce Settings"|t('commerce'), url: url('commerce/settings') }, { label: "Product Types"|t('commerce'), url: url('commerce/settings/producttypes') }, ] %} {% set selectedSubnavItem = 'settings' %} {% set fullPageForm = true %} {% import "_includes/forms" as forms %} {% block content %} {{ redirectInput('commerce/settings/producttypes') }} {% if productType.id %} {% endif %}
{product.slug}
', ex2: '{myVariantCustomField}
' }),
id: 'skuFormat',
class: 'code ltr',
name: 'skuFormat',
value: productType.skuFormat,
errors: productType.getErrors('skuFormat')
}) }}
{{ forms.textField({
label: "Order Description Format"|t('commerce'),
instructions: "How this product will be described on a line item in an order. You can include tags that output properties, such as {ex1} or {ex2}"|t('commerce', { ex1: '{product.title}
', ex2: '{myVariantCustomField}
' }),
id: 'descriptionFormat',
class: 'code ltr',
name: 'descriptionFormat',
value: productType.descriptionFormat,
errors: productType.getErrors('descriptionFormat')
}) }}
{{ forms.checkboxField({
label: "Show the Dimensions and Weight fields for products of this type"|t('commerce'),
id: 'hasDimensions',
name: 'hasDimensions',
checked: productType.hasDimensions,
}) }}
{% macro hasVariantsField(productType) %}
{% from "_includes/forms" import checkboxField %}
{% set hasVariantsInstructions %}
{%- spaceless %}
{% if productType.id and productType.hasVariants %}
{{ "Careful—your existing variant data will be deleted if you change this." }}
{% endif %}
{% endspaceless -%}
{% endset %}
{{ checkboxField({
label: "Products of this type have multiple variants"|t('commerce'),
instructions: hasVariantsInstructions,
id: 'hasVariants',
name: 'hasVariants',
checked: productType.hasVariants,
toggle: '#variant-settings'
}) }}
{% endmacro %}
{% macro templateField(productType) %}
{% from "_includes/forms" import textField %}
{{ textField({
label: "Product Template"|t('commerce'),
instructions: "The template to use when a product’s URL is requested."|t('commerce'),
id: 'template',
class: 'ltr',
name: 'template',
value: productType.template,
errors: productType.getErrors('template')
}) }}
{% endmacro %}
{% macro titleFormatField(productType) %}
{% from "_includes/forms" import textField, checkboxField %}
{sku}
', ex2: '{myVariantsCustomField}
' }),
id: 'titleFormat',
class: 'code ltr',
name: 'titleFormat',
value: productType.titleFormat,
errors: productType.getErrors('titleFormat')
}) }}