// added pack.tpl and virtualproduct.tpl
This commit is contained in:
@@ -166,7 +166,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<p class="block">
|
<p class="block">
|
||||||
<label for="virtual_product_name" class="t">{l s='Filename'}</label>
|
<label for="virtual_product_name_attribute" class="t">{l s='Filename'}</label>
|
||||||
<input id="virtual_product_name_attribute" name="virtual_product_name_attribute" style="width:200px" value="" type="text">
|
<input id="virtual_product_name_attribute" name="virtual_product_name_attribute" style="width:200px" value="" type="text">
|
||||||
<span class="hint" name="help_box" style="display:none;">{l s='The full filename with its extension (e.g., Book.pdf)'}</span>
|
<span class="hint" name="help_box" style="display:none;">{l s='The full filename with its extension (e.g., Book.pdf)'}</span>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -79,7 +79,36 @@
|
|||||||
var toload = new Array();
|
var toload = new Array();
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
{if $is_pack}
|
||||||
|
$('#pack_product').attr("checked", "checked");
|
||||||
|
$('li.tab-row a[id*="VirtualProduct"]').hide();
|
||||||
|
{elseif $product->is_virtual}
|
||||||
|
$('#virtual_product').attr("checked", "checked");
|
||||||
|
$('li.tab-row a[id*="Pack"]').hide();
|
||||||
|
{else}
|
||||||
|
$('#simple_product').attr("checked", "checked");
|
||||||
|
$('li.tab-row a[id*="Pack"]').hide();
|
||||||
|
$('li.tab-row a[id*="VirtualProduct"]').hide();
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
$('input[name="type_product"]').click(function() {
|
||||||
|
$('li.tab-row a[id*="Pack"]').hide();
|
||||||
|
$('li.tab-row a[id*="VirtualProduct"]').hide();
|
||||||
|
var val = $(this).val();
|
||||||
|
if (val == 1)
|
||||||
|
$('li.tab-row a[id*="Pack"]').show();
|
||||||
|
else if (val == 2)
|
||||||
|
$('li.tab-row a[id*="VirtualProduct"]').show();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#is_virtual_good').removeAttr("checked");
|
||||||
|
$('#is_virtual').val(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$('#desc-product-newCombination').hide();
|
$('#desc-product-newCombination').hide();
|
||||||
|
|
||||||
{* submenu binding *}
|
{* submenu binding *}
|
||||||
$(".tab-page").click(function(e){
|
$(".tab-page").click(function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -160,31 +189,6 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
function toggleVirtualProduct(elt)
|
|
||||||
{
|
|
||||||
$("#is_virtual_file_product").hide();
|
|
||||||
$("#virtual_good_attributes").hide();
|
|
||||||
|
|
||||||
if (elt.checked)
|
|
||||||
{
|
|
||||||
$('#virtual_good').show('slow');
|
|
||||||
$('#virtual_good_more').show('slow');
|
|
||||||
getE('out_of_stock_1').checked = 'checked';
|
|
||||||
getE('out_of_stock_2').disabled = 'disabled';
|
|
||||||
getE('out_of_stock_3').disabled = 'disabled';
|
|
||||||
getE('label_out_of_stock_2').setAttribute('for', '');
|
|
||||||
getE('label_out_of_stock_3').setAttribute('for', '');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$('#virtual_good').hide('slow');
|
|
||||||
$('#virtual_good_more').hide('slow');
|
|
||||||
getE('out_of_stock_2').disabled = false;
|
|
||||||
getE('out_of_stock_3').disabled = false;
|
|
||||||
getE('label_out_of_stock_2').setAttribute('for', 'out_of_stock_2');
|
|
||||||
getE('label_out_of_stock_3').setAttribute('for', 'out_of_stock_3');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function uploadFile()
|
function uploadFile()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
{*
|
||||||
|
* 2007-2011 PrestaShop
|
||||||
|
*
|
||||||
|
* NOTICE OF LICENSE
|
||||||
|
*
|
||||||
|
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||||
|
* that is bundled with this package in the file LICENSE.txt.
|
||||||
|
* It is also available through the world-wide-web at this URL:
|
||||||
|
* http://opensource.org/licenses/afl-3.0.php
|
||||||
|
* If you did not receive a copy of the license and are unable to
|
||||||
|
* obtain it through the world-wide-web, please send an email
|
||||||
|
* to license@prestashop.com so we can send you a copy immediately.
|
||||||
|
*
|
||||||
|
* DISCLAIMER
|
||||||
|
*
|
||||||
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||||
|
* versions in the future. If you wish to customize PrestaShop for your
|
||||||
|
* needs please refer to http://www.prestashop.com for more information.
|
||||||
|
*
|
||||||
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
|
* @copyright 2007-2011 PrestaShop SA
|
||||||
|
* @version Release: $Revision: 11204 $
|
||||||
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*}
|
||||||
|
|
||||||
|
<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.'}';
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$('input').keypress(function(e) {
|
||||||
|
var code = null;
|
||||||
|
code = (e.keyCode ? e.keyCode : e.which);
|
||||||
|
return (code == 13) ? false : true;
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#curPackItemName') .autocomplete('ajax_products_list.php', {
|
||||||
|
delay: 100,
|
||||||
|
minChars: 1,
|
||||||
|
autoFill: true,
|
||||||
|
max:20,
|
||||||
|
matchContains: true,
|
||||||
|
mustMatch:true,
|
||||||
|
scroll:false,
|
||||||
|
cacheLength:0,
|
||||||
|
// param multipleSeparator:'||' ajouté à cause de bug dans lib autocomplete
|
||||||
|
multipleSeparator:'||',
|
||||||
|
formatItem: function(item) {
|
||||||
|
return item[1]+' - '+item[0];
|
||||||
|
}
|
||||||
|
}).result(function(event, item){
|
||||||
|
$('#curPackItemId').val(item[1]);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#curPackItemName').setOptions({
|
||||||
|
extraParams: {
|
||||||
|
excludeIds : getSelectedIds(), excludeVirtuals : 1
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<h4>{l s='Pack'}</h4>
|
||||||
|
<div class="separation"></div>
|
||||||
|
|
||||||
|
<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" />
|
||||||
|
|
||||||
|
<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>
|
||||||
@@ -0,0 +1,194 @@
|
|||||||
|
{*
|
||||||
|
* 2007-2011 PrestaShop
|
||||||
|
*
|
||||||
|
* NOTICE OF LICENSE
|
||||||
|
*
|
||||||
|
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||||
|
* that is bundled with this package in the file LICENSE.txt.
|
||||||
|
* It is also available through the world-wide-web at this URL:
|
||||||
|
* http://opensource.org/licenses/afl-3.0.php
|
||||||
|
* If you did not receive a copy of the license and are unable to
|
||||||
|
* obtain it through the world-wide-web, please send an email
|
||||||
|
* to license@prestashop.com so we can send you a copy immediately.
|
||||||
|
*
|
||||||
|
* DISCLAIMER
|
||||||
|
*
|
||||||
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||||
|
* versions in the future. If you wish to customize PrestaShop for your
|
||||||
|
* needs please refer to http://www.prestashop.com for more information.
|
||||||
|
*
|
||||||
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
|
* @copyright 2007-2011 PrestaShop SA
|
||||||
|
* @version Release: $Revision: 11204 $
|
||||||
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*}
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
var newLabel = '{l s='New label'}';
|
||||||
|
var choose_language = '{l s='Choose language:'}';
|
||||||
|
var required = '{l s='required'}';
|
||||||
|
var customizationUploadableFileNumber = '{$product->uploadable_files}';
|
||||||
|
var customizationTextFieldNumber = '{$product->text_fields}';
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $("input[name=is_virtual_file]:checked").val() == 1)
|
||||||
|
{
|
||||||
|
$("#virtual_good_more").show();
|
||||||
|
$("#virtual_good_attributes").show();
|
||||||
|
$("#is_virtual_file_product").show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$("#virtual_good_more").hide();
|
||||||
|
$("#virtual_good_attributes").hide();
|
||||||
|
$("#is_virtual_file_product").hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$("input[name=is_virtual_file]").live("change", function() {
|
||||||
|
if($(this).val() == "1")
|
||||||
|
{
|
||||||
|
$("#virtual_good_more").show();
|
||||||
|
$("#virtual_good_attributes").show();
|
||||||
|
$("#is_virtual_file_product").show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$("#virtual_good_more").hide();
|
||||||
|
$("#virtual_good_attributes").hide();
|
||||||
|
$("#is_virtual_file_product").hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("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) {
|
||||||
|
var code = null;
|
||||||
|
code = (e.keyCode ? e.keyCode : e.which);
|
||||||
|
return (code == 13) ? false : true;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<h4>{l s='Virtual Product'}</h4>
|
||||||
|
<div class="separation"></div>
|
||||||
|
<table cellpadding="5" cellspacing="0" border="0" style="width: 100%;">
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<p><input type="checkbox" id="is_virtual_good" name="is_virtual_good" value="true" {*onclick="toggleVirtualProduct(this);"*} {if $product->is_virtual && $product->productDownload->active}checked="checked"{/if} />
|
||||||
|
<label for="is_virtual_good" class="t bold">{l s='Is this a virtual product?'}</label>
|
||||||
|
</p>
|
||||||
|
{* [begin] virtual product *}
|
||||||
|
<div id="virtual_good" class="toggleVirtualPhysicalProduct" {if !$product->productDownload->id || $product->productDownload->active}style="display:none"{/if} >
|
||||||
|
<input type="hidden" id="is_virtual" name="is_virtual" value="{$product->is_virtual}" />
|
||||||
|
<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 />
|
||||||
|
{if $download_product_file_missing}
|
||||||
|
<p class="alert" id="file_missing">
|
||||||
|
<b>{$download_product_file_missing} :<br/>
|
||||||
|
{$smarty.const._PS_DOWNLOAD_DIR_}/{$product->productDownload->filename}</b>
|
||||||
|
</p>
|
||||||
|
{/if}
|
||||||
|
</td></tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div id="is_virtual_file_product" style="display:none;">
|
||||||
|
{if !$download_dir_writable}
|
||||||
|
<p class="alert">
|
||||||
|
{l s='Your download repository is not writable.'}<br/>
|
||||||
|
{$smarty.const._PS_DOWNLOAD_DIR_}
|
||||||
|
</p>
|
||||||
|
{/if}
|
||||||
|
{if empty($product->cache_default_attribute)}
|
||||||
|
{if $product->productDownload->id}
|
||||||
|
<input type="hidden" id="virtual_product_id" name="virtual_product_id" value="{$product->productDownload->id}" />
|
||||||
|
{/if}
|
||||||
|
<p class="block">
|
||||||
|
{if !$product->productDownload->checkFile()}
|
||||||
|
<div style="padding:5px;width:50%;float:left;margin-right:20px;border-right:1px solid #CCCCCC">
|
||||||
|
<p>{l s='Your server\'s maximum upload file size is'}: {$upload_max_filesize}</p>
|
||||||
|
{if $show_file_input}
|
||||||
|
<label id="virtual_product_file_label" for="virtual_product_file" class="t">{l s='Upload a file'}</label>
|
||||||
|
<p><input type="file" id="virtual_product_file" name="virtual_product_file" onchange="uploadFile();" maxlength="{$upload_max_filesize}" /></p>
|
||||||
|
{/if}
|
||||||
|
<div id="upload-confirmation">
|
||||||
|
{if $up_filename}
|
||||||
|
<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="{$up_filename}" />
|
||||||
|
{/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'}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{else}
|
||||||
|
<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="{$product->productDownload->filename}" />
|
||||||
|
{l s='This is the link'}: {$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>
|
||||||
|
{/if}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class="block">
|
||||||
|
<label for="virtual_product_name" class="t">{l s='Filename'}</label>
|
||||||
|
<input type="text" id="virtual_product_name" name="virtual_product_name" style="width:200px" value="{$product->productDownload->display_filename|htmlentitiesUTF8}" />
|
||||||
|
<span class="hint" name="help_box" style="display:none;">{l s='The full filename with its extension (e.g., Book.pdf)'}</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
<table cellpadding="5" style="width: 40%; float: left; margin-left: 10px;">
|
||||||
|
<tr><td>
|
||||||
|
<div id="virtual_good_more" style="'.$hidden.'padding:5px;width:40%;float:left;margin-left:10px">
|
||||||
|
<p class="block">
|
||||||
|
<label for="virtual_product_nb_downloable" class="t">{l s='Number of downloads'}</label>
|
||||||
|
<input type="text" id="virtual_product_nb_downloable" name="virtual_product_nb_downloable" value="{$product->productDownload->nb_downloadable}" class="" size="6" />
|
||||||
|
<span class="hint" name="help_box" style="display:none">{l s='Number of authorized downloads per customer'}</span>
|
||||||
|
</p>
|
||||||
|
<p class="block">
|
||||||
|
<label for="virtual_product_expiration_date" class="t">{l s='Expiration date'}</label>
|
||||||
|
<input class="datepicker" type="text" id="virtual_product_expiration_date" name="virtual_product_expiration_date" value="{$product->productDownload->date_expiration}" size="11" maxlength="10" autocomplete="off" /> {l s='Format: YYYY-MM-DD'}
|
||||||
|
<span class="hint" name="help_box" style="display:none">{l s='No expiration date if you leave this blank'}</span>
|
||||||
|
</p>
|
||||||
|
<p class="block">
|
||||||
|
<label for="virtual_product_nb_days" class="t">{l s='Number of days'}</label>
|
||||||
|
<input type="text" id="virtual_product_nb_days" name="virtual_product_nb_days" value="{$product->productDownload->nb_days_accessible}" class="" size="4" /><sup> *</sup>
|
||||||
|
<span class="hint" name="help_box" style="display:none">{l s='How many days this file can be accessed by customers'} - <em>({l s='set to zero for unlimited access'})</em></span>
|
||||||
|
</p>
|
||||||
|
<p class="block">
|
||||||
|
<label for="virtual_product_is_shareable" class="t">{l s='is shareable'}</label>
|
||||||
|
<input type="checkbox" id="virtual_product_is_shareable" name="virtual_product_is_shareable" value="1" {if $product->productDownload->is_shareable}checked="checked"{/if} />
|
||||||
|
<span class="hint" name="help_box" style="display:none">{l s='Specify if the file can be shared'}</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{else}
|
||||||
|
<div class="hint clear" style="display: block;width: 70%;">{l s='You used combinations, for this reason you can\'t edit your file here, but in the Combinations tab'}</div>
|
||||||
|
<br />
|
||||||
|
{$error_product_download}
|
||||||
|
{/if}
|
||||||
|
</td></tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
@@ -67,7 +67,7 @@ class ProductDownloadCore extends ObjectModel
|
|||||||
'primary' => 'id_product_download',
|
'primary' => 'id_product_download',
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
||||||
'id_product_attribute ' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
'id_product_attribute' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||||
'display_filename' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 255),
|
'display_filename' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 255),
|
||||||
'filename' => array('type' => self::TYPE_STRING, 'validate' => 'isSha1', 'size' => 255),
|
'filename' => array('type' => self::TYPE_STRING, 'validate' => 'isSha1', 'size' => 255),
|
||||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
|
|
||||||
protected $available_tabs = array(
|
protected $available_tabs = array(
|
||||||
'Informations',
|
'Informations',
|
||||||
|
'Pack',
|
||||||
|
'VirtualProduct',
|
||||||
'Prices',
|
'Prices',
|
||||||
'Seo',
|
'Seo',
|
||||||
'Associations',
|
'Associations',
|
||||||
@@ -57,6 +59,8 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
|
|
||||||
protected $tabs_preloaded = array(
|
protected $tabs_preloaded = array(
|
||||||
'Informations' => true,
|
'Informations' => true,
|
||||||
|
'Pack' => true,
|
||||||
|
'VirtualProduct' => true,
|
||||||
'Prices' => true,
|
'Prices' => true,
|
||||||
'Seo' => true,
|
'Seo' => true,
|
||||||
'Associations' => true,
|
'Associations' => true,
|
||||||
@@ -157,6 +161,8 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
// @since 1.5 : translations for tabs
|
// @since 1.5 : translations for tabs
|
||||||
$this->available_tabs_lang = array (
|
$this->available_tabs_lang = array (
|
||||||
'Informations' => $this->l('Informations'),
|
'Informations' => $this->l('Informations'),
|
||||||
|
'Pack' => $this->l('Pack'),
|
||||||
|
'VirtualProduct' => $this->l('Virtual Product'),
|
||||||
'Prices' => $this->l('Prices'),
|
'Prices' => $this->l('Prices'),
|
||||||
'Seo' => $this->l('SEO'),
|
'Seo' => $this->l('SEO'),
|
||||||
'Images' => $this->l('Images'),
|
'Images' => $this->l('Images'),
|
||||||
@@ -2536,6 +2542,117 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
|
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function initFormPack($product, $languages, $default_language)
|
||||||
|
{
|
||||||
|
$data = $this->context->smarty->createData();
|
||||||
|
|
||||||
|
$product->packItems = Pack::getItems($product->id, $this->context->language->id);
|
||||||
|
|
||||||
|
$input_pack_items = '';
|
||||||
|
if (Tools::getValue('inputPackItems'))
|
||||||
|
$input_pack_items = Tools::getValue('inputPackItems');
|
||||||
|
else
|
||||||
|
foreach ($product->packItems as $pack_item)
|
||||||
|
$input_pack_items .= $pack_item->pack_quantity.'x'.$pack_item->id.'-';
|
||||||
|
|
||||||
|
$input_namepack_items = '';
|
||||||
|
if (Tools::getValue('namePackItems'))
|
||||||
|
$input_namepack_items = Tools::getValue('namePackItems');
|
||||||
|
else
|
||||||
|
foreach ($product->packItems as $pack_item)
|
||||||
|
$input_namepack_items .= $pack_item->pack_quantity.' x '.$pack_item->name.'¤';
|
||||||
|
|
||||||
|
$data->assign(array(
|
||||||
|
'product' => $product,
|
||||||
|
'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'),
|
||||||
|
'input_pack_items' => $input_pack_items,
|
||||||
|
'input_namepack_items' => $input_namepack_items
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function initFormVirtualProduct($product, $languages, $default_language)
|
||||||
|
{
|
||||||
|
|
||||||
|
$data = $this->context->smarty->createData();
|
||||||
|
|
||||||
|
$currency = $this->context->currency;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Form for adding a virtual product like software, mp3, etc...
|
||||||
|
*/
|
||||||
|
$product_download = new ProductDownload();
|
||||||
|
if ($id_product_download = $product_download->getIdFromIdProduct($this->getFieldValue($product, 'id')))
|
||||||
|
$product_download = new ProductDownload($id_product_download);
|
||||||
|
$product->{'productDownload'} = $product_download;
|
||||||
|
|
||||||
|
// @todo handle is_virtual with the value of the product
|
||||||
|
$exists_file = realpath(_PS_DOWNLOAD_DIR_).'/'.$product->productDownload->filename;
|
||||||
|
$data->assign('product_downloaded', $product->productDownload->id && !empty($product->productDownload->display_filename));
|
||||||
|
|
||||||
|
if (!file_exists($exists_file)
|
||||||
|
&& !empty($product->productDownload->display_filename)
|
||||||
|
&& !empty($product->cache_default_attribute))
|
||||||
|
{
|
||||||
|
$msg = sprintf(Tools::displayError('This file "%s" is missing'), $product->productDownload->display_filename);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$msg = '';
|
||||||
|
|
||||||
|
$data->assign('download_product_file_missing', $msg);
|
||||||
|
$data->assign('download_dir_writable', ProductDownload::checkWritableDir());
|
||||||
|
|
||||||
|
if (empty($product->cache_default_attribute))
|
||||||
|
{
|
||||||
|
$data->assign('show_file_input', !strval(Tools::getValue('virtual_product_filename')) || $product->productDownload->id > 0);
|
||||||
|
// found in informations and combination : to merge
|
||||||
|
$data->assign('up_filename', strval(Tools::getValue('virtual_product_filename')));
|
||||||
|
$display_filename = ($product->productDownload->id > 0) ? $product->productDownload->display_filename : htmlentities(Tools::getValue('virtual_product_name'), ENT_COMPAT, 'UTF-8');
|
||||||
|
|
||||||
|
if (!$product->productDownload->id || !$product->productDownload->active)
|
||||||
|
$hidden = 'display:none;';
|
||||||
|
else
|
||||||
|
$hidden = '';
|
||||||
|
|
||||||
|
$product->productDownload->nb_downloadable = ($product->productDownload->id > 0) ? $product->productDownload->nb_downloadable : htmlentities(Tools::getValue('virtual_product_nb_downloable'), ENT_COMPAT, 'UTF-8');
|
||||||
|
$product->productDownload->date_expiration = ($product->productDownload->id > 0) ? ((!empty($product->productDownload->date_expiration) && $product->productDownload->date_expiration != '0000-00-00 00:00:00') ? date('Y-m-d', strtotime($product->productDownload->date_expiration)) : '' ) : htmlentities(Tools::getValue('virtual_product_expiration_date'), ENT_COMPAT, 'UTF-8');
|
||||||
|
$product->productDownload->nb_days_accessible = ($product->productDownload->id > 0) ? $product->productDownload->nb_days_accessible : htmlentities(Tools::getValue('virtual_product_nb_days'), ENT_COMPAT, 'UTF-8');
|
||||||
|
$product->productDownload->is_shareable = $product->productDownload->id > 0 && $product->productDownload->is_shareable;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error = '';
|
||||||
|
$product_attribute = ProductDownload::getAttributeFromIdProduct($this->getFieldValue($product, 'id'));
|
||||||
|
foreach ($product_attribute as $p)
|
||||||
|
{
|
||||||
|
$product_download_attribute = new ProductDownload($p['id_product_download']);
|
||||||
|
$exists_file2 = realpath(_PS_DOWNLOAD_DIR_).'/'.$product_download_attribute->filename;
|
||||||
|
if (!file_exists($exists_file2) && !empty($product_download_attribute->id_product_attribute))
|
||||||
|
{
|
||||||
|
$msg = sprintf(Tools::displayError('This file "%s" is missing'), $product_download_attribute->display_filename);
|
||||||
|
$error .= '<p class="alert" id="file_missing">
|
||||||
|
<b>'.$msg.' :<br/>
|
||||||
|
'.realpath(_PS_DOWNLOAD_DIR_).'/'.$product_download_attribute->filename.'</b>
|
||||||
|
</p>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$data->assign('error_product_download', $error);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data->assign('ad', dirname($_SERVER['PHP_SELF']));
|
||||||
|
$data->assign('product', $product);
|
||||||
|
$data->assign('token', $this->token);
|
||||||
|
$data->assign('currency', $currency);
|
||||||
|
$data->assign($this->tpl_form_vars);
|
||||||
|
$data->assign('link', $this->context->link);
|
||||||
|
$this->tpl_form_vars['product'] = $product;
|
||||||
|
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
private function _getFinalPrice($specific_price, $productPrice, $taxRate)
|
private function _getFinalPrice($specific_price, $productPrice, $taxRate)
|
||||||
{
|
{
|
||||||
$price = Tools::ps_round((float)($specific_price['price']) ? $specific_price['price'] : $productPrice, 2);
|
$price = Tools::ps_round((float)($specific_price['price']) ? $specific_price['price'] : $productPrice, 2);
|
||||||
|
|||||||
Reference in New Issue
Block a user