[-] BO : #PSTEST-525 - Fix problem with the page product : field must be reset if there is an errors

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12731 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mDeflotte
2012-01-26 17:33:28 +00:00
parent c6b95a1b51
commit 5b8cb6edb9
4 changed files with 22 additions and 19 deletions
@@ -66,7 +66,7 @@
{block name="defaultForm"}
<div>
<div class="productTabs" style="display:none;">
<div class="productTabs" style="display:none;">
<ul class="tab">
{foreach $product_tabs key=numStep item=tab}
<li class="tab-row">
@@ -82,6 +82,7 @@
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 it.'}';
$('#product-tab-content-wait').show();
var post_data = {$post_data};
$(document).ready(function()
{
@@ -273,18 +274,18 @@
{***********************************************}
{********** TO CHECK !!!!!!!!!!!!!!! ***********}
<script type="text/javascript">
// <![CDATA[
ThickboxI18nImage = "{l s='Image'}";
ThickboxI18nOf = "{l s='of'}";
ThickboxI18nClose = "{l s='Close'}";
ThickboxI18nOrEscKey = "{l s='(or "Esc")'}";
ThickboxI18nNext = "{l s='Next >'}";
ThickboxI18nPrev = "{l s='< Previous'}";
tb_pathToImage = "../img/loadingAnimation.gif";
//]]>
// <![CDATA[
ThickboxI18nImage = "{l s='Image'}";
ThickboxI18nOf = "{l s='of'}";
ThickboxI18nClose = "{l s='Close'}";
ThickboxI18nOrEscKey = "{l s='(or "Esc")'}";
ThickboxI18nNext = "{l s='Next >'}";
ThickboxI18nPrev = "{l s='< Previous'}";
tb_pathToImage = "../img/loadingAnimation.gif";
//]]>
</script>
<div id="product-tab-content-wait" style="display:none"><div id="loading">{l s='Loading...'}</div></div>
<div id="product-tab-content-wait" style="display:none"><div id="loading">{l s='Loading...'}</div></div>
<form id="product_form" action="{$form_action}" method="post" enctype="multipart/form-data" name="product" style="display:none;">
<input type="hidden" name="id_product" value="{$id_product}" />
@@ -34,11 +34,11 @@
<div>
<label class="text">{l s='Type:'}</label>
<input type="radio" name="type_product" id="simple_product" value="{Product::PTYPE_SIMPLE}" />
<input type="radio" name="type_product" id="simple_product" value="{Product::PTYPE_SIMPLE}" {if (isset($smarty.post.type_product) && Product::PTYPE_SIMPLE == $smarty.post.type_product)}checked="checked"{/if} />
<label class="radioCheck" for="simple_product">{l s='Product'}</label>
<input type="radio" name="type_product" id="pack_product" value="{Product::PTYPE_PACK}" {if $is_pack}checked="checked"{/if} />
<input type="radio" name="type_product" id="pack_product" value="{Product::PTYPE_PACK}" {if $is_pack || (isset($smarty.post.type_product) && Product::PTYPE_PACK == $smarty.post.type_product)}checked="checked"{/if} />
<label class="radioCheck" for="pack_product">{l s='Pack'}</label>
<input type="radio" name="type_product" id="virtual_product" value="{Product::PTYPE_VIRTUAL}" />
<input type="radio" name="type_product" id="virtual_product" value="{Product::PTYPE_VIRTUAL}" {if (isset($smarty.post.type_product) && Product::PTYPE_VIRTUAL == $smarty.post.type_product)}checked="checked"{/if} />
<label class="radioCheck" for="virtual_product">{l s='Virtual Product (services, booking and downloadable products)'}</label>
</div>
@@ -1589,14 +1589,14 @@ class AdminProductsControllerCore extends AdminController
protected function _removeTaxFromEcotax()
{
$ecotaxTaxRate = Tax::getProductEcotaxRate();
$ecotaxTaxRate = Tax::getProductEcotaxRate();
if ($ecotax = Tools::getValue('ecotax'))
$_POST['ecotax'] = Tools::ps_round(Tools::getValue('ecotax') / (1 + $ecotaxTaxRate / 100), 6);
}
protected function _applyTaxToEcotax($product)
{
$ecotaxTaxRate = Tax::getProductEcotaxRate();
$ecotaxTaxRate = Tax::getProductEcotaxRate();
if ($product->ecotax)
$product->ecotax = Tools::ps_round($product->ecotax * (1 + $ecotaxTaxRate / 100), 2);
}
@@ -2056,6 +2056,7 @@ class AdminProductsControllerCore extends AdminController
$this->display = 'edit';
$this->tpl_form_vars['token'] = $this->token;
$this->tpl_form_vars['combinationImagesJs'] = $this->getCombinationImagesJs();
$this->tpl_form_vars['post_data'] = Tools::jsonEncode($_POST);
// autoload rich text editor (tiny mce)
$this->tpl_form_vars['tinymce'] = true;
@@ -2480,7 +2481,7 @@ class AdminProductsControllerCore extends AdminController
'selected_cat_ids' => implode(',', array_keys($selected_cat)),
'selected_cat' => $selected_cat,
'category_tree' => $helper->renderCategoryTree(null, $selected_cat, 'categoryBox', false, true),
'product' => $product,
'product' => $product,
'link' => $this->context->link
));
@@ -2602,7 +2603,7 @@ class AdminProductsControllerCore extends AdminController
'languages' => $languages,
'default_language' => $default_language,
'ps_ssl_enabled' => Configuration::get('PS_SSL_ENABLED'),
'is_pack' => ($product->id && Pack::isPack($product->id)) || Tools::getValue('ppack'),
'is_pack' => ($product->id && Pack::isPack($product->id)) || Tools::getValue('ppack') || Tools::getValue('type_product') == Product::PTYPE_PACK,
'input_pack_items' => $input_pack_items,
'input_namepack_items' => $input_namepack_items
));
@@ -3742,7 +3743,7 @@ class AdminProductsControllerCore extends AdminController
protected function initPack(Product $product)
{
$this->tpl_form_vars['is_pack'] = ($product->id && Pack::isPack($product->id)) || Tools::getValue('ppack');
$this->tpl_form_vars['is_pack'] = ($product->id && Pack::isPack($product->id)) || Tools::getValue('ppack') || Tools::getValue('type_product') == Product::PTYPE_PACK;
$product->packItems = Pack::getItems($product->id, $this->context->language->id);
$input_pack_items = '';
+1
View File
@@ -235,6 +235,7 @@ function displayTabProductById(id, selected, index, stack)
url : myurl,
async : true,
cache: false, // cache needs to be set to false or IE will cache the page with outdated product values
data: post_data,
success : function(data)
{
tab_selector.html(data);