// added pack.tpl in AdminProductsController

This commit is contained in:
lLefevre
2011-12-16 13:57:27 +00:00
parent 6e3da1b627
commit b1a68fd7c8
7 changed files with 495 additions and 589 deletions
+13 -79
View File
@@ -93,22 +93,29 @@
{/if}
$('input[name="type_product"]').click(function() {
// Reset settings
$('li.tab-row a[id*="Pack"]').hide();
$('li.tab-row a[id*="VirtualProduct"]').hide();
$('#is_virtual_good').removeAttr('checked');
$('#is_virtual').val(0);
var val = $(this).val();
if (val == 1)
{
$('li.tab-row a[id*="Pack"]').show();
$('#ppack').val(1).attr('checked', true).attr('disabled', 'disabled');
$('#ppackdiv').show();
}
else if (val == 2)
{
$('li.tab-row a[id*="VirtualProduct"]').show();
$('#is_virtual_good').attr('checked', true).attr('disabled', 'disabled');
$('#is_virtual_good').attr('checked', true).attr('disabled', 'disabled');
$('#virtual_good').show();
$('#is_virtual').val(1);
}
else
{
$('#is_virtual_good').removeAttr('checked');
$('#is_virtual').val(0);
}
});
$('#desc-product-newCombination').hide();
@@ -191,79 +198,6 @@
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
function uploadFile()
{
$.ajaxFileUpload (
{
url:'./uploadProductFile.php',
secureuri:false,
fileElementId:'virtual_product_file',
dataType: 'xml',
success: function (data, status)
{
data = data.getElementsByTagName('return')[0];
var result = data.getAttribute("result");
var msg = data.getAttribute("msg");
var fileName = data.getAttribute("filename")
if(result == "error")
$("#upload-confirmation").html('<p>error: ' + msg + '</p>');
else
{
$('#virtual_product_file').remove();
$('#virtual_product_file_label').hide();
$('#file_missing').hide();
$('#delete_downloadable_product').show();
$('#virtual_product_name').attr('value', fileName);
$('#upload-confirmation').html(
'<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'">{l s='The file'}&nbsp;"' + fileName + '"&nbsp;{l s='has successfully been uploaded'}</a>' +
'<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="' + msg + '" />');
}
}
}
);
}
function uploadFile2()
{
var link = '';
$.ajaxFileUpload (
{
url:'./uploadProductFileAttribute.php',
secureuri:false,
fileElementId:'virtual_product_file_attribute',
dataType: 'xml',
success: function (data, status)
{
data = data.getElementsByTagName('return')[0];
var result = data.getAttribute("result");
var msg = data.getAttribute("msg");
var fileName = data.getAttribute("filename");
if(result == "error")
$("#upload-confirmation2").html('<p>error: ' + msg + '</p>');
else
{
$('#virtual_product_file_attribute').remove();
$('#virtual_product_file_label').hide();
$('#file_missing').hide();
$('#delete_downloadable_product_attribute').show();
$('#upload-confirmation2').html(
'<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'">{l s='The file'}&nbsp;"' + fileName + '"&nbsp;{l s='has successfully been uploaded'}</a>' +
'<input type="hidden" id="virtual_product_filename_attribute" name="virtual_product_filename_attribute" value="' + msg + '" />');
$('#virtual_product_name_attribute').attr('value', fileName);
link = $("#delete_downloadable_product_attribute").attr('href');
$("#delete_downloadable_product_attribute").attr('href', link+"&file="+msg);
}
}
}
);
}
//]]>
</script>
<form id="product_form" action="{$form_action}" method="post" enctype="multipart/form-data" name="product">
<input type="hidden" name="id_product" value="{$id_product}" />
<div class="tab-pane" id="tabPane1">
@@ -82,15 +82,15 @@
<div>
<label>{l s='Type:'}</label>
<label>
<label style="width:100px;text-align:center;">
<input type="radio" name="type_product" id="simple_product" value="0" />
{l s='Product'}
</label>
<label>
<label style="width:100px;text-align:center;">
<input type="radio" name="type_product" id="pack_product" value="1" />
{l s='Pack'}
</label>
<label>
<label style="width:100px;text-align:center;">
<input type="radio" name="type_product" id="virtual_product" value="2" />
{l s='Virtual product'}
</label>
@@ -99,56 +99,56 @@
<div class="separation"></div>
<br />
<table cellpadding="5" style="width: 50%; float: left; margin-right: 20px; border-right: 1px solid #CCCCCC;">
{* global information *}
<tr>
<td class="col-left"><label>{l s='Name:'}</label></td>
<td style="padding-bottom:5px;" class="translatable">
{foreach from=$languages item=language}
<div class="lang_{$language.id_lang}" style="{if !$language.is_default}display: none;{/if} float: left;">
<input class="{if !$product->id}copy2friendlyUrl{/if} updateCurrentText" size="43" type="text"
id="name_{$language.id_lang}" name="name_{$language.id_lang}"
value="{$product->name[$language.id_lang]|htmlentitiesUTF8|default:''}"/><sup> *</sup>
<span class="hint" name="help_box">{l s='Invalid characters:'} <>;=#{}<span class="hint-pointer">&nbsp;</span>
</span>
</div>
{/foreach}
<table cellpadding="5" style="width: 50%; float: left; margin-right: 20px; border-right: 1px solid #CCCCCC;">
{* global information *}
<tr>
<td class="col-left"><label>{l s='Name:'}</label></td>
<td style="padding-bottom:5px;" class="translatable">
{foreach from=$languages item=language}
<div class="lang_{$language.id_lang}" style="{if !$language.is_default}display: none;{/if} float: left;">
<input class="{if !$product->id}copy2friendlyUrl{/if} updateCurrentText" size="43" type="text"
id="name_{$language.id_lang}" name="name_{$language.id_lang}"
value="{$product->name[$language.id_lang]|htmlentitiesUTF8|default:''}"/><sup> *</sup>
<span class="hint" name="help_box">{l s='Invalid characters:'} <>;=#{}<span class="hint-pointer">&nbsp;</span>
</span>
</div>
{/foreach}
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Reference:'}</label></td>
<td style="padding-bottom:5px;">
<input size="55" type="text" name="reference" value="{$product->reference|htmlentitiesUTF8}" style="width: 130px; margin-right: 44px;" />
<span class="hint" name="help_box">{l s='Special characters allowed:'}.-_#\<span class="hint-pointer">&nbsp;</span></span>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='EAN13 or JAN:'}</label></td>
<td style="padding-bottom:5px;">
<input size="55" maxlength="13" type="text" name="ean13" value="{$product->ean13|htmlentitiesUTF8}" style="width: 130px; margin-right: 5px;" /> <span class="small">{l s='(Europe, Japan)'}</span>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='UPC:'}</label></td>
<td style="padding-bottom:5px;">
<input size="55" maxlength="12" type="text" name="upc" value="{$product->upc}" style="width: 130px; margin-right: 5px;" /> <span class="small">{l s='(US, Canada)'}</span>
</td>
</tr>
</table>
{* status informations *}
<table cellpadding="5" style="width: 40%; float: left; margin-left: 10px;">
<tr>
<td class="col-left"><label>{l s='Status:'}</label></td>
<td style="padding-bottom:5px;">
<input style="float:left;" onclick="toggleDraftWarning(false);showOptions(true);" type="radio" name="active" id="active_on" value="1" {if $product->active}checked="checked" {/if} />
<label for="active_on" class="t">
{l s='Enabled'}</label>
<br class="clear" />
<input style="float:left;" onclick="toggleDraftWarning(true);showOptions(false);" type="radio" name="active" id="active_off" value="0" {if !$product->active}checked="checked"{/if} />
<label for="active_off" class="t">{l s='Disabled'} </label>
</td>
</tr>
</tr>
<tr>
<td class="col-left"><label>{l s='Reference:'}</label></td>
<td style="padding-bottom:5px;">
<input size="55" type="text" name="reference" value="{$product->reference|htmlentitiesUTF8}" style="width: 130px; margin-right: 44px;" />
<span class="hint" name="help_box">{l s='Special characters allowed:'}.-_#\<span class="hint-pointer">&nbsp;</span></span>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='EAN13 or JAN:'}</label></td>
<td style="padding-bottom:5px;">
<input size="55" maxlength="13" type="text" name="ean13" value="{$product->ean13|htmlentitiesUTF8}" style="width: 130px; margin-right: 5px;" /> <span class="small">{l s='(Europe, Japan)'}</span>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='UPC:'}</label></td>
<td style="padding-bottom:5px;">
<input size="55" maxlength="12" type="text" name="upc" value="{$product->upc}" style="width: 130px; margin-right: 5px;" /> <span class="small">{l s='(US, Canada)'}</span>
</td>
</tr>
</table>
{* status informations *}
<table cellpadding="5" style="width: 40%; float: left; margin-left: 10px;">
<tr>
<td class="col-left"><label>{l s='Status:'}</label></td>
<td style="padding-bottom:5px;">
<input style="float:left;" onclick="toggleDraftWarning(false);showOptions(true);" type="radio" name="active" id="active_on" value="1" {if $product->active}checked="checked" {/if} />
<label for="active_on" class="t">
{l s='Enabled'}</label>
<br class="clear" />
<input style="float:left;" onclick="toggleDraftWarning(true);showOptions(false);" type="radio" name="active" id="active_off" value="0" {if !$product->active}checked="checked"{/if} />
<label for="active_off" class="t">{l s='Disabled'} </label>
</td>
</tr>
<tr id="product_options" {if !$product->active}style="display:none"{/if} >
<td class="col-left"><label>{l s='Options:'}</label></td>
<td style="padding-bottom:5px;">
@@ -169,201 +169,166 @@
});
});
</script>
<label for="available_for_order" class="t">{l s='available for order'}</label>
<br class="clear" />
<input style="float: left;" type="checkbox" name="show_price" id="show_price" value="1" {if $product->show_price}checked="checked"{/if} {if $product->available_for_order}disabled="disabled"{/if}/>
<label for="show_price" class="t">{l s='show price'}</label>
<br class="clear" />
<input style="float: left;" type="checkbox" name="online_only" id="online_only" value="1" {if $product->online_only}checked="checked"{/if} />
<label for="online_only" class="t">{l s='online only (not sold in store)'}</label>
<label for="available_for_order" class="t">{l s='available for order'}</label>
<br class="clear" />
<input style="float: left;" type="checkbox" name="show_price" id="show_price" value="1" {if $product->show_price}checked="checked"{/if} {if $product->available_for_order}disabled="disabled"{/if}/>
<label for="show_price" class="t">{l s='show price'}</label>
<br class="clear" />
<input style="float: left;" type="checkbox" name="online_only" id="online_only" value="1" {if $product->online_only}checked="checked"{/if} />
<label for="online_only" class="t">{l s='online only (not sold in store)'}</label>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Condition:'}</label></td>
<td style="padding-bottom:5px;">
<select name="condition" id="condition">
<option value="new" {if $product->condition == 'new'}selected="selected"{/if} >{l s='New'}</option>
<option value="used" {if $product->condition == 'used'}selected="selected"{/if} >{l s='Used'}</option>
<option value="refurbished" {if $product->condition == 'refurbished'}selected="selected"{/if}>{l s='Refurbished'}</option>
</select>
</td>
<td class="col-left"><label>{l s='Condition:'}</label></td>
<td style="padding-bottom:5px;">
<select name="condition" id="condition">
<option value="new" {if $product->condition == 'new'}selected="selected"{/if} >{l s='New'}</option>
<option value="used" {if $product->condition == 'used'}selected="selected"{/if} >{l s='Used'}</option>
<option value="refurbished" {if $product->condition == 'refurbished'}selected="selected"{/if}>{l s='Refurbished'}</option>
</select>
</td>
</tr>
</table>
<table cellpadding="5" cellspacing="0" border="0" style="width: 100%;"><tr><td><div class="separation"></div></td></tr></table>
{* [begin] pack product *}
<script type='text/javascript'>
var msg_select_one = '{l s='Thanks to select at least one product.'}';
var msg_set_quantity = '{l s='Thanks to set a quantity to add a product.'}';
</script>
<table>
<tr>
<td>
<input type="checkbox" name="ppack" id="ppack" value="1" {if $is_pack}checked="checked"{/if} onclick="$('#ppackdiv').slideToggle();" />
<label class="t" for="ppack">{l s='Pack'}</label>
</td>
<td>
<div id="ppackdiv" {if !$is_pack}style="display: none;"{/if}>
<div id="divPackItems">
{foreach from=$product->packItems item=packItem}
{$packItem->pack_quantity} x {$packItem->name}<span onclick="delPackItem({$packItem->id});" style="cursor: pointer;"><img src="../img/admin/delete.gif" /></span><br />
{/foreach}
</div>
<input type="hidden" name="inputPackItems" id="inputPackItems" value="{$input_pack_items}" />
<input type="hidden" name="namePackItems" id="namePackItems" value="{$input_namepack_items}" />
<input type="hidden" size="2" id="curPackItemId" />
<table cellspacing="0" cellpadding="5" border="0">
<tr>
<td class="col-left"><label>{l s='Short description:'}<br /></label><p class="product_description">({l s='appears in the product lists and on the top of the product page'})</p></td>
<td style="padding-bottom:5px;">
{include file="products/textarea_lang.tpl"
languages=$languages
input_name='description_short'
input_value=$product->description_short
max=400}
<p class="clear">{l s='Begin typing the first letters of the product name, then select the product from the drop-down list:'}
<br />{l s='You cannot add downloadable products to a pack.'}</p>
<input type="text" size="25" id="curPackItemName" />
<input type="text" name="curPackItemQty" id="curPackItemQty" value="1" size="1" />
<span onclick="addPackItem();" style="cursor: pointer;"><img src="../img/admin/add.gif" alt="{l s='Add an item to the pack'}" title="{l s='Add an item to the pack'}" /></span>
</td>
</div>
</tr>
</table>
<div class="separation"></div>
<table cellspacing="0" cellpadding="5" border="0">
<tr>
<td class="col-left"><label>{l s='Short description:'}<br /></label><p class="product_description">({l s='appears in the product lists and on the top of the product page'})</p></td>
<td style="padding-bottom:5px;">
{include file="products/textarea_lang.tpl"
languages=$languages
input_name='description_short'
input_value=$product->description_short
max=400}
<p class="clear"></p>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Description:'}<br /></label><p class="product_description">({l s='appears in the body of the product page'})</p></td>
<td style="padding-bottom:5px;">
{include file="products/textarea_lang.tpl" languages=$languages
input_name='description'
input_value=$product->description
}
<p class="clear"></p>
</td>
</tr>
{if $images}
<tr>
<td class="col-left"><label></label></td>
<td style="padding-bottom:5px;">
<div style="display:block;width:620px;" class="hint clear">
{l s='Do you want an image associated with the product in your description?'}
<span class="addImageDescription" style="cursor:pointer">{l s='Click here'}</span>.
<table id="createImageDescription" style="display:none;">
<tr>
<td colspan="2" height="10"></td>
</tr>
<tr>
<td class="col-left"><label>{l s='Select your image:'}</label></td>
<td style="padding-bottom:5px;">
<ul>
{foreach from=$images item=image key=key}
<li>
<input type="radio" name="smallImage" id="smallImage_{$key}" value="{$image.id_image}" {if $key == 0}checked="checked"{/if} >
<label for="smallImage_{$key}" class="t">
<img src="{$image.src}" alt="{$image.legend}" />
</label>
</li>
{/foreach}
</ul>
<p class="clear"></p>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Where to place it?'}</label></td>
<td style="padding-bottom:5px;">
<input type="radio" name="leftRight" id="leftRight_1" value="left" checked>
<label for="leftRight_1" class="t">{l s='left'}</label>
<br />
<input type="radio" name="leftRight" id="leftRight_2" value="right">
<label for="leftRight_2" class="t">{l s='right'}</label>
<p class="clear"></p>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Select the type of picture:'}</label></td>
<td style="padding-bottom:5px;">
{foreach from=$imagesTypes key=key item=type}
<input type="radio" name="imageTypes" id="imageTypes_{$key}" value="{$type.name}" {if $key == 0}checked="checked"{/if}>
<label for="imageTypes_{$key}" class="t">{$type.name} <span>({$type.width}px par {$type.height}px)</span></label>
<br />
{/foreach}
<p class="clear"></p>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Image tag to insert:'}</label></td>
<td style="padding-bottom:5px;">
<input type="text" id="resultImage" name="resultImage" />
<p>{l s='The tag is to copy / paste in the description.'}</p>
</td>
</tr>
</table>
</div>
<p class="clear"></p>
</td>
</tr>
<script type="text/javascript">
$(function() {
changeTagImage();
$('#createImageDescription input').change(function(){
changeTagImage();
});
var i = 0;
$('.addImageDescription').click(function(){
if (i == 0){
$('#createImageDescription').animate({
opacity: 1, height: 'toggle'
}, 500);
i = 1;
}else{
$('#createImageDescription').animate({
opacity: 0, height: 'toggle'
}, 500);
i = 0;
}
});
});
function changeTagImage(){
var smallImage = $('input[name=smallImage]:checked').attr('value');
var leftRight = $('input[name=leftRight]:checked').attr('value');
var imageTypes = $('input[name=imageTypes]:checked').attr('value');
var tag = '[img-'+smallImage+'-'+leftRight+'-'+imageTypes+']';
$('#resultImage').val(tag);
<p class="clear"></p>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Description:'}<br /></label><p class="product_description">({l s='appears in the body of the product page'})</p></td>
<td style="padding-bottom:5px;">
{include file="products/textarea_lang.tpl" languages=$languages
input_name='description'
input_value=$product->description
}
</script>
{/if}
<p class="clear"></p>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Tags:'}</label></td>
<td style="padding-bottom:5px;" class="translatable">
{if $images}
{foreach from=$languages item=language}
<div class="lang_{$language.id_lang}" style="{if !$language.is_default}display: none;{/if}float: left;">
<input size="55" type="text" id="tags_{$language.id_lang}" name="tags_{$language.id_lang}"
value="{$product->getTags($language.id_lang, true)|htmlentitiesUTF8}" />
<span class="hint" name="help_box">{l s='Forbidden characters:'} !&lt;;&gt;;?=+#&quot;&deg;{}_$%<span class="hint-pointer">&nbsp;</span></span>
</div>
{/foreach}
<tr>
<td class="col-left"><label></label></td>
<td style="padding-bottom:5px;">
<div style="display:block;width:620px;" class="hint clear">
{l s='Do you want an image associated with the product in your description?'}
<span class="addImageDescription" style="cursor:pointer">{l s='Click here'}</span>.
<table id="createImageDescription" style="display:none;">
<tr>
<td colspan="2" height="10"></td>
</tr>
<tr>
<td class="col-left"><label>{l s='Select your image:'}</label></td>
<td style="padding-bottom:5px;">
<ul>
{foreach from=$images item=image key=key}
<li>
<input type="radio" name="smallImage" id="smallImage_{$key}" value="{$image.id_image}" {if $key == 0}checked="checked"{/if} >
<label for="smallImage_{$key}" class="t">
<img src="{$image.src}" alt="{$image.legend}" />
</label>
</li>
{/foreach}
</ul>
<p class="clear"></p>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Where to place it?'}</label></td>
<td style="padding-bottom:5px;">
<input type="radio" name="leftRight" id="leftRight_1" value="left" checked>
<label for="leftRight_1" class="t">{l s='left'}</label>
<br />
<input type="radio" name="leftRight" id="leftRight_2" value="right">
<label for="leftRight_2" class="t">{l s='right'}</label>
<p class="clear"></p>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Select the type of picture:'}</label></td>
<td style="padding-bottom:5px;">
{foreach from=$imagesTypes key=key item=type}
<input type="radio" name="imageTypes" id="imageTypes_{$key}" value="{$type.name}" {if $key == 0}checked="checked"{/if}>
<label for="imageTypes_{$key}" class="t">{$type.name} <span>({$type.width}px par {$type.height}px)</span></label>
<br />
{/foreach}
<p class="clear"></p>
</td>
</tr>
<tr>
<td class="col-left"><label>{l s='Image tag to insert:'}</label></td>
<td style="padding-bottom:5px;">
<input type="text" id="resultImage" name="resultImage" />
<p>{l s='The tag is to copy / paste in the description.'}</p>
</td>
</tr>
</table>
</div>
<p class="clear"></p>
</td>
</tr>
<script type="text/javascript">
$(function() {
changeTagImage();
$('#createImageDescription input').change(function(){
changeTagImage();
});
var i = 0;
$('.addImageDescription').click(function(){
if (i == 0){
$('#createImageDescription').animate({
opacity: 1, height: 'toggle'
}, 500);
i = 1;
}else{
$('#createImageDescription').animate({
opacity: 0, height: 'toggle'
}, 500);
i = 0;
}
});
});
function changeTagImage(){
var smallImage = $('input[name=smallImage]:checked').attr('value');
var leftRight = $('input[name=leftRight]:checked').attr('value');
var imageTypes = $('input[name=imageTypes]:checked').attr('value');
var tag = '[img-'+smallImage+'-'+leftRight+'-'+imageTypes+']';
$('#resultImage').val(tag);
}
</script>
{/if}
<tr>
<td class="col-left"><label>{l s='Tags:'}</label></td>
<td style="padding-bottom:5px;" class="translatable">
{foreach from=$languages item=language}
<div class="lang_{$language.id_lang}" style="{if !$language.is_default}display: none;{/if}float: left;">
<input size="55" type="text" id="tags_{$language.id_lang}" name="tags_{$language.id_lang}"
value="{$product->getTags($language.id_lang, true)|htmlentitiesUTF8}" />
<span class="hint" name="help_box">{l s='Forbidden characters:'} !&lt;;&gt;;?=+#&quot;&deg;{}_$%<span class="hint-pointer">&nbsp;</span></span>
</div>
{/foreach}
<p class="preference_description clear">{l s='Tags separated by commas (e.g., dvd, dvd player, hifi)'}</p>
</td>
</tr>
</td>
</tr>
</table>
<br />
</div>
</td>
</tr>
</table>
<br />
</div>
+96 -2
View File
@@ -37,7 +37,13 @@
return (code == 13) ? false : true;
});
$('#curPackItemName') .autocomplete('ajax_products_list.php', {
if ($('#ppack').attr('checked'))
{
$('#ppack').attr('disabled', 'disabled');
$('#ppackdiv').show();
}
$('#curPackItemName').autocomplete('ajax_products_list.php', {
delay: 100,
minChars: 1,
autoFill: true,
@@ -57,12 +63,100 @@
$('#curPackItemName').setOptions({
extraParams: {
excludeIds : getSelectedIds(), excludeVirtuals : 1
excludeIds : getSelectedIds(),
excludeVirtuals : 1
}
});
});
function addPackItem()
{
var curPackItemId = $('#curPackItemId').val();
var curPackItemName = $('#curPackItemName').val();
var curPackItemQty = $('#curPackItemQty').val();
if (curPackItemId == '' || curPackItemName == '')
{
alert(msg_select_one);
return false;
}
else if (curPackItemId == '' || curPackItemQty == '')
{
alert(msg_set_quantity);
return false;
}
var lineDisplay = curPackItemQty+ 'x ' +curPackItemName;
var divContent = $('#divPackItems').html();
divContent += lineDisplay;
divContent += '<span onclick="delPackItem(' + curPackItemId + ');" style="cursor: pointer;"><img src="../img/admin/delete.gif" /></span><br />';
// QTYxID-QTYxID
var line = curPackItemQty+ 'x' +curPackItemId;
$('#inputPackItems').val($('#inputPackItems').val() + line + '-');
$('#divPackItems').html(divContent);
$('#namePackItems').val($('#namePackItems').val() + lineDisplay + '¤');
$('#curPackItemId').val('');
$('#curPackItemName').val('');
$('#curPackItemName').setOptions({
extraParams: {
excludeIds : getSelectedIds(),
q: curPackItemName
}
});
}
function delPackItem(id)
{
var reg = new RegExp('-', 'g');
var regx = new RegExp('x', 'g');
var div = getE('divPackItems');
var input = getE('inputPackItems');
var name = getE('namePackItems');
var select = getE('curPackItemId');
var select_quantity = getE('curPackItemQty');
var inputCut = input.value.split(reg);
var nameCut = name.value.split(new RegExp('¤', 'g'));
input.value = '';
name.value = '';
div.innerHTML = '';
for (var i = 0; i < inputCut.length; ++i)
if (inputCut[i])
{
var inputQty = inputCut[i].split(regx);
if (inputQty[1] != id)
{
input.value += inputCut[i] + '-';
name.value += nameCut[i] + '¤';
div.innerHTML += nameCut[i] + ' <span onclick="delPackItem(' + inputQty[1] + ');" style="cursor: pointer;"><img src="../img/admin/delete.gif" /></span><br />';
}
}
$('#curPackItemName').setOptions({
extraParams: {
excludeIds : getSelectedIds()
}
});
}
function getSelectedIds()
{
// input lines QTY x ID-
var ids = id_product + ',';
ids += $('#inputPackItems').val().replace(/\\d+x/g, '').replace(/\-/g,',');
ids = ids.replace(/\,$/,'');
return ids;
}
</script>
<h4>{l s='Pack'}</h4>
@@ -34,14 +34,11 @@
var uploadableFileLabel = 0;
var textFieldLabel = 0;
$('#is_virtual_good').change(function(e) {
$('#virtual_good').toggle();
});
if ($('#is_virtual_good').attr('checked'))
{
$('#virtual_good').show();
$('#virtual_good_more').show();
$('#is_virtual_good').attr('disabled', 'disabled');
}
if ( $('input[name=is_virtual_file]:checked').val() == 1)
@@ -58,7 +55,7 @@
}
$('input[name=is_virtual_file]').live('change', function() {
if($(this).val() == "1")
if($(this).val() == '1')
{
$('#virtual_good_more').show();
$('#virtual_good_attributes').show();
@@ -72,12 +69,12 @@
}
});
$('input[name=is_virtual_good]').live('change', function() {
/*$('input[name=is_virtual_good]').live('change', function() {
if($(this).attr('checked'))
$('#is_virtual').val(1);
else
$('#is_virtual').val(0);
});
});*/
$(document).ready(function() {
$('input').keypress(function(e) {
@@ -86,6 +83,74 @@
return (code == 13) ? false : true;
});
});
function uploadFile()
{
$.ajaxFileUpload (
{
url:'./uploadProductFile.php',
secureuri:false,
fileElementId:'virtual_product_file',
dataType: 'xml',
success: function (data, status)
{
data = data.getElementsByTagName('return')[0];
var result = data.getAttribute("result");
var msg = data.getAttribute("msg");
var fileName = data.getAttribute("filename")
if(result == "error")
$("#upload-confirmation").html('<p>error: ' + msg + '</p>');
else
{
$('#virtual_product_file').remove();
$('#virtual_product_file_label').hide();
$('#file_missing').hide();
$('#delete_downloadable_product').show();
$('#virtual_product_name').attr('value', fileName);
$('#upload-confirmation').html(
'<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'">{l s='The file'}&nbsp;"' + fileName + '"&nbsp;{l s='has successfully been uploaded'}</a>' +
'<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="' + msg + '" />');
}
}
}
);
}
function uploadFile2()
{
var link = '';
$.ajaxFileUpload (
{
url:'./uploadProductFileAttribute.php',
secureuri:false,
fileElementId:'virtual_product_file_attribute',
dataType: 'xml',
success: function (data, status)
{
data = data.getElementsByTagName('return')[0];
var result = data.getAttribute("result");
var msg = data.getAttribute("msg");
var fileName = data.getAttribute("filename");
if(result == "error")
$("#upload-confirmation2").html('<p>error: ' + msg + '</p>');
else
{
$('#virtual_product_file_attribute').remove();
$('#virtual_product_file_label').hide();
$('#file_missing').hide();
$('#delete_downloadable_product_attribute').show();
$('#upload-confirmation2').html(
'<a class="link" href="get-file-admin.php?file='+msg+'&filename='+fileName+'">{l s='The file'}&nbsp;"' + fileName + '"&nbsp;{l s='has successfully been uploaded'}</a>' +
'<input type="hidden" id="virtual_product_filename_attribute" name="virtual_product_filename_attribute" value="' + msg + '" />');
$('#virtual_product_name_attribute').attr('value', fileName);
link = $("#delete_downloadable_product_attribute").attr('href');
$("#delete_downloadable_product_attribute").attr('href', link+"&file="+msg);
}
}
}
);
}
</script>
@@ -103,8 +168,8 @@
<table cellpadding="5" style="width: 50%; float: left; margin-right: 20px; border-right: 1px solid #CCCCCC;">
<tr><td>
<br/>{l s='Does this product has an associated file ?'}<br />
<input type="radio" value="1" id="virtual_good_file_1" name="is_virtual_file" {if $product_downloaded}checked="checked"{/if} />{l s='Yes'}
<input type="radio" value="0" id="virtual_good_file_2" name="is_virtual_file" {if !$product_downloaded}checked="checked"{/if} />{l s='No'}<br /><br />
<label style="width:50px"><input type="radio" value="1" id="virtual_good_file_1" name="is_virtual_file" {if $product_downloaded}checked="checked"{/if} />{l s='Yes'}</label>
<label style="width:50px"><input type="radio" value="0" id="virtual_good_file_2" name="is_virtual_file" {if !$product_downloaded}checked="checked"{/if} />{l s='No'}</label><br /><br />
{if $download_product_file_missing}
<p class="alert" id="file_missing">
<b>{$download_product_file_missing} :<br/>
@@ -139,13 +204,16 @@
{/if}
</div>
<a id="delete_downloadable_product" style="display:none;" onclick="return confirm('{l s='Delete this file'}')" href="{$currentIndex}&deleteVirtualProduct=true&token={$token}&id_product={$product->id}" class="red">
{l s='Delete this file'}
<img src="../img/admin/delete.gif" alt="{l s='Delete this file'}"/>
</a>
</div>
{else}
<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="{$product->productDownload->filename}" />
{l s='This is the link'}:&nbsp;{$product->productDownload->getHtmlLink(false, true)}
<a onclick="return confirm('{l s='Delete this file'})')" href="{$currentIndex}&deleteVirtualProduct=true&token={$token}&id_product={$product->id}" class="red">{l s='Delete this file'}</a>
{l s='This is the link'}:<br />
{$product->productDownload->getHtmlLink(false, true)}
<a onclick="return confirm('{l s='Delete this file'})')" href="{$currentIndex}&deleteVirtualProduct=true&token={$token}&id_product={$product->id}" class="red">
<img src="../img/admin/delete.gif" alt="{l s='Delete this file'}"/>
</a>
{/if}
</p>