<{if $product = $webshop->getProductById($product_id)}> <{if $profile = $product->getProfile()}> <{assign var="attr" value=$profile->getAttributeList()}> <{assign var="category" value=$product->getMainCategory()}> <{assign var="category" value=$category|default:$product->getCategory()}> <{if $category}> <{assign var="category_id" value=$category->getCategoryId()}> <{/if}> <{assign var="product_images" value=$product->getImages()}> <{section name="j" loop=$product_images start=0 max=1}> <{assign var="product_thumb" value=$product_images[j]->getSrc(200, 200)}> <{/section}> <{assign var="package_size" value=$product->getPackage()}> <{if $package_size}> <{assign var="quantity" value=$product->getPackage()}> <{/if}> <{assign var="allow_backorder" value=$allow_backorder|default:1}> <{* Customer input (product personalization, GH #905) is rendered INSIDE this form, like every other theme does, so the fields have a form owner: required fires and a native submit carries attributes[...]. Only the product view asks for them — product cards and the variant dropdown cannot collect customer input. $has_js_variant: Delaware picks the variant in JavaScript only (no name="" on the variant controls), so a form for a variant product must NOT be able to post natively — it would reach the cart without a variant. *}> <{$has_customer_file = false}> <{$has_js_variant = false}> <{foreach $attr as $atc}> <{if $show_customer_attributes && $atc->isCustomerInput() && $atc->getDataType() == 'file'}> <{$has_customer_file = true}> <{/if}> <{if $show_variant && $atc->getIsVariant()}> <{$has_js_variant = true}> <{/if}> <{/foreach}>
method="post" action="/"<{if $has_customer_file}> enctype="multipart/form-data"<{/if}><{/if}> x-data="addToCart( <{$product_id}>, <{$product_attr_id|default:'null'}>, <{$product_attr_value_id|default:'null'}>, '<{$product_thumb|default:''}>', <{$category_id|default:'null'}>, <{$quantity|default:'1'}>, <{$package_size|default:'1'}>, <{$max_quantity|default:'null'}>, <{$min_quantity|default:'1'}>, <{if $allow_backorder == 1}>true<{else}>false<{/if}>, <{$stock|default:'null'}>, <{$show_modal|default:'true'}>, {}, <{$comment_attribute_id|default:'null'}>, {}, '<{$product->getName()|replace:'"':"'"|escape:javascript|default:'null'}>', <{$product->getRealPrice()|default:'null'}>, '<{$product->getBrandName()|replace:'"':"'"|escape:javascript|default:'null'}>' )" @submit.prevent="submit" @quantity-selected.window="handleQuantitySelection" @variant-selected.window="handleVariantSelection" @comment-changed.window="handleCommentChange" > <{if $show_variant}> <{section name="j" loop=$attr}> <{if $attr[j]->getIsVariant()}> <{if $attr[j]->getDataType() == "valuelist"}> <{include file="components/attribute-dropdown.html" product=$product attr=$attr[j] }> <{elseif $attr[j]->getDataType() == "string"}> <{elseif $attr[j]->getDataType() == "integer"}> <{elseif $attr[j]->getDataType() == "boolean"}> <{/if}> <{/if}> <{/section}> <{/if}> <{if $show_customer_attributes}> <{include file="components/product-view-customer-attributes.html" product=$product}> <{/if}>
<{if $show_quantity}>
<{else}> <{/if}> <{if $show_badge && $settings.integrations.enable_emaerket }> <{include file="components/svg.html" class="brandbar__actions-svg--emaerket" icon="brand-emaerket"}> <{/if}>
<{if $show_quantity}> <{* Show invalid amount error *}>

<{t}>This item is only sold in badges of<{/t}> .

<{t}>or<{/t}>

<{* Shows max_reached/min_reached -- should be transformed to relevant output *}>
<{t}>You need to select a variant.<{/t}>
<{* Generalized: also fires for missing required customer-input fields (GH #905) *}>
<{t}>Please fill in all required fields.<{/t}>
<{t}>Minimum quantity reached.<{/t}>
<{t}>Maximum quantity reached<{/t}>
<{if $settings.product.enable_backorder_message}>
<{t}>You are ordering more than we have in stock at the moment. Current stock is<{/t}> .
<{/if}> <{/if}> <{* Addons *}> <{if $show_addons}> <{if $product->getExtensionValue('addon_product_ids') || $product->getMetaValue('addon_ids')}> <{if $product->getExtensionValue('addon_product_ids')}> <{assign var="addonIds" value=","|explode:$product->getExtensionValue('addon_product_ids')}> <{else}> <{assign var="addonIds" value=","|explode:$product->getMetaValue('addon_ids')}> <{/if}> <{/if}> <{if $addonIds|@count === 0}> <{assign var="category" value=$product->getCategory()}> <{if $category && $category->getMetaValue('addon_ids')}> <{assign var="addonIds" value=","|explode:$category->getMetaValue('addon_ids')}> <{else}> <{if $category && $addonIds|@count === 0}> <{assign var="parentCategories" value=$category->getParents()}> <{section name="c" loop=$parentCategories}> <{if $parentCategories[c]->getMetaValue('addon_ids') && $addonIds|@count === 0}> <{assign var="addonIds" value=","|explode:$parentCategories[c]->getMetaValue('addon_ids')}> <{/if}> <{/section}> <{/if}> <{/if}> <{/if}> <{if $addonIds}>

<{t}>Add to cart with<{/t}>

<{* Egen alert her frem for sammen med de øvrige: de ligger inde i $show_quantity og renderes derfor ikke på produkter uden antalsvælger. *}>
<{t}>Please select a variant for the add-on product.<{/t}>
<{/if}> <{/if}>
<{/if}> <{/if}>