var option_count = $('#options_accordion>h3').size(); var count = <?php echo $count; ?> ; function add_related_product() { //if the related product is not already a related product, add it if($('#related_product_'+$('#product_list').val()).length == 0 && $('#product_list').val() != null) { <?php $new_item = str_replace(array("\n", "\t", "\r"), '', related_items("'+\$('#product_list').val()+'", "'+\$('#product_item_'+\$('#product_list').val()).html()+'")); ?> var related_product = '<?php echo $new_item; ?> '; $('#product_items_container').append(related_product); $('.list_buttons').buttonset(); } else { if($('#product_list').val() == null) { alert('<?php echo lang('alert_select_product'); ?>
return ' <tr id="related_product_' . $id . '"> <td> <input type="hidden" name="product[' . $id . '][id]" value="' . $id . '"/> <input type="hidden" name="product[' . $id . '][name]" value=\'' . htmlspecialchars($name) . '\'/> ' . $name . '</td> <td class="text-right"> <a class="btn-xs btn-default btn-danger" href="#" onclick="remove_product(' . $id . '); return false;"><i class="icon-times"></i></a> </td> </tr> '; } ?> <script id="productTemplate" type="text/template"> <?php echo related_items("{{id}}", "{{name}}"); ?> </script> <script type="text/javascript"> $('form').submit(function() { $('.btn .btn-primary').attr('disabled', true).addClass('disabled'); }); $('#product_search').keyup(function(){ $('#product_list').html(''); run_product_query(); }); function run_product_query() {