From d3f8c6b28a2854d9f7caff2fd5dc71618bf4cf9f Mon Sep 17 00:00:00 2001 From: tDidierjean Date: Tue, 3 Jan 2012 15:38:47 +0000 Subject: [PATCH] // Product tabs now trigger an event when finished loading. Fixed pack and virtual product not being updated when the loading is not complete. git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12077 b9a71923-0436-4b27-9f14-aed3839534dd --- .../themes/default/template/products/form.tpl | 18 ++++++++++++++++++ controllers/admin/AdminProductsController.php | 2 +- js/admin-products.js | 2 ++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/admin-dev/themes/default/template/products/form.tpl b/admin-dev/themes/default/template/products/form.tpl index e1310b001..99fb38de0 100644 --- a/admin-dev/themes/default/template/products/form.tpl +++ b/admin-dev/themes/default/template/products/form.tpl @@ -114,6 +114,15 @@ $('li.tab-row a[id*="Pack"]').show(); $('#ppack').val(1).attr('checked', true).attr('disabled', 'disabled'); $('#ppackdiv').show(); + // If the pack tab has not finished loaded the changes will be made when the loading event is triggered + $("#product-tab-content-Pack").bind('loaded', function(){ + $('#ppack').val(1).attr('checked', true).attr('disabled', 'disabled'); + $('#ppackdiv').show(); + }); + $("#product-tab-content-Quantities").bind('loaded', function(){ + $('.stockForVirtualProduct').show(); + }); + $('li.tab-row a[id*="Shipping"]').show(); $('#condition').removeAttr('disabled'); $('#condition option[value=new]').removeAttr('selected'); @@ -126,6 +135,15 @@ $('#virtual_good').show(); $('#is_virtual').val(1); $("#virtual_good_attributes").show(); + // If the virtual product tab has not finished loaded the changes will be made when the loading event is triggered + $("#product-tab-content-VirtualProduct").bind('loaded', function(){ + $('#virtual_good').show(); + $('#is_virtual').val(1); + $("#virtual_good_attributes").show(); + }); + $("#product-tab-content-Quantities").bind('loaded', function(){ + $('.stockForVirtualProduct').hide(); + }); $('li.tab-row a[id*="Shipping"]').hide(); $('#condition').attr('disabled', 'disabled'); $('#condition option[value=refurbished]').removeAttr('selected'); diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index ccba002a2..d6ddeb345 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -1888,7 +1888,7 @@ class AdminProductsControllerCore extends AdminController continue; $product_tabs[$product_tab] = array( - 'id' => ++$i.'-'.$product_tab, + 'id' => $product_tab, 'selected' => (strtolower($product_tab) == strtolower($this->tab_display)), 'name' => $this->available_tabs_lang[$product_tab], 'href' => $this->context->link->getAdminLink('AdminProducts').'&id_product='.Tools::getValue('id_product').'&action='.$product_tab, diff --git a/js/admin-products.js b/js/admin-products.js index d63c684f6..2aa81c664 100644 --- a/js/admin-products.js +++ b/js/admin-products.js @@ -251,6 +251,8 @@ function displayTabProductById(id, selected, index, stack) $("#product-tab-content-"+id).removeClass('loading'); if (selected) $('#product-tab-content-wait').hide(); + + $("#product-tab-content-"+id).trigger('loaded'); if (stack && stack[index + 1]) displayTabProductById(stack[index + 1], selected, index + 1, stack); }