// #PSTEST-1229 - make sure you cannot select virtual product if you have combinations

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14857 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2012-04-24 16:45:00 +00:00
parent 26520b40a7
commit 2a97927eba
4 changed files with 27 additions and 16 deletions
@@ -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}';
@@ -88,7 +88,7 @@
{include file="controllers/products/multishop/check_fields.tpl" product_tab="Informations"}
<div class="separation"></div>
<div id="warn_virtual_combinations" class="warn" style="display:none">{l s='You cannot use combinations with a virtual product.'}</div>
<div>
<label class="text">{$bullet_common_field} {l s='Type:'}</label>
<input type="radio" name="type_product" id="simple_product" value="{Product::PTYPE_SIMPLE}" {if $product_type == Product::PTYPE_SIMPLE}checked="checked"{/if} />
@@ -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'))
+23 -15
View File
@@ -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
{