update ant_support_form

This commit is contained in:
Marion Muszynski 2016-02-25 12:24:15 +01:00
parent 09ee75be23
commit af731eae69
3 changed files with 624 additions and 605 deletions

File diff suppressed because it is too large Load Diff

View File

@ -27,18 +27,23 @@ if ($cookie->isLogged()) {
$date = explode(' ', $order->date_add);
$orders[$row['id_order']] = Tools::displayDate($date[0], $cookie->id_lang);
$tmp = $order->getProducts();
foreach ($tmp as $key => $val)
$products[$val['product_id']] = $val['product_name'];
foreach ($tmp as $key => $val) {
//$products[$val['product_id']] = $val['product_name'];
$products[$row['id_order']] = array(
'id' => $val['product_id'],
'name' => $val['product_name']
);
}
}
$orderList = '';
foreach ($orders as $key => $val) {
$orderList .= '<option value="'.$key.'" '.((int)(Tools::getValue('id_order')) == $key ? 'selected' : '').' >'.$key.' -- '.$val.'</option>';
$orderList .= '<option value="'.$key.'" '.((int)(Tools::getValue('id_order')) == $key ? 'selected' : '').' >'.$val.' -- '.$key.'</option>';
}
$orderedProductList = '';
foreach ($products as $key => $val) {
$orderedProductList .= '<option value="'.$key.'" '.((int)(Tools::getValue('id_product')) == $key ? 'selected' : '').' >'.$val.'</option>';
$orderedProductList .= '<option value="'.$val['id'].'" data-order="'.$key.'" '.((int)(Tools::getValue('id_product')) == $val['id'] ? 'selected' : '').' >'.$val['name'].'</option>';
}
$smarty->assign('orderList', $orderList);
$smarty->assign('orderedProductList', $orderedProductList);
@ -283,5 +288,3 @@ require_once(dirname(__FILE__).'/../../header.php');
echo Module::display(dirname(__FILE__), 'support.tpl');
require_once(dirname(__FILE__).'/../../footer.php');

View File

@ -34,7 +34,7 @@
{if !isset($customerThread.id_order) && isset($isLogged) && $isLogged == 1 && !empty($orderList)}
<p class="text">
<label for="id_order">{l s='Order ID' mod='ant_support_form'}</label>
<select name="id_order" ><option value="0">{l s='-- Choose --' mod='ant_support_form'}</option>{$orderList}</select>
<select name="id_order" id='id_order'><option value="0">{l s='-- Choose --' mod='ant_support_form'}</option>{$orderList}</select>
{elseif !isset($customerThread.id_order) && !isset($isLogged)}
<p class="text">
<label for="id_order">{l s='Order ID' mod='ant_support_form'}</label>
@ -53,7 +53,7 @@
{if !isset($customerThread.id_product) && !empty($orderedProductList)}
<p class="text">
<label for="id_product">{l s='Product' mod='ant_support_form'}</label>
<select name="id_product" style="width:300px;"><option value="0">{l s='-- Choose --'}</option>{$orderedProductList}</select>
<select name="id_product" id='id_product' style="width:300px;"><option value="0">{l s='-- Choose --'}</option>{$orderedProductList}</select>
</p>
{elseif $customerThread.id_product > 0}
<p class="text">
@ -86,13 +86,13 @@
</select>
</p>
{/if}
{*{if $fileupload == 1}
{if $fileupload == 1}
<p class="text">
<label for="fileUpload">{l s='Attach File' mod='ant_support_form'}</label>
<input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
<input type="file" name="fileUpload" id="fileUpload" />
</p>
{/if}*}
{/if}
{if isset($reasons) && !empty($reasons)}
<p class="select">
<label for="id_reason">{l s='Reason' mod='ant_support_form'}</label>
@ -137,6 +137,21 @@
}
});
});
if ($('select#id_product').length>0) {
$('#id_product option[data-order!="'+ $("option:selected", $('#id_order')).val()+'"]').each(function(index, el) {
$(this).hide();
});
$('#id_order').change(function() {
$('#id_product option[value!="0"]').each(function(index, el) {
if ($(this).data('order') != $("option:selected", $('#id_order')).val()) {
$(this).hide();
} else {
$(this).show();
}
});
});
}
});
</script>
{/literal}