{* Smarty template *}
{assign var="fieldCycleName" value="commodities"}
{include file="form_errors.tpl"}
<form {$form.attributes}>
<table cellpadding="0" cellspacing="0" border="0" class="modificationTable">
<tr>
<th>
{$form.title.label}
</th>
<td>
{$form.title.html}
</td>
</tr>
<tr>
<th>
{$form.orderNumber.label}
</th>
<td>
{$form.orderNumber.html}
</td>
</tr>
<tr>
<th>
{$form.image.label}
</th>
<td>
{$form.image.html}
</td>
</tr>
{if $imageId !== null}
<tr>
<th>
{message key='commodity.form.existingImage'}
</th>
<td>
{assign var='commodityImageId' value=$imageId}
{include file='commodity/image_thumbnail.tpl'}
</td>
</tr>
{/if}
{if $form.deleteImage}
<tr>
<th>
{$form.deleteImage.label}
</th>
<td>
{$form.deleteImage.html}
</td>
</tr>
{/if}
</table>
<h2>{$form.description.label}</h2>
{$form.description.html}
<script type="text/javascript">
var visibleRowsNumber = {$rowsNumber};
var maxRowsNumber = {$maxRowsNumber};
var initialRowsNumber = {$initialRowsNumber};
var formName = '{$formName}';
</script>
<h2>{message key='commodity.form.attributes'}</h2>
<div class="attributesForm">
<table cellspacing="0" cellpadding="0"><tr>
<th>{message key='commodity.form.attribute.title'}</td>
<th>{message key='commodity.form.attribute.value'}</td>
</tr></table>
{assign var="step" value=0}
{foreach from=$form.attributeTitle key=k item=t}
{if $step < $rowsNumber}
{assign var="divStyle" value=''}
{else}
{assign var="divStyle" value=' style="display: none;"'}
{/if}
<div id="attribute_row_{$k}" class="attributeRow" {$divStyle}>
<table cellspacing="0" cellpadding="0"><tr>
<td>
<span class="attributeTitle">
{$form.attributeTitle[$k].html}
</span>
</td>
<td>
<span class="attributeValue">
{$form.attributeValue[$k].html}
</span>
</td>
<td>
<span class="attributeRowButtons">
<a href="javascript:insertAttributeRowAbove({$k})"><img src="images/plus.gif" width="16" height="16" border="0" alt="{message key='commodity.form.addRow'}"></a>
<a href="javascript:removeAttributeRow({$k})"><img src="images/delete.gif" width="16" height="16" border="0" alt="{message key='commodity.form.deleteRow'}"></a>
</span>
</td>
</tr></table>
</div>
{math assign="step" equation="x + 1" x=$step}
{/foreach}
</div>
<div class="attributeTableButtons">
{message assign='btnTitle' key='commodity.form.addRows'}
{button title=$btnTitle onClick='addAttributeRows();' class='form_button_long'}
{message assign='btnTitle' key='commodity.form.deleteEmptyRows'}
{button title=$btnTitle onClick='removeTailEmptyAttributeRows();' class='form_button_long'}
</div>
{$form.name}
<div class="bottomMargin"></div>
{$form.submit.html}
{$form.cancel.html}
</form>
{include file="bottom_buttons.tpl"}
{include file="bottom_links.tpl"}