вставил, но так и не заработал автокомплит.
<script type="text/javascript"><!--
$('input#stark<?php echo $module_row; ?>').autocomplete({
delay: 0,
source: function(request, response) {
$.ajax({
url: 'index.php?route=catalog/product/autocomplete&token=<?php echo $token; ?>&filter_name=' + encodeURIComponent(request.term),
dataType: 'json',
success: function(json) {
response($.map(json, function(item) {
return {
label: item.name,
value: item.product_id
}
}));
}
});
},
select: function(event, ui) {
//$('#featured-stark<?php echo $module_row; ?>' + ui.item.value).remove();
$('#featured-stark<?php echo $module_row; ?>').append('<div id="featured-stark<?php echo $module_row; ?>' + ui.item.value + '">' + ui.item.label + '<img src="view/image/delete.png" /><input type="hidden" value="' + ui.item.value + '" name="stark_module[<?php echo $module_row; ?>][stark_ids][]" /></div>');
$('#featured-stark<?php echo $module_row; ?> div:odd').attr('class', 'odd');
$('#featured-stark<?php echo $module_row; ?> div:even').attr('class', 'even');
//data = $.map($('#featured-stark<?php echo $module_row; ?> input'), function(element){
// return $(element).attr('value');
//});
// $('input[name=\'stark\']').attr('value', data.join());
return false;
},
focus: function(event, ui) {
return false;
}
});
$('#featured-stark<?php echo $module_row; ?> div img').live('click', function() {
$(this).parent().remove();
});
//--></script>
<?php $module_row++; ?>
<?php } ?>
<tfoot>
<tr>
<td colspan="6"></td>
<td class="left"><a onclick="addModule();" class="button"><?php echo $button_add_module; ?></a></td>
</tr>
</tfoot>
</table>
</form>
</div>
</div>
</div>
<script type="text/javascript"><!--
var module_row = <?php echo $module_row; ?>;
function addModule() {
html = '<tbody id="module-row' + module_row + '">';
html += ' <tr>';
html += ' <td class="left"><input type="text" id="stark<?php echo $module_row; ?>"/><div id="featured-stark<?php echo $module_row; ?>" class="scrollbox"></div><?php $class = "odd"; ?><?php foreach ($module["names"] as $id => $product_name) { ?> <?php $class = ($class == "even" ? "odd" : "even"); ?><input type="hidden" name="stark_module[<?php echo $module_row; ?>][stark_ids][]" value="<?php echo $id; ?>" /><?php } ?>' ;
html += ' <td class="left"><input type="text" name="stark_module[' + module_row + '][width]" value="" size="3" /> <input type="text" name="stark_module[' + module_row + '][height]" value="" size="3" /></td>';
html += ' <td class="left"><select name="stark_module[' + module_row + '][layout_id]">';
<?php foreach ($layouts as $layout) { ?>
html += ' <option value="<?php echo $layout['layout_id']; ?>"><?php echo addslashes($layout['name']); ?></option>';
<?php } ?>
html += ' </select></td>';
html += ' <td class="left"><select name="stark_module[' + module_row + '][position]">';
html += ' <option value="content_top"><?php echo $text_content_top; ?></option>';
html += ' <option value="content_bottom"><?php echo $text_content_bottom; ?></option>';
html += ' <option value="column_left"><?php echo $text_column_left; ?></option>';
html += ' <option value="column_right"><?php echo $text_column_right; ?></option>';
html += ' </select></td>';
html += ' <td class="left"><select name="stark_module[' + module_row + '][status]">';
html += ' <option value="1" selected="selected"><?php echo $text_enabled; ?></option>';
html += ' <option value="0"><?php echo $text_disabled; ?></option>';
html += ' </select></td>';
html += ' <td class="right"><input type="text" name="stark_module[' + module_row + '][sort_order]" value="" size="3" /></td>';
html += ' <td class="left"><a onclick="$(\'#module-row' + module_row + '\').remove();" class="button"><?php echo $button_remove; ?></a></td>';
html += ' </tr>';
html += '</tbody>';
$('#module tfoot').before(html);
moduleautocomplete(module_row);
module_row++;
}
//--></script>