diff --git a/admin-dev/themes/default/template/controllers/products/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/products/helpers/form/form.tpl index 9f7827389..fff1938bf 100644 --- a/admin-dev/themes/default/template/controllers/products/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/products/helpers/form/form.tpl @@ -95,6 +95,8 @@ var product_type_virtual = {Product::PTYPE_VIRTUAL}; var product_type_simple = {Product::PTYPE_SIMPLE}; + var has_combinations = '{$has_combinations}'; + var toload = new Array(); var empty_pack_msg = '{l s='Pack is empty. You need to add at least one product to the pack before you can save the pack.' slashes=1}'; var empty_name_msg = '{l s='Product name is empty. You need to enter a name at least for the default language before you can save the product.' slashes=1}'; diff --git a/admin-dev/themes/default/template/controllers/products/informations.tpl b/admin-dev/themes/default/template/controllers/products/informations.tpl index aef0feab4..5945f203c 100644 --- a/admin-dev/themes/default/template/controllers/products/informations.tpl +++ b/admin-dev/themes/default/template/controllers/products/informations.tpl @@ -88,7 +88,7 @@ {include file="controllers/products/multishop/check_fields.tpl" product_tab="Informations"}
- +
diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index bbbefdf68..fbb3c5246 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -2184,6 +2184,7 @@ class AdminProductsControllerCore extends AdminController $this->tpl_form_vars['upload_max_filesize'] = $upload_max_filesize; $this->tpl_form_vars['country_display_tax_label'] = $this->context->country->display_tax_label; + $this->tpl_form_vars['has_combinations'] = $this->object->hasAttributes(); // let's calculate this once for all if (!Validate::isLoadedObject($this->object) && Tools::getValue('id_product')) diff --git a/js/admin-products.js b/js/admin-products.js index f8f22f9e4..d8e4cbc75 100644 --- a/js/admin-products.js +++ b/js/admin-products.js @@ -832,25 +832,33 @@ product_tabs['Informations'] = new function(){ } else if (product_type == product_type_virtual) { - $('li.tab-row a[id*="VirtualProduct"]').show().click(); + if (has_combinations) + { + $('#simple_product').attr('checked', 'checked'); + $('#warn_virtual_combinations').show(); + } + else + { + $('li.tab-row a[id*="VirtualProduct"]').show().click(); - tabs_manager.onLoad('VirtualProduct', function(){ - $('#is_virtual_good').attr('checked', true); - $('#virtual_good').show(); - $('#is_virtual').val(1); - }); + tabs_manager.onLoad('VirtualProduct', function(){ + $('#is_virtual_good').attr('checked', true); + $('#virtual_good').show(); + $('#is_virtual').val(1); + }); - tabs_manager.onLoad('Quantities', function(){ - $('.stockForVirtualProduct').hide(); - }); + tabs_manager.onLoad('Quantities', function(){ + $('.stockForVirtualProduct').hide(); + }); - $('li.tab-row a[id*="Shipping"]').hide(); + $('li.tab-row a[id*="Shipping"]').hide(); - tabs_manager.onLoad('Informations', function(){ - $('#condition').attr('disabled', 'disabled'); - $('#condition option[value=refurbished]').removeAttr('selected'); - $('#condition option[value=used]').removeAttr('selected'); - }); + tabs_manager.onLoad('Informations', function(){ + $('#condition').attr('disabled', 'disabled'); + $('#condition option[value=refurbished]').removeAttr('selected'); + $('#condition option[value=used]').removeAttr('selected'); + }); + } } else {