Tak jsem se nakonec se všemi radami prokousal k cíli ;) Vyřešil jsem to pěkně ajaxem
PHP::
foreach ($postaCSV->getDBsluzby() as $z)
{
$output[] = array('code' => $z['code'], 'action' => FALSE);
if (Configuration::get('MODULE_DOBIRKA') == $order->module && Configuration::get('DEFAULT_DOBIRKA') == $z['code'])
$output[] = array('code' => $z['code'], 'action' => TRUE);
foreach ($postaCSV->selectDBbaliky(' WHERE `id_carrier` = \''.Tools::getValue('id_order_carrier').'\' AND `code_zasilky` = \''.Tools::getValue('submitPostaSluzbyAjax').'\'') as $k)
if ($z['code'] != $k['id_sluzby'] || (Configuration::get('MODULE_DOBIRKA') == $order->module && Configuration::get('DEFAULT_DOBIRKA') == $z['code']))
$output[] = array('code' => $k['id_sluzby'], 'action' => TRUE);
}
die(Tools::jsonEncode($output));
Kód vložený do šablony ::
<select name="{$order->id}_balik_{$order->id_carrier}" id="{$order->id}_balik_{$order->id_carrier}" style="width:100px;">
{foreach $selectDBdopravci as $z}
{foreach $selectDBzasilky as $k}
{if $k['code'] == $z['code_zasilky']}
<option type="text" label="{$k['code']} - {$k['name']}" value="{$z['code_zasilky']}" {if $z['code_zasilky'] == {$DEFAULT}}selected="selected"{/if}>{$z['code_zasilky']}</option>
{/if}
{/foreach}
{/foreach}
</select>
<a id="{$order->id}mk_settings_anchor" class="settings_anchor" title="{l s='Nastavit '}" style="float:right">
<span class="monosp">[+]</span>
</a>
<div class="settings_group_table" id="{$order->id}mk_settings" style="display:none">
<table class="group_table">
<tr>
{assign var=nazev value=1}
{foreach $selectDBsluzby as $z}
{if $z['active']==2}
<td style="width:1%;">{$z['code']}</td>
<td style="width:20%;">{$z['name']}</td>
<td style="width:1%;">
<input type="checkbox" id="{$order->id}_sluzba_{$z['code']}" name="{$order->id}_sluzba_{$z['code']}" value="{$z['code']}" {if in_array($z['code'], $typ_dopravci)}checked="checked"{/if} {if ($module_dobirka == $order->module) && ($default_dobirka == $z['code'])}checked="checked"{/if}>
</td>
{if $nazev == 1 || $nazev == 2 || $nazev == 3}
<td style="width:3%;">
</td>
{/if}
{if $nazev == 4}
</tr>
<tr>
{assign var=nazev value=0}
{/if}
{assign var=nazev value={$nazev}+1}
{/if}
{/foreach}
</tr>
</table>
</div>
<span class="success_{$order->id}" style="display:none"><a href="{$linka}" target="_new" title="{l s='Zobrazit sledování'}">
<img src="../img/t/AdminFeatures.gif" alt="Zobrazit sledování" /></a></span>
<input type="hidden" id="CSV_{$order->id}" name="CSV_{$order->id}" value="{$order->id}" />
<input type="hidden" id="CSV_carrier_{$order->id}" name="CSV_carrier_{$order->id}" value="{$order->id_carrier}" />
<script type="text/javascript" >
$(function() {
$("#{$order->id}_balik_{$order->id_carrier}").change(function() {
$.ajax({
url: "{$link->getAdminLink('AdminOrders')}",
type:"POST",
dataType: "json",
data : {
submitPostaSluzbyAjax : $("#{$order->id}_balik_{$order->id_carrier}").val(),
id_order : $("#CSV_{$order->id}").val(),
id_order_carrier : $("#CSV_carrier_{$order->id}").val()
},
success: function(jsonData) {
for(var i= 0; i < jsonData.length; i++)
$('#{$order->id}_sluzba_' + jsonData[i].code).attr('checked',jsonData[i].action);
}
});
});
});
</script>
Snad to pomůže i někomu jinému