// Product is now correctly inserted in product_shop for existant products

This commit is contained in:
rGaillard
2012-05-21 09:46:53 +00:00
parent 3f0c0f6828
commit 502c16dcba
3 changed files with 4 additions and 5 deletions
@@ -235,7 +235,7 @@
<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}" />
<div class="tab-pane" id="tabPane1">
{if !$product->active}
{if !$product->active && $product->isAssociatedToShop()}
<div class="warn draft" >
<p>
<span style="float: left">
@@ -150,11 +150,11 @@
<td style="padding-bottom:5px;">
<ul class="listForm">
<li>
<input onclick="toggleDraftWarning(false);showOptions(true);" type="radio" name="active" id="active_on" value="1" {if $product->active}checked="checked" {/if} />
<input onclick="toggleDraftWarning(false);showOptions(true);" type="radio" name="active" id="active_on" value="1" {if $product->active || !$product->isAssociatedToShop()}checked="checked" {/if} />
<label for="active_on" class="radioCheck">{l s='Enabled'}</label>
</li>
<li>
<input onclick="toggleDraftWarning(true);showOptions(false);" type="radio" name="active" id="active_off" value="0" {if !$product->active}checked="checked"{/if} />
<input onclick="toggleDraftWarning(true);showOptions(false);" type="radio" name="active" id="active_off" value="0" {if !$product->active && $product->isAssociatedToShop()}checked="checked"{/if} />
<label for="active_off" class="radioCheck">{l s='Disabled'}</label>
</li>
</ul>
+1 -2
View File
@@ -547,8 +547,7 @@ abstract class ObjectModelCore
{
$fields['id_shop'] = (int)$id_shop;
$all_fields['id_shop'] = (int)$id_shop;
$where = $this->def['primary'].' = '.(int)$this->id.' AND id_shop = '.(int)$id_shop;
$result &= Db::getInstance()->update($this->def['table'].'_shop', $fields, $where, 0, $null_values);
$result &= Db::getInstance()->insert($this->def['table'].'_shop', $fields, $null_values, true, Db::REPLACE);
}
}