[-] FO : #PSTEST-74 : change the condition of product if is a virtual product

This commit is contained in:
lLefevre
2011-12-21 13:42:14 +00:00
parent 423909d36c
commit dde285c69d
3 changed files with 18 additions and 2 deletions
@@ -48,6 +48,7 @@
<input type="text" name="attachment_name_{$language.id_lang}" value="{$attachment_name[$language.id_lang]}" />
</div>
{/foreach}
<sup>&nbsp;*</sup>
</div>
<div class="clear">&nbsp;</div>
<label>{l s='Description:'} </label>
@@ -99,6 +99,8 @@
$('#virtual_product').attr('checked', 'checked');
$('li.tab-row a[id*="Pack"]').hide();
$('li.tab-row a[id*="Shipping"]').hide();
$('#condition').attr('disabled', 'disabled');
$('#condition option[value=new]').attr('selected', 'selected');
{else}
$('#simple_product').attr('checked', 'checked');
$('li.tab-row a[id*="Pack"]').hide();
@@ -124,6 +126,8 @@
$('#ppack').val(1).attr('checked', true).attr('disabled', 'disabled');
$('#ppackdiv').show();
$('li.tab-row a[id*="Shipping"]').show();
$('#condition').removeAttr('disabled');
$('#condition option[value=new]').removeAttr('selected');
}
else if (val == 2)
{
@@ -133,9 +137,16 @@
$('#is_virtual').val(1);
$("#virtual_good_attributes").show();
$('li.tab-row a[id*="Shipping"]').hide();
$('#condition').attr('disabled', 'disabled');
$('#condition option[value=refurbished]').removeAttr('selected');
$('#condition option[value=used]').removeAttr('selected');
}
else
{
$('li.tab-row a[id*="Shipping"]').show();
$('#condition').removeAttr('disabled');
$('#condition option[value=new]').removeAttr('selected');
}
});
@@ -396,12 +396,16 @@ class AdminProductsControllerCore extends AdminController
* @param $token
* @return void
*/
public function processAttachment($token)
public function processAttachments($token)
{
if ($this->action == 'attachments')
if ($id = (int)Tools::getValue($this->identifier))
if (Attachment::attachToProduct($id, Tools::getValue('attachments')))
{
$attachments = trim(Tools::getValue('arrayAttachments'), ',');
$attachments = explode(',', $attachments);
if (Attachment::attachToProduct($id, $attachments))
$this->redirect_after = self::$currentIndex.'&id_product='.(int)$id.(isset($_POST['id_category']) ? '&id_category='.(int)$_POST['id_category'] : '').'&conf=4&add'.$this->table.'&action=Attachments&token='.($token ? $token : $this->token);
}
}
public function processDuplicate($token)