diff --git a/admin-dev/themes/default/template/controllers/products/virtualproduct.tpl b/admin-dev/themes/default/template/controllers/products/virtualproduct.tpl index 0ffbb2fc2..c21a67e9d 100644 --- a/admin-dev/themes/default/template/controllers/products/virtualproduct.tpl +++ b/admin-dev/themes/default/template/controllers/products/virtualproduct.tpl @@ -48,193 +48,193 @@ var fileName = data.getAttribute("filename"); if (result == "error") { - $("#upload-confirmation").hide(); - $("#upload-error td").html('
{l s='Error:'} ' + msg + '
'); - $("#upload-error").show(); + $("#upload-confirmation").closest('.form-group.').hide(); + $("#upload-error").html('{l s='Error:'} ' + msg); + $("#upload-error").closest('.form-group.').show(); } else { - $('#upload-error').hide(); - $('#file_missing').hide(); + $('#upload-error').closest('.form-group.').hide(); + $('#file_missing').closest('.form-group.').hide(); $('#virtual_product_name').attr('value', fileName); $("#upload-confirmation .error").remove(); - $('#upload-confirmation div').find('span').remove(); - $('#upload-confirmation div').prepend('{l s='The file'} "'+fileName+'" {l s='has successfully been uploaded'}' + + $('#upload-confirmation').find('span').remove(); + $('#upload-confirmation').prepend('{l s='The file'} "'+fileName+'" {l s='has successfully been uploaded'} ' + ''); - $("#upload-confirmation").show(); + $("#upload-confirmation").closest('.form-group.').show(); } } } ); } - function uploadFile2() - { - var link = ''; - $.ajaxFileUpload ( + $(document).ready(function(){ + $('#virtual_product_file-selectbutton').click(function(e) { + $('#virtual_product_file').trigger('click'); + }); + + $('#virtual_product_file-name').click(function(e) { + $('#virtual_product_file').trigger('click'); + }); + + $('#virtual_product_file').change(function(e) { + if ($(this)[0].files !== undefined) { - url:'./uploadProductFileAttribute.php', - secureuri:false, - fileElementId:'virtual_product_file_attribute', - dataType: 'xml', - success: function (data, status) - { - data = data.getElementsByTagName('return')[0]; - var result = data.getAttribute("result"); - var msg = data.getAttribute("msg"); - var fileName = data.getAttribute("filename"); - if(result == "error") - $("#upload-confirmation2").html('

error: ' + msg + '

'); - else - { - $('#virtual_product_file_attribute').remove(); - $('#virtual_product_file_label').hide(); - $('#file_missing').hide(); - $('#delete_downloadable_product_attribute').show(); - $('#upload-confirmation2').html( - '{l s='The file'} "' + fileName + '" {l s='has successfully been uploaded'}' + - ''); - $('#virtual_product_name_attribute').attr('value', fileName); + var files = $(this)[0].files; + var name = ''; - link = $("#delete_downloadable_product_attribute").attr('href'); - $("#delete_downloadable_product_attribute").attr('href', link+"&file="+msg); - } - } + $.each(files, function(index, value) { + name += value.name+', '; + }); + + $('#virtual_product_file-name').val(name.slice(0, -2)); } - ); - } + else // Internet Explorer 9 Compatibility + { + var name = $(this).val().split(/[\\/]/); + $('#virtual_product_file-name').val(name[name.length-1]); + } + + uploadFile(); + }); + }); - - -

{l s='Virtual Product (services, booking or downloadable products)'}

-
-
-
- is_virtual && $product->productDownload->active}checked="checked"{/if} /> - -
- {* [begin] virtual product *} -
productDownload->id || $product->productDownload->active}style="display:none"{/if} > -
- - - -

-
- {if $download_product_file_missing} -

- {$download_product_file_missing} :
- {$smarty.const._PS_DOWNLOAD_DIR_}/{$product->productDownload->filename}
-

- {/if} - - \ No newline at end of file diff --git a/js/admin-products.js b/js/admin-products.js index 2a5bfff9a..a167b4201 100644 --- a/js/admin-products.js +++ b/js/admin-products.js @@ -1332,33 +1332,20 @@ product_tabs['VirtualProduct'] = new function(){ if ($('#is_virtual_good').prop('checked')) { $('#virtual_good').show(); - $('#virtual_good_more').show(); } $('.is_virtual_good').hide(); if ( $('input[name=is_virtual_file]:checked').val() == 1) - { - $('#virtual_good_more').show(); $('#is_virtual_file_product').show(); - } else - { - $('#virtual_good_more').hide(); $('#is_virtual_file_product').hide(); - } $('input[name=is_virtual_file]').live('change', function(e) { - if($(this).val() == '1') - { - $('#virtual_good_more').show(); + if($(this).prop('checked')) $('#is_virtual_file_product').show(); - } else - { - $('#virtual_good_more').hide(); $('#is_virtual_file_product').hide(); - } }); // Bind file deletion