function displayFormInformations($obj, $currency)
    {
        parent::displayForm(false);
        global $currentIndex, $cookie, $link;
        $default_country = new Country((int) Configuration::get('PS_COUNTRY_DEFAULT'));
        $iso = Language::getIsoById((int) $cookie->id_lang);
        $has_attribute = false;
        $qty_state = 'readonly';
        $qty = Attribute::getAttributeQty($this->getFieldValue($obj, 'id_product'));
        if ($qty === false) {
            if (Validate::isLoadedObject($obj)) {
                $qty = $this->getFieldValue($obj, 'quantity');
            } else {
                $qty = 1;
            }
            $qty_state = '';
        } else {
            $has_attribute = true;
        }
        $cover = Product::getCover($obj->id);
        $this->_applyTaxToEcotax($obj);
        echo '
		<div class="tab-page" id="step1">
			<h4 class="tab">1. ' . $this->l('Info.') . '</h4>
			<script type="text/javascript">
				$(document).ready(function() {
					updateCurrentText();
					updateFriendlyURL();
					$.ajax({
						url: "' . dirname($currentIndex) . '/ajax.php",
						cache: false,
						dataType: "json",
						data: "ajaxProductManufacturers=1",
						success: function(j) {
							var options = $("select#id_manufacturer").html();
							if (j)
							for (var i = 0; i < j.length; i++)
								options += \'<option value="\' + j[i].optionValue + \'">\' + j[i].optionDisplay + \'</option>\';
							$("select#id_manufacturer").html(options);
						},
						error: function(XMLHttpRequest, textStatus, errorThrown)
						{
							alert(\'Manufacturer ajax error: \'+textStatus);
						}

					});
					$.ajax({
						url: "' . dirname($currentIndex) . '/ajax.php",
						cache: false,
						dataType: "json",
						data: "ajaxProductSuppliers=1",
						success: function(j) {
							var options = $("select#id_supplier").html();
							if (j)
							for (var i = 0; i < j.length; i++)
								options += \'<option value="\' + j[i].optionValue + \'">\' + j[i].optionDisplay + \'</option>\';
							$("select#id_supplier").html(options);
						},
						error: function(XMLHttpRequest, textStatus, errorThrown)
						{
							alert(\'Supplier ajax error: \'+textStatus);
						}

					});
					if ($(\'#available_for_order\').is(\':checked\')){
						$(\'#show_price\').attr(\'checked\', \'checked\');
						$(\'#show_price\').attr(\'disabled\', \'disabled\');
					}
					else {
						$(\'#show_price\').attr(\'disabled\', \'\');
					}
				});
			</script>
			<b>' . $this->l('Product global information') . '</b>&nbsp;-&nbsp;';
        $preview_url = '';
        if (isset($obj->id)) {
            $preview_url = $link->getProductLink($this->getFieldValue($obj, 'id'), $this->getFieldValue($obj, 'link_rewrite', $this->_defaultFormLanguage), Category::getLinkRewrite($this->getFieldValue($obj, 'id_category_default'), (int) $cookie->id_lang));
            if (!$obj->active) {
                $admin_dir = dirname($_SERVER['PHP_SELF']);
                $admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
                $token = Tools::encrypt('PreviewProduct' . $obj->id);
                $preview_url .= $obj->active ? '' : '&adtoken=' . $token . '&ad=' . $admin_dir;
            }
            echo '
			<a href="index.php?tab=AdminCatalog&id_product=' . $obj->id . '&deleteproduct&token=' . $this->token . '" style="float:right;"
			onclick="return confirm(\'' . $this->l('Are you sure?', __CLASS__, true, false) . '\');">
			<img src="../img/admin/delete.gif" alt="' . $this->l('Delete this product') . '" title="' . $this->l('Delete this product') . '" /> ' . $this->l('Delete this product') . '</a>
			<a href="' . $preview_url . '" target="_blank"><img src="../img/admin/details.gif" alt="' . $this->l('View product in shop') . '" title="' . $this->l('View product in shop') . '" /> ' . $this->l('View product in shop') . '</a>';
            if (file_exists(_PS_MODULE_DIR_ . 'statsproduct/statsproduct.php')) {
                echo '&nbsp;-&nbsp;<a href="index.php?tab=AdminStats&module=statsproduct&id_product=' . $obj->id . '&token=' . Tools::getAdminToken('AdminStats' . (int) Tab::getIdFromClassName('AdminStats') . (int) $cookie->id_employee) . '"><img src="../modules/statsproduct/logo.gif" alt="' . $this->l('View product sales') . '" title="' . $this->l('View product sales') . '" /> ' . $this->l('View product sales') . '</a>';
            }
        }
        echo '
			<hr class="clear"/>
			<br />
				<table cellpadding="5" style="width: 50%; float: left; margin-right: 20px; border-right: 1px solid #E0D0B1;">
					<tr>
						<td class="col-left">' . $this->l('Name:') . '</td>
						<td style="padding-bottom:5px;" class="translatable">';
        foreach ($this->_languages as $language) {
            echo '		<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
								<input size="43" type="text" id="name_' . $language['id_lang'] . '" name="name_' . $language['id_lang'] . '"
								value="' . stripslashes(htmlspecialchars($this->getFieldValue($obj, 'name', $language['id_lang']))) . '"' . (!$obj->id ? ' onkeyup="if (isArrowKey(event)) return; copy2friendlyURL();"' : '') . ' onkeyup="if (isArrowKey(event)) return; updateCurrentText();" onchange="updateCurrentText();" /><sup> *</sup>
								<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
							</div>';
        }
        echo '		</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Reference:') . '</td>
						<td style="padding-bottom:5px;">
							<input size="55" type="text" name="reference" value="' . htmlentities($this->getFieldValue($obj, 'reference'), ENT_COMPAT, 'UTF-8') . '" style="width: 130px; margin-right: 44px;" />
							<span class="hint" name="help_box">' . $this->l('Special characters allowed:') . ' .-_#\\<span class="hint-pointer">&nbsp;</span></span>
						</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Supplier Reference:') . '</td>
						<td style="padding-bottom:5px;">
							<input size="55" type="text" name="supplier_reference" value="' . htmlentities($this->getFieldValue($obj, 'supplier_reference'), ENT_COMPAT, 'UTF-8') . '" style="width: 130px; margin-right: 44px;" />
							<span class="hint" name="help_box">' . $this->l('Special characters allowed:') . ' .-_#\\<span class="hint-pointer">&nbsp;</span></span>
						</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('EAN13 or JAN:') . '</td>
						<td style="padding-bottom:5px;">
							<input size="55" maxlength="13" type="text" name="ean13" value="' . htmlentities($this->getFieldValue($obj, 'ean13'), ENT_COMPAT, 'UTF-8') . '" style="width: 130px; margin-right: 5px;" /> <span class="small">' . $this->l('(Europe, Japan)') . '</span>
						</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('UPC:') . '</td>
						<td style="padding-bottom:5px;">
							<input size="55" maxlength="12" type="text" name="upc" value="' . htmlentities($this->getFieldValue($obj, 'upc'), ENT_COMPAT, 'UTF-8') . '" style="width: 130px; margin-right: 5px;" /> <span class="small">' . $this->l('(US, Canada)') . '</span>
						</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Location (warehouse):') . '</td>
						<td style="padding-bottom:5px;">
							<input size="55" type="text" name="location" value="' . htmlentities($this->getFieldValue($obj, 'location'), ENT_COMPAT, 'UTF-8') . '" style="width: 130px; margin-right: 44px;" />
						</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Width ( package ) :') . '</td>
						<td style="padding-bottom:5px;">
							<input size="6" maxlength="6" name="width" type="text" value="' . htmlentities($this->getFieldValue($obj, 'width'), ENT_COMPAT, 'UTF-8') . '" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\');" /> ' . Configuration::get('PS_DIMENSION_UNIT') . '
						</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Height ( package ) :') . '</td>
						<td style="padding-bottom:5px;">
							<input size="6" maxlength="6" name="height" type="text" value="' . htmlentities($this->getFieldValue($obj, 'height'), ENT_COMPAT, 'UTF-8') . '" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\');" /> ' . Configuration::get('PS_DIMENSION_UNIT') . '
						</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Deep ( package ) :') . '</td>
						<td style="padding-bottom:5px;">
							<input size="6" maxlength="6" name="depth" type="text" value="' . htmlentities($this->getFieldValue($obj, 'depth'), ENT_COMPAT, 'UTF-8') . '" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\');" /> ' . Configuration::get('PS_DIMENSION_UNIT') . '
						</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Weight ( package ) :') . '</td>
						<td style="padding-bottom:5px;">
							<input size="6" maxlength="6" name="weight" type="text" value="' . htmlentities($this->getFieldValue($obj, 'weight'), ENT_COMPAT, 'UTF-8') . '" onKeyUp="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\');" /> ' . Configuration::get('PS_WEIGHT_UNIT') . '
						</td>
					</tr>
				</table>
				<table cellpadding="5" style="width: 40%; float: left; margin-left: 10px;">
					<tr>
						<td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Status:') . '</td>
						<td style="padding-bottom:5px;">
							<input style="float:left;" onclick="toggleDraftWarning(false);showOptions(true);" type="radio" name="active" id="active_on" value="1" ' . ($this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/>
							<label for="active_on" class="t"><img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" style="float:left; padding:0px 5px 0px 5px;" />' . $this->l('Enabled') . '</label>
							<br class="clear" />
							<input style="float:left;" onclick="toggleDraftWarning(true);showOptions(false);"  type="radio" name="active" id="active_off" value="0" ' . (!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/>
							<label for="active_off" class="t"><img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" style="float:left; padding:0px 5px 0px 5px" />' . $this->l('Disabled') . ($obj->active ? '' : ' (<a href="' . $preview_url . '" alt="" target="_blank">' . $this->l('View product in shop') . '</a>)') . '</label>
						</td>
					</tr>
					<tr id="product_options" ' . (!$obj->active ? 'style="display:none"' : '') . '>
						<td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Options:') . '</td>
						<td style="padding-bottom:5px;">
							<input style="float: left;" type="checkbox" name="available_for_order" id="available_for_order" value="1" ' . ($this->getFieldValue($obj, 'available_for_order') ? 'checked="checked" ' : '') . ' onclick="if ($(this).is(\':checked\')){$(\'#show_price\').attr(\'checked\', \'checked\');$(\'#show_price\').attr(\'disabled\', \'disabled\');}else{$(\'#show_price\').attr(\'disabled\', \'\');}"/>
							<label for="available_for_order" class="t"><img src="../img/admin/products.gif" alt="' . $this->l('available for order') . '" title="' . $this->l('available for order') . '" style="float:left; padding:0px 5px 0px 5px" />' . $this->l('available for order') . '</label>
							<br class="clear" />
							<input style="float: left;" type="checkbox" name="show_price" id="show_price" value="1" ' . ($this->getFieldValue($obj, 'show_price') ? 'checked="checked" ' : '') . ' />
							<label for="show_price" class="t"><img src="../img/admin/gold.gif" alt="' . $this->l('display price') . '" title="' . $this->l('show price') . '" style="float:left; padding:0px 5px 0px 5px" />' . $this->l('show price') . '</label>
							<br class="clear" />
							<input style="float: left;" type="checkbox" name="online_only" id="online_only" value="1" ' . ($this->getFieldValue($obj, 'online_only') ? 'checked="checked" ' : '') . ' />
							<label for="online_only" class="t"><img src="../img/admin/basket_error.png" alt="' . $this->l('online only') . '" title="' . $this->l('online only') . '" style="float:left; padding:0px 5px 0px 5px" />' . $this->l('online only (not sold in store)') . '</label>
						</td>
					</tr>
					<tr>
						<td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Condition:') . '</td>
						<td style="padding-bottom:5px;">
							<select name="condition" id="condition">
								<option value="new" ' . ($obj->condition == 'new' ? 'selected="selected"' : '') . '>' . $this->l('New') . '</option>
								<option value="used" ' . ($obj->condition == 'used' ? 'selected="selected"' : '') . '>' . $this->l('Used') . '</option>
								<option value="refurbished" ' . ($obj->condition == 'refurbished' ? 'selected="selected"' : '') . '>' . $this->l('Refurbished') . '</option>
							</select>
						</td>
					</tr>
					<tr>
						<td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Manufacturer:') . '</td>
						<td style="padding-bottom:5px;">
							<select name="id_manufacturer" id="id_manufacturer">
								<option value="0">-- ' . $this->l('Choose (optional)') . ' --</option>';
        if ($id_manufacturer = $this->getFieldValue($obj, 'id_manufacturer')) {
            echo '				<option value="' . $id_manufacturer . '" selected="selected">' . Manufacturer::getNameById($id_manufacturer) . '</option>
								<option disabled="disabled">----------</option>';
        }
        echo '
							</select>&nbsp;&nbsp;&nbsp;<a href="?tab=AdminManufacturers&addmanufacturer&token=' . Tools::getAdminToken('AdminManufacturers' . (int) Tab::getIdFromClassName('AdminManufacturers') . (int) $cookie->id_employee) . '" onclick="return confirm(\'' . $this->l('Are you sure you want to delete product information entered?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="' . $this->l('Create') . '" title="' . $this->l('Create') . '" /> <b>' . $this->l('Create') . '</b></a>
						</td>
					</tr>
					<tr>
						<td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;">' . $this->l('Supplier:') . '</td>
						<td style="padding-bottom:5px;">
							<select name="id_supplier" id="id_supplier">
								<option value="0">-- ' . $this->l('Choose (optional)') . ' --</option>';
        if ($id_supplier = $this->getFieldValue($obj, 'id_supplier')) {
            echo '				<option value="' . $id_supplier . '" selected="selected">' . Supplier::getNameById($id_supplier) . '</option>
								<option disabled="disabled">----------</option>';
        }
        echo '
							</select>&nbsp;&nbsp;&nbsp;<a href="?tab=AdminSuppliers&addsupplier&token=' . Tools::getAdminToken('AdminSuppliers' . (int) Tab::getIdFromClassName('AdminSuppliers') . (int) $cookie->id_employee) . '" onclick="return confirm(\'' . $this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="' . $this->l('Create') . '" title="' . $this->l('Create') . '" /> <b>' . $this->l('Create') . '</b></a>
						</td>
					</tr>
				</table>
				<div class="clear"></div>
				<table cellpadding="5" style="width: 100%;">
					<tr><td colspan="2"><hr style="width:100%;" /></td></tr>';
        $this->displayPack($obj);
        echo '		<tr><td colspan="2"><hr style="width:100%;" /></td></tr>';
        /*
         * Form for add a virtual product like software, mp3, etc...
         */
        $productDownload = new ProductDownload();
        if ($id_product_download = $productDownload->getIdFromIdProduct($this->getFieldValue($obj, 'id'))) {
            $productDownload = new ProductDownload($id_product_download);
        }
        ?>
	<script type="text/javascript">
	// <![CDATA[
		ThickboxI18nImage = '<?php 
        echo $this->l('Image');
        ?>
';
		ThickboxI18nOf = '<?php 
        echo $this->l('of');
        ?>
';
		ThickboxI18nClose = '<?php 
        echo $this->l('Close');
        ?>
';
		ThickboxI18nOrEscKey = '<?php 
        echo $this->l('(or "Esc")');
        ?>
';
		ThickboxI18nNext = '<?php 
        echo $this->l('Next >');
        ?>
';
		ThickboxI18nPrev = '<?php 
        echo $this->l('< Previous');
        ?>
';
		tb_pathToImage = '../img/loadingAnimation.gif';
	//]]>
	</script>
	<script type="text/javascript" src="<?php 
        echo _PS_JS_DIR_;
        ?>
jquery/thickbox-modified.js"></script>
	<script type="text/javascript" src="<?php 
        echo _PS_JS_DIR_;
        ?>
jquery/ajaxfileupload.js"></script>
	<script type="text/javascript" src="<?php 
        echo _PS_JS_DIR_;
        ?>
date.js"></script>
	<style type="text/css">
		<!--
		@import url(<?php 
        echo _PS_CSS_DIR_;
        ?>
thickbox.css);
		-->
	</style>
	<script type="text/javascript">
	//<![CDATA[
	function toggleVirtualProduct(elt)
	{
		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()
	{
		$.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();
						new_href = $('#delete_downloadable_product').attr('href').replace('%26deleteVirtualProduct%3Dtrue', '%26file%3D'+msg+'%26deleteVirtualProduct%3Dtrue');
						$('#delete_downloadable_product').attr('href', new_href);
						$('#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+'"><?php 
        echo $this->l('The file');
        ?>
&nbsp;"' + fileName + '"&nbsp;<?php 
        echo $this->l('has successfully been uploaded');
        ?>
</a>' +
							'<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="' + msg + '" />');
					}
				}
			}
		);
	}

	//]]>
	</script>
	<?php 
        echo '
		<script type="text/javascript" src="../js/price.js"></script>
		<script type="text/javascript">
			var newLabel = \'' . $this->l('New label') . '\';
			var choose_language = \'' . $this->l('Choose language:') . '\';
			var required = \'' . $this->l('required') . '\';
			var customizationUploadableFileNumber = ' . (int) $this->getFieldValue($obj, 'uploadable_files') . ';
			var customizationTextFieldNumber = ' . (int) $this->getFieldValue($obj, 'text_fields') . ';
			var uploadableFileLabel = 0;
			var textFieldLabel = 0;
		</script>';
        ?>
	<tr>
		<td colspan="2">
			<p><input type="checkbox" id="is_virtual_good" name="is_virtual_good" value="true" onclick="toggleVirtualProduct(this);" <?php 
        if (($productDownload->id or Tools::getValue('is_virtual_good') == 'true') and $productDownload->active) {
            echo 'checked="checked"';
        }
        ?>
 />
			<label for="is_virtual_good" class="t bold" style="color: black;"><?php 
        echo $this->l('Is this a downloadable product?');
        ?>
</label></p>
			<div id="virtual_good" <?php 
        if (!$productDownload->id or !$productDownload->active) {
            echo 'style="display:none;"';
        }
        ?>
 >
	<?php 
        if (!ProductDownload::checkWritableDir()) {
            ?>
		<p class="alert">
			<?php 
            echo $this->l('Your download repository is not writable.');
            ?>
<br/>
			<?php 
            echo realpath(_PS_DOWNLOAD_DIR_);
            ?>
		</p>
	<?php 
        } else {
            ?>
			<?php 
            if ($productDownload->id) {
                echo '<input type="hidden" id="virtual_product_id" name="virtual_product_id" value="' . $productDownload->id . '" />';
            }
            ?>
				<p class="block">
	<?php 
            if (!$productDownload->checkFile()) {
                ?>

				<div style="padding:5px;width:50%;float:left;margin-right:20px;border-right:1px solid #E0D0B1">
		<?php 
                if ($productDownload->id) {
                    ?>
					<p class="alert" id="file_missing">
						<?php 
                    echo $this->l('This product is missing');
                    ?>
:<br/>
						<?php 
                    echo realpath(_PS_DOWNLOAD_DIR_) . '/' . $productDownload->physically_filename;
                    ?>
					</p>
		<?php 
                }
                ?>
					<p><?php 
                $max_upload = (int) ini_get('upload_max_filesize');
                $max_post = (int) ini_get('post_max_size');
                $upload_mb = min($max_upload, $max_post);
                echo $this->l('Your server\'s maximum upload file size is') . ':&nbsp;' . $upload_mb . $this->l('Mb');
                ?>
</p>
					<?php 
                if (!strval(Tools::getValue('virtual_product_filename'))) {
                    ?>
					<label id="virtual_product_file_label" for="virtual_product_file" class="t"><?php 
                    echo $this->l('Upload a file');
                    ?>
</label>
					<p><input type="file" id="virtual_product_file" name="virtual_product_file" onchange="uploadFile();" /></p>
					<?php 
                }
                ?>
					<div id="upload-confirmation">
					<?php 
                if ($up_filename = strval(Tools::getValue('virtual_product_filename'))) {
                    ?>
						<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="<?php 
                    echo $up_filename;
                    ?>
" />
					<?php 
                }
                ?>
					</div>
					<a id="delete_downloadable_product" style="display:none;" href="confirm.php?height=200&amp;width=300&amp;modal=true&amp;referer=<?php 
                echo rawurlencode($_SERVER['REQUEST_URI'] . '&deleteVirtualProduct=true');
                ?>
" class="thickbox red" title="<?php 
                echo $this->l('Delete this file');
                ?>
"><?php 
                echo $this->l('Delete this file');
                ?>
</a>
	<?php 
            } else {
                ?>
					<input type="hidden" id="virtual_product_filename" name="virtual_product_filename" value="<?php 
                echo $productDownload->physically_filename;
                ?>
" />
					<?php 
                echo $this->l('This is the link') . ':&nbsp;' . $productDownload->getHtmlLink(false, true);
                ?>
					<a href="confirm.php?height=200&amp;width=300&amp;modal=true&amp;referer=<?php 
                echo rawurlencode($_SERVER['REQUEST_URI'] . '&deleteVirtualProduct=true');
                ?>
" class="thickbox red" title="<?php 
                echo $this->l('Delete this file');
                ?>
"><?php 
                echo $this->l('Delete this file');
                ?>
</a>
	<?php 
            }
            // check if file exists
            ?>
				</p>
				<p class="block">
					<label for="virtual_product_name" class="t"><?php 
            echo $this->l('Filename');
            ?>
</label>
					<input type="text" id="virtual_product_name" name="virtual_product_name" style="width:200px" value="<?php 
            echo $productDownload->id > 0 ? $productDownload->display_filename : htmlentities(Tools::getValue('virtual_product_name'), ENT_COMPAT, 'UTF-8');
            ?>
" />
					<span class="hint" name="help_box" style="display:none;"><?php 
            echo $this->l('The full filename with its extension (e.g., Book.pdf)');
            ?>
</span>
				</p>

				</div>
				<div id="virtual_good_more" style="<?php 
            if (!$productDownload->id or !$productDownload->active) {
                echo 'display:none;';
            }
            ?>
padding:5px;width:40%;float:left;margin-left:10px">

				<p class="block">
					<label for="virtual_product_nb_downloable" class="t"><?php 
            echo $this->l('Number of downloads');
            ?>
</label>
					<input type="text" id="virtual_product_nb_downloable" name="virtual_product_nb_downloable" value="<?php 
            echo $productDownload->id > 0 ? $productDownload->nb_downloadable : htmlentities(Tools::getValue('virtual_product_nb_downloable'), ENT_COMPAT, 'UTF-8');
            ?>
" class="" size="6" />
					<span class="hint" name="help_box" style="display:none"><?php 
            echo $this->l('Number of authorized downloads per customer');
            ?>
</span>
				</p>
				<p class="block">
					<label for="virtual_product_expiration_date" class="t"><?php 
            echo $this->l('Expiration date');
            ?>
</label>
					<input type="text" id="virtual_product_expiration_date" name="virtual_product_expiration_date" value="<?php 
            echo $productDownload->id > 0 ? (!empty($productDownload->date_expiration) and $productDownload->date_expiration != '0000-00-00 00:00:00') ? date('Y-m-d', strtotime($productDownload->date_expiration)) : '' : htmlentities(Tools::getValue('virtual_product_expiration_date'), ENT_COMPAT, 'UTF-8');
            ?>
" size="11" maxlength="10" autocomplete="off" /> <?php 
            echo $this->l('Format: YYYY-MM-DD');
            ?>
					<span class="hint" name="help_box" style="display:none"><?php 
            echo $this->l('No expiration date if you leave this blank');
            ?>
</span>
				</p>
				<p class="block">
					<label for="virtual_product_nb_days" class="t"><?php 
            echo $this->l('Number of days');
            ?>
</label>
					<input type="text" id="virtual_product_nb_days" name="virtual_product_nb_days" value="<?php 
            echo $productDownload->id > 0 ? $productDownload->nb_days_accessible : htmlentities(Tools::getValue('virtual_product_nb_days'), ENT_COMPAT, 'UTF-8');
            ?>
" class="" size="4" /><sup> *</sup>
					<span class="hint" name="help_box" style="display:none"><?php 
            echo $this->l('How many days this file can be accessed by customers');
            ?>
 - <em>(<?php 
            echo $this->l('set to zero for unlimited access');
            ?>
)</em></span>
				</p>
				</div>
	<?php 
        }
        // check if download directory is writable
        ?>
			</div>
		</td>
	</tr>
	<tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>
	<script type="text/javascript">
		if ($('#is_virtual_good').attr('checked'))
		{
			$('#virtual_good').show('slow');
			$('#virtual_good_more').show('slow');
		}
	</script>

<?php 
        echo '
					<tr>
						<td class="col-left">' . $this->l('Pre-tax wholesale price:') . '</td>
						<td style="padding-bottom:5px;">
							' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<input size="11" maxlength="14" name="wholesale_price" type="text" value="' . htmlentities($this->getFieldValue($obj, 'wholesale_price'), ENT_COMPAT, 'UTF-8') . '" onchange="this.value = this.value.replace(/,/g, \'.\');" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . '
							<span style="margin-left:10px">' . $this->l('The wholesale price at which you bought this product') . '</span>
						</td>
					</tr>';
        echo '
					<tr>
						<td class="col-left">' . $this->l('Pre-tax retail price:') . '</td>
						<td style="padding-bottom:5px;">
							' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<input size="11" maxlength="14" id="priceTE" name="price" type="text" value="' . htmlentities($this->getFieldValue($obj, 'price'), ENT_COMPAT, 'UTF-8') . '" onchange="this.value = this.value.replace(/,/g, \'.\');" onkeyup="if (isArrowKey(event)) return; calcPriceTI();" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . '<sup> *</sup>
							<span style="margin-left:2px">' . $this->l('The pre-tax retail price to sell this product') . '</span>
						</td>
					</tr>';
        $tax_rules_groups = TaxRulesGroup::getTaxRulesGroups(true);
        $taxesRatesByGroup = TaxRulesGroup::getAssociatedTaxRatesByIdCountry(Country::getDefaultCountryId());
        $ecotaxTaxRate = Tax::getProductEcotaxRate();
        echo '<script type="text/javascript">';
        echo 'noTax = ' . (Tax::excludeTaxeOption() ? 'true' : 'false'), ";\n";
        echo 'taxesArray = new Array ();' . "\n";
        echo 'taxesArray[0] = 0', ";\n";
        foreach ($tax_rules_groups as $tax_rules_group) {
            $tax_rate = array_key_exists($tax_rules_group['id_tax_rules_group'], $taxesRatesByGroup) ? $taxesRatesByGroup[$tax_rules_group['id_tax_rules_group']] : 0;
            echo 'taxesArray[' . $tax_rules_group['id_tax_rules_group'] . ']=' . $tax_rate . "\n";
        }
        echo '
						ecotaxTaxRate = ' . $ecotaxTaxRate / 100 . ';
					</script>';
        echo '
					<tr>
						<td class="col-left">' . $this->l('Tax rule:') . '</td>
						<td style="padding-bottom:5px;">
					<span ' . (Tax::excludeTaxeOption() ? 'style="display:none;"' : '') . '>
					 <select onChange="javascript:calcPriceTI(); unitPriceWithTax(\'unit\');" name="id_tax_rules_group" id="id_tax_rules_group" ' . (Tax::excludeTaxeOption() ? 'disabled="disabled"' : '') . '>
						 <option value="0">' . $this->l('No Tax') . '</option>';
        foreach ($tax_rules_groups as $tax_rules_group) {
            echo '<option value="' . $tax_rules_group['id_tax_rules_group'] . '" ' . ($this->getFieldValue($obj, 'id_tax_rules_group') == $tax_rules_group['id_tax_rules_group'] ? ' selected="selected"' : '') . '>' . Tools::htmlentitiesUTF8($tax_rules_group['name']) . '</option>';
        }
        echo '</select>

				<a href="?tab=AdminTaxRulesGroup&addtax_rules_group&token=' . Tools::getAdminToken('AdminTaxRulesGroup' . (int) Tab::getIdFromClassName('AdminTaxRulesGroup') . (int) $cookie->id_employee) . '&id_product=' . (int) $obj->id . '" onclick="return confirm(\'' . $this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="' . $this->l('Create') . '" title="' . $this->l('Create') . '" /> <b>' . $this->l('Create') . '</b></a></span>
				';
        if (Tax::excludeTaxeOption()) {
            echo '<span style="margin-left:10px; color:red;">' . $this->l('Taxes are currently disabled') . '</span> (<b><a href="index.php?tab=AdminTaxes&token=' . Tools::getAdminToken('AdminTaxes' . (int) Tab::getIdFromClassName('AdminTaxes') . (int) $cookie->id_employee) . '">' . $this->l('Tax options') . '</a></b>)';
            echo '<input type="hidden" value="' . (int) $this->getFieldValue($obj, 'id_tax_rules_group') . '" name="id_tax_rules_group" />';
        }
        echo '</td>
					</tr>
				';
        if (Configuration::get('PS_USE_ECOTAX')) {
            echo '
					<tr>
						<td class="col-left">' . $this->l('Eco-tax (tax incl.):') . '</td>
						<td style="padding-bottom:5px;">
							' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<input size="11" maxlength="14" id="ecotax" name="ecotax" type="text" value="' . $this->getFieldValue($obj, 'ecotax') . '" onkeyup="if (isArrowKey(event))return; calcPriceTE(); this.value = this.value.replace(/,/g, \'.\'); if (parseInt(this.value) > getE(\'priceTE\').value) this.value = getE(\'priceTE\').value; if (isNaN(this.value)) this.value = 0;" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . '
							<span style="margin-left:10px">(' . $this->l('already included in price') . ')</span>
						</td>
					</tr>';
        }
        if ($default_country->display_tax_label) {
            echo '
						<tr ' . (Tax::excludeTaxeOption() ? 'style="display:none"' : '') . '>
							<td class="col-left">' . $this->l('Retail price with tax:') . '</td>
							<td style="padding-bottom:5px;">
								' . ($currency->format % 2 != 0 ? ' ' . $currency->sign : '') . ' <input size="11" maxlength="14" id="priceTI" type="text" value="" onchange="noComma(\'priceTI\');" onkeyup="if (isArrowKey(event)) return;  calcPriceTE();" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . '
							</td>
						</tr>';
        } else {
            echo '<input size="11" maxlength="14" id="priceTI" type="hidden" value="" onchange="noComma(\'priceTI\');" onkeyup="if (isArrowKey(event)) return;  calcPriceTE();" />';
        }
        echo '
					<tr id="tr_unit_price">
						<td class="col-left">' . $this->l('Unit price without tax:') . '</td>
						<td style="padding-bottom:5px;">
							' . ($currency->format % 2 != 0 ? ' ' . $currency->sign : '') . ' <input size="11" maxlength="14" id="unit_price" name="unit_price" type="text" value="' . ($this->getFieldValue($obj, 'unit_price_ratio') != 0 ? Tools::ps_round($this->getFieldValue($obj, 'price') / $this->getFieldValue($obj, 'unit_price_ratio'), 2) : 0) . '" onkeyup="if (isArrowKey(event)) return ;this.value = this.value.replace(/,/g, \'.\'); unitPriceWithTax(\'unit\');"/>' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . ' ' . $this->l('per') . ' <input size="6" maxlength="10" id="unity" name="unity" type="text" value="' . (Validate::isCleanHtml($this->getFieldValue($obj, 'unity')) ? htmlentities($this->getFieldValue($obj, 'unity'), ENT_QUOTES, 'UTF-8') : '') . '" onkeyup="if (isArrowKey(event)) return ;unitySecond();" onchange="unitySecond();"/>' . (Configuration::get('PS_TAX') && $default_country->display_tax_label ? '<span style="margin-left:15px">' . $this->l('or') . ' ' . ($currency->format % 2 != 0 ? ' ' . $currency->sign : '') . '<span id="unit_price_with_tax">0.00</span>' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . ' ' . $this->l('per') . ' <span id="unity_second">' . (Validate::isCleanHtml($this->getFieldValue($obj, 'unity')) ? htmlentities($this->getFieldValue($obj, 'unity'), ENT_QUOTES, 'UTF-8') : '') . '</span> ' . $this->l('with tax') : '') . '</span>
							<p>' . $this->l('Eg. $15 per Lb') . '</p>
						</td>
					</tr>
					<tr>
						<td class="col-left">&nbsp;</td>
						<td style="padding-bottom:5px;">
							<input type="checkbox" name="on_sale" id="on_sale" style="padding-top: 5px;" ' . ($this->getFieldValue($obj, 'on_sale') ? 'checked="checked"' : '') . 'value="1" />&nbsp;<label for="on_sale" class="t">' . $this->l('Display "on sale" icon on product page and text on product listing') . '</label>
						</td>
					</tr>
					<tr>
						<td class="col-left"><b>' . $this->l('Final retail price:') . '</b></td>
						<td style="padding-bottom:5px;">
							<span style="' . ($default_country->display_tax_label ? '' : 'display:none') . '">
							' . ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<span id="finalPrice" style="font-weight: bold;"></span>' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . '<span' . (!Configuration::get('PS_TAX') ? ' style="display:none;"' : '') . '> (' . $this->l('tax incl.') . ')</span>
							</span>
							<span' . (!Configuration::get('PS_TAX') ? ' style="display:none;"' : '') . '>';
        if ($default_country->display_tax_label) {
            echo ' / ';
        }
        echo ($currency->format % 2 != 0 ? $currency->sign . ' ' : '') . '<span id="finalPriceWithoutTax" style="font-weight: bold;"></span>' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '') . ' ' . ($default_country->display_tax_label ? '(' . $this->l('tax excl.') . ')' : '') . '</span>
						</td>
					</tr>
					<tr>
						<td class="col-left">&nbsp;</td>
						<td>
							<div class="hint clear" style="display: block;width: 70%;">' . $this->l('You can define many discounts and specific price rules in the Prices tab') . '</div>
						</td>
					</tr>
					<tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>';
        if ((int) Configuration::get('PS_STOCK_MANAGEMENT')) {
            if (!$has_attribute) {
                if ($obj->id) {
                    echo '
							<tr><td class="col-left">' . $this->l('Stock Movement:') . '</td>
								<td style="padding-bottom:5px;">
									<select id="id_mvt_reason" name="id_mvt_reason">
										<option value="-1">--</option>';
                    $reasons = StockMvtReason::getStockMvtReasons((int) $cookie->id_lang);
                    foreach ($reasons as $reason) {
                        echo '<option rel="' . $reason['sign'] . '" value="' . $reason['id_stock_mvt_reason'] . '" ' . (Configuration::get('PS_STOCK_MVT_REASON_DEFAULT') == $reason['id_stock_mvt_reason'] ? 'selected="selected"' : '') . '>' . $reason['name'] . '</option>';
                    }
                    echo '</select>
									<input id="mvt_quantity" type="text" name="mvt_quantity" size="3" maxlength="10" value="0"/>&nbsp;&nbsp;
									<span style="display:none;" id="mvt_sign"></span>
								</td>
							</tr>
							<tr>
								<td class="col-left">&nbsp;</td>
								<td>
									<div class="hint clear" style="display: block;width: 70%;">' . $this->l('Choose the reason and enter the quantity that you want to increase or decrease in your stock') . '</div>
								</td>
							</tr>';
                } else {
                    echo '<tr><td class="col-left">' . $this->l('Initial stock:') . '</td>
									<td style="padding-bottom:5px;">
										<input size="3" maxlength="10" name="quantity" type="text" value="0" />
									</td>';
                }
                echo '<tr>
								<td class="col-left">' . $this->l('Minimum quantity:') . '</td>
									<td style="padding-bottom:5px;">
										<input size="3" maxlength="10" name="minimal_quantity" id="minimal_quantity" type="text" value="' . ($this->getFieldValue($obj, 'minimal_quantity') ? $this->getFieldValue($obj, 'minimal_quantity') : 1) . '" />
										<p>' . $this->l('The minimum quantity to buy this product (set to 1 to disable this feature)') . '</p>
									</td>
								</tr>';
            }
            if ($obj->id) {
                echo '
							<tr><td class="col-left">' . $this->l('Quantity in stock:') . '</td>
								<td style="padding-bottom:5px;"><b>' . $qty . '</b><input type="hidden" name="quantity" value="' . $qty . '" /></td>
							</tr>
						';
            }
            if ($has_attribute) {
                echo '<tr>
								<td class="col-left">&nbsp;</td>
								<td>
									<div class="hint clear" style="display: block;width: 70%;">' . $this->l('You used combinations, for this reason you cannot edit your stock quantity here, but in the Combinations tab') . '</div>
								</td>
							</tr>';
            }
        } else {
            echo '<tr>
							<td colspan="2">' . $this->l('The stock management is disabled') . '</td>
						</tr>';
            echo '
						<tr>
							<td class="col-left">' . $this->l('Minimum quantity:') . '</td>
							<td style="padding-bottom:5px;">
								<input size="3" maxlength="10" name="minimal_quantity" id="minimal_quantity" type="text" value="' . ($this->getFieldValue($obj, 'minimal_quantity') ? $this->getFieldValue($obj, 'minimal_quantity') : 1) . '" />
								<p>' . $this->l('The minimum quantity to buy this product (set to 1 to disable this feature)') . '</p>
							</td>
						</tr>
					';
        }
        echo '
					<tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>
					<tr>
						<td class="col-left">' . $this->l('Additional shipping cost:') . '</td>
						<td style="padding-bottom:5px;">
							<input type="text" name="additional_shipping_cost" value="' . Tools::safeOutput($this->getFieldValue($obj, 'additional_shipping_cost')) . '" />' . ($currency->format % 2 == 0 ? ' ' . $currency->sign : '');
        if ($default_country->display_tax_label) {
            echo ' (' . $this->l('tax excl.') . ')';
        }
        echo '<p>' . $this->l('Carrier tax will be applied.') . '</p>
						</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Displayed text when in-stock:') . '</td>
						<td style="padding-bottom:5px;" class="translatable">';
        foreach ($this->_languages as $language) {
            echo '		<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
								<input size="30" type="text" id="available_now_' . $language['id_lang'] . '" name="available_now_' . $language['id_lang'] . '"
								value="' . stripslashes(htmlentities($this->getFieldValue($obj, 'available_now', $language['id_lang']), ENT_COMPAT, 'UTF-8')) . '" />
								<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
							</div>';
        }
        echo '			</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Displayed text when allowed to be back-ordered:') . '</td>
						<td style="padding-bottom:5px;" class="translatable">';
        foreach ($this->_languages as $language) {
            echo '		<div  class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
								<input size="30" type="text" id="available_later_' . $language['id_lang'] . '" name="available_later_' . $language['id_lang'] . '"
								value="' . stripslashes(htmlentities($this->getFieldValue($obj, 'available_later', $language['id_lang']), ENT_COMPAT, 'UTF-8')) . '" />
								<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
							</div>';
        }
        echo '	</td>
					</tr>

					<script type="text/javascript">
						calcPriceTI();
					</script>

					<tr>
						<td class="col-left">' . $this->l('When out of stock:') . '</td>
						<td style="padding-bottom:5px;">
							<input type="radio" name="out_of_stock" id="out_of_stock_1" value="0" ' . ((int) $this->getFieldValue($obj, 'out_of_stock') == 0 ? 'checked="checked"' : '') . '/> <label for="out_of_stock_1" class="t" id="label_out_of_stock_1">' . $this->l('Deny orders') . '</label>
							<br /><input type="radio" name="out_of_stock" id="out_of_stock_2" value="1" ' . ($this->getFieldValue($obj, 'out_of_stock') == 1 ? 'checked="checked"' : '') . '/> <label for="out_of_stock_2" class="t" id="label_out_of_stock_2">' . $this->l('Allow orders') . '</label>
							<br /><input type="radio" name="out_of_stock" id="out_of_stock_3" value="2" ' . ($this->getFieldValue($obj, 'out_of_stock') == 2 ? 'checked="checked"' : '') . '/> <label for="out_of_stock_3" class="t" id="label_out_of_stock_3">' . $this->l('Default:') . ' <i>' . $this->l((int) Configuration::get('PS_ORDER_OUT_OF_STOCK') ? 'Allow orders' : 'Deny orders') . '</i> (' . $this->l('as set in') . ' <a href="index.php?tab=AdminPPreferences&token=' . Tools::getAdminToken('AdminPPreferences' . (int) Tab::getIdFromClassName('AdminPPreferences') . (int) $cookie->id_employee) . '"  onclick="return confirm(\'' . $this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false) . '\');">' . $this->l('Preferences') . '</a>)</label>
						</td>
					</tr>
					<tr>
						<td colspan="2" style="padding-bottom:5px;">
							<hr style="width:100%;" />
						</td>
					</tr>
					<tr>
						<td class="col-left"><label for="id_category_default" class="t">' . $this->l('Default category:') . '</label></td>
						<td>
						<div id="no_default_category" style="color: red;font-weight: bold;display: none;">' . $this->l('Please check a category in order to select the default category.') . '</div>
						<script type="text/javascript">
							var post_selected_cat;
						</script>';
        $default_category = Tools::getValue('id_category', 1);
        if (!$obj->id) {
            $selectedCat = Category::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->_defaultFormLanguage);
            echo '
							<script type="text/javascript">
								post_selected_cat = \'' . implode(',', array_keys($selectedCat)) . '\';
							</script>';
        } else {
            if (Tools::isSubmit('categoryBox')) {
                $selectedCat = Category::getCategoryInformations(Tools::getValue('categoryBox', array($default_category)), $this->_defaultFormLanguage);
            } else {
                $selectedCat = Product::getProductCategoriesFull($obj->id, $this->_defaultFormLanguage);
            }
        }
        echo '<select id="id_category_default" name="id_category_default">';
        foreach ($selectedCat as $cat) {
            echo '<option value="' . $cat['id_category'] . '" ' . ($obj->id_category_default == $cat['id_category'] ? 'selected' : '') . '>' . $cat['name'] . '</option>';
        }
        echo '</select>
						</td>
					</tr>
					<tr id="tr_categories">
						<td colspan="2">
						';
        // Translations are not automatic for the moment ;)
        $trads = array('Home' => $this->l('Home'), 'selected' => $this->l('selected'), 'Collapse All' => $this->l('Collapse All'), 'Expand All' => $this->l('Expand All'), 'Check All' => $this->l('Check All'), 'Uncheck All' => $this->l('Uncheck All'));
        echo Helper::renderAdminCategorieTree($trads, $selectedCat) . '
						</td>
					</tr>
					<tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>
					<tr><td colspan="2">
						<span onclick="$(\'#seo\').slideToggle();" style="cursor: pointer"><img src="../img/admin/arrow.gif" alt="' . $this->l('SEO') . '" title="' . $this->l('SEO') . '" style="float:left; margin-right:5px;"/>' . $this->l('Click here to improve product\'s rank in search engines (SEO)') . '</span><br />
						<div id="seo" style="display: none; padding-top: 15px;">
							<table>
								<tr>
									<td class="col-left">' . $this->l('Meta title:') . '</td>
									<td class="translatable">';
        foreach ($this->_languages as $language) {
            echo '					<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
											<input size="55" type="text" id="meta_title_' . $language['id_lang'] . '" name="meta_title_' . $language['id_lang'] . '"
											value="' . htmlentities($this->getFieldValue($obj, 'meta_title', $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
											<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
										</div>';
        }
        echo '						<p class="clear">' . $this->l('Product page title; leave blank to use product name') . '</p>
									</td>
								</tr>
								<tr>
									<td class="col-left">' . $this->l('Meta description:') . '</td>
									<td class="translatable">';
        foreach ($this->_languages as $language) {
            echo '					<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
											<input size="55" type="text" id="meta_description_' . $language['id_lang'] . '" name="meta_description_' . $language['id_lang'] . '"
											value="' . htmlentities($this->getFieldValue($obj, 'meta_description', $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
											<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
										</div>';
        }
        echo '						<p class="clear">' . $this->l('A single sentence for HTML header') . '</p>
									</td>
								</tr>
								<tr>
									<td class="col-left">' . $this->l('Meta keywords:') . '</td>
									<td class="translatable">';
        foreach ($this->_languages as $language) {
            echo '					<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
											<input size="55" type="text" id="meta_keywords_' . $language['id_lang'] . '" name="meta_keywords_' . $language['id_lang'] . '"
											value="' . htmlentities($this->getFieldValue($obj, 'meta_keywords', $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
											<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
										</div>';
        }
        echo '						<p class="clear">' . $this->l('Keywords for HTML header, separated by a comma') . '</p>
									</td>
								</tr>
								<tr>
									<td class="col-left">' . $this->l('Friendly URL:') . '</td>
									<td class="translatable">';
        foreach ($this->_languages as $language) {
            echo '					<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
											<input size="55" type="text" id="link_rewrite_' . $language['id_lang'] . '" name="link_rewrite_' . $language['id_lang'] . '"
											value="' . htmlentities($this->getFieldValue($obj, 'link_rewrite', $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" onkeyup="if (isArrowKey(event)) return ;updateFriendlyURL();" onchange="updateFriendlyURL();" /><sup> *</sup>
											<span class="hint" name="help_box">' . $this->l('Only letters and the "less" character are allowed') . '<span class="hint-pointer">&nbsp;</span></span>
										</div>';
        }
        echo '						<p class="clear" style="padding:10px 0 0 0">' . '<a style="cursor:pointer" class="button" onmousedown="updateFriendlyURLByName();">' . $this->l('Generate') . '</a>&nbsp;' . $this->l('Friendly-url from product\'s name.') . '<br /><br />';
        echo '						' . $this->l('Product link will look like this:') . ' ' . (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . '/<b>id_product</b>-<span id="friendly-url"></span>.html</p>
									</td>
								</tr>';
        echo '</td></tr></table>
						</div>
					</td></tr>
					<tr><td colspan="2" style="padding-bottom:5px;"><hr style="width:100%;" /></td></tr>
					<tr>
						<td class="col-left">' . $this->l('Short description:') . '<br /><br /><i>(' . $this->l('appears in the product lists and on the top of the product page') . ')</i></td>
						<td style="padding-bottom:5px;" class="translatable">';
        foreach ($this->_languages as $language) {
            echo '		<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . ';float: left;">
								<textarea class="rte" cols="100" rows="10" id="description_short_' . $language['id_lang'] . '" name="description_short_' . $language['id_lang'] . '">' . htmlentities(stripslashes($this->getFieldValue($obj, 'description_short', $language['id_lang'])), ENT_COMPAT, 'UTF-8') . '</textarea>
							</div>';
        }
        echo '		</td>
					</tr>
					<tr>
						<td class="col-left">' . $this->l('Description:') . '<br /><br /><i>(' . $this->l('appears in the body of the product page') . ')</i></td>
						<td style="padding-bottom:5px;" class="translatable">';
        foreach ($this->_languages as $language) {
            echo '		<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . ';float: left;">
								<textarea class="rte" cols="100" rows="20" id="description_' . $language['id_lang'] . '" name="description_' . $language['id_lang'] . '">' . htmlentities(stripslashes($this->getFieldValue($obj, 'description', $language['id_lang'])), ENT_COMPAT, 'UTF-8') . '</textarea>
							</div>';
        }
        echo '		</td>
					</tr>';
        echo '
					<tr>
						<td class="col-left">' . $this->l('Tags:') . '</td>
						<td style="padding-bottom:5px;" class="translatable">';
        if ($obj->id) {
            $obj->tags = Tag::getProductTags((int) $obj->id);
        }
        foreach ($this->_languages as $language) {
            echo '<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
							<input size="55" type="text" id="tags_' . $language['id_lang'] . '" name="tags_' . $language['id_lang'] . '"
							value="' . htmlentities(Tools::getValue('tags_' . $language['id_lang'], $obj->getTags($language['id_lang'], true)), ENT_COMPAT, 'UTF-8') . '" />
							<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' !<>;?=+#"&deg;{}_$%<span class="hint-pointer">&nbsp;</span></span>
						  </div>';
        }
        echo '	<p class="clear">' . $this->l('Tags separated by commas (e.g., dvd, dvd player, hifi)') . '</p>
						</td>
					</tr>';
        $accessories = Product::getAccessoriesLight((int) $cookie->id_lang, $obj->id);
        if ($postAccessories = Tools::getValue('inputAccessories')) {
            $postAccessoriesTab = explode('-', Tools::getValue('inputAccessories'));
            foreach ($postAccessoriesTab as $accessoryId) {
                if (!$this->haveThisAccessory($accessoryId, $accessories) and $accessory = Product::getAccessoryById($accessoryId)) {
                    $accessories[] = $accessory;
                }
            }
        }
        echo '
					<tr>
						<td class="col-left">' . $this->l('Accessories:') . '<br /><br /><i>' . $this->l('(Do not forget to Save the product afterward)') . '</i></td>
						<td style="padding-bottom:5px;">
							<div id="divAccessories">';
        foreach ($accessories as $accessory) {
            echo htmlentities($accessory['name'], ENT_COMPAT, 'UTF-8') . (!empty($accessory['reference']) ? ' (' . $accessory['reference'] . ')' : '') . ' <span onclick="delAccessory(' . $accessory['id_product'] . ');" style="cursor: pointer;"><img src="../img/admin/delete.gif" class="middle" alt="" /></span><br />';
        }
        echo '</div>
							<input type="hidden" name="inputAccessories" id="inputAccessories" value="';
        foreach ($accessories as $accessory) {
            echo (int) $accessory['id_product'] . '-';
        }
        echo '" />
							<input type="hidden" name="nameAccessories" id="nameAccessories" value="';
        foreach ($accessories as $accessory) {
            echo htmlentities($accessory['name'], ENT_COMPAT, 'UTF-8') . '¤';
        }
        echo '" />
							<script type="text/javascript">
								var formProduct;
								var accessories = new Array();
							</script>

							<link rel="stylesheet" type="text/css" href="' . __PS_BASE_URI__ . 'css/jquery.autocomplete.css" />
							<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/jquery/jquery.autocomplete.js"></script>
							<div id="ajax_choose_product" style="padding:6px; padding-top:2px; width:600px;">
								<p class="clear">' . $this->l('Begin typing the first letters of the product name, then select the product from the drop-down list:') . '</p>
								<input type="text" value="" id="product_autocomplete_input" />
								<img onclick="$(this).prev().search();" style="cursor: pointer;" src="../img/admin/add.gif" alt="' . $this->l('Add an accessory') . '" title="' . $this->l('Add an accessory') . '" />
							</div>
							<script type="text/javascript">
								urlToCall = null;
								/* function autocomplete */
								$(function() {
									$(\'#product_autocomplete_input\')
										.autocomplete(\'ajax_products_list.php\', {
											minChars: 1,
											autoFill: true,
											max:20,
											matchContains: true,
											mustMatch:true,
											scroll:false,
											cacheLength:0,
											formatItem: function(item) {
												return item[1]+\' - \'+item[0];
											}
										}).result(addAccessory);
									$(\'#product_autocomplete_input\').setOptions({
										extraParams: {excludeIds : getAccessorieIds()}
									});
								});
							</script>
						</td>
					</tr>
					<tr><td colspan="2" style="padding-bottom:10px;"><hr style="width:100%;" /></td></tr>
					<tr>
						<td colspan="2" style="text-align:center;">
							<input type="submit" value="' . $this->l('Save') . '" name="submitAdd' . $this->table . '" class="button" />
							&nbsp;<input type="submit" value="' . $this->l('Save and stay') . '" name="submitAdd' . $this->table . 'AndStay" class="button" /></td>
					</tr>
				</table>
			<br />
			</div>';
        // TinyMCE
        global $cookie;
        $iso = Language::getIsoById((int) $cookie->id_lang);
        $isoTinyMCE = file_exists(_PS_ROOT_DIR_ . '/js/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en';
        $ad = dirname($_SERVER["PHP_SELF"]);
        echo '
			<script type="text/javascript">
			var iso = \'' . $isoTinyMCE . '\' ;
			var pathCSS = \'' . _THEME_CSS_DIR_ . '\' ;
			var ad = \'' . $ad . '\' ;
			</script>
			<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/tiny_mce/tiny_mce.js"></script>
			<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/tinymce.inc.js"></script>
			<script type="text/javascript">
					toggleVirtualProduct(getE(\'is_virtual_good\'));
					unitPriceWithTax(\'unit\');
			</script>';
        $categoryBox = Tools::getValue('categoryBox', array());
    }
    public function displayForm($isMainTab = true)
    {
        global $currentIndex, $cookie;
        parent::displayForm();
        if (!($obj = $this->loadObject(true))) {
            return;
        }
        $langtags = 'name';
        $active = $this->getFieldValue($obj, 'active');
        echo '
		<script type="text/javascript">';
        echo 'startingData = new Array();' . "\n";
        foreach ($obj->getProducts() as $key => $product) {
            $productObj = new Product(intval($product['id_product']), true, intval($cookie->id_lang));
            echo 'startingData[' . $key . '] = new Array(\'' . pSQL($productObj->name) . '\', ' . intval($product['id_product']) . ', ' . $product['x_axis'] . ', ' . $product['y_axis'] . ', ' . $product['zone_width'] . ', ' . $product['zone_height'] . ', \'' . (isset($product['color_reference']) ? pSQL($product['color_reference']) : '') . '\');';
        }
        echo '</script>
		<form id="scenesForm" action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" method="post" enctype="multipart/form-data">
		' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . '
			<fieldset><legend><img src="../img/admin/photo.gif" />' . $this->l('Image Maps') . '</legend>';
        echo '
			<label>' . $this->l('How to map products in the image:') . ' </label>
			<div class="margin-form">
				' . $this->l('When a customer hovers over the image with the mouse, a pop-up appears displaying a brief description of the product. The customer can then click to open the product\'s full product page. To achieve this, please define the \'mapping zone\' that, when hovered over, will display the pop-up. Left-click with your mouse to draw the four-sided mapping zone, then release. Then, begin typing the name of the associated product. A list of products appears. Click the appropriate product, then click OK. Repeat these steps for each mapping zone you wish to create. When you have finished mapping zones, click Save Image Map.') . '
			</div>
			';
        echo '<label>' . $this->l('Image map name:') . ' </label>
				<div class="margin-form">';
        foreach ($this->_languages as $language) {
            echo '
					<div id="name_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
						<input type="text" style="width: 260px" name="name_' . $language['id_lang'] . '" id="name_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'name', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" /><sup> *</sup>
					</div>';
        }
        $this->displayFlags($this->_languages, $this->_defaultFormLanguage, $langtags, 'name');
        echo '		<div class="clear"></div>
				</div>';
        echo '<label>' . $this->l('Status:') . ' </label>
				<div class="margin-form">
					<input type="radio" name="active" id="active_on" value="1" ' . ((!$obj->id or Tools::getValue('active', $obj->active)) ? 'checked="checked" ' : '') . '/>
					<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Activated') . '" title="' . $this->l('Activated') . '" /></label>
					<input type="radio" name="active" id="active_off" value="0" ' . ((!Tools::getValue('active', $obj->active) and $obj->id) ? 'checked="checked" ' : '') . '/>
					<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('Deactivated') . '" title="' . $this->l('Deactivated') . '" /></label>
					<p>' . $this->l('Activate or deactivate the image map') . '</p>
				</div>';
        $sceneImageTypes = ImageType::getImagesTypes('scenes');
        $largeSceneImageType = NULL;
        $thumbSceneImageType = NULL;
        foreach ($sceneImageTypes as $sceneImageType) {
            if ($sceneImageType['name'] == 'large_scene') {
                $largeSceneImageType = $sceneImageType;
            }
            if ($sceneImageType['name'] == 'thumb_scene') {
                $thumbSceneImageType = $sceneImageType;
            }
        }
        echo '<label>' . $this->l('Image to be mapped:') . ' </label>
				<div class="margin-form">
					<input type="hidden" id="stay_here" name="stay_here" value="" />
					<input type="file" name="image" id="image_input" /> <input type="button" value="' . $this->l('Upload image') . '" onclick="{$(\'#stay_here\').val(\'true\');$(\'#scenesForm\').submit();}" class="button" /><br/>
					<p>' . $this->l('Format:') . ' JPG, GIF, PNG. ' . $this->l('File size:') . ' ' . $this->maxImageSize / 1000 . '' . $this->l('KB max.') . ' ' . $this->l('If larger than the image size setting, the image will be reduced to ') . ' ' . $largeSceneImageType['width'] . 'x' . $largeSceneImageType['height'] . 'px ' . $this->l('(width x height). If smaller than the image-size setting, a white background will be added in order to achieve the correct image size.') . '.<br />' . $this->l('Note: To change image dimensions, please change the \'large_scene\' image type settings to the desired size (in Back Office > Preferences > Images).') . '</p>';
        if ($obj->id && file_exists(_PS_SCENE_IMG_DIR_ . $obj->id . '-large_scene.jpg')) {
            echo '<img id="large_scene_image" style="clear:both;border:1px solid black;" alt="" src="' . _THEME_SCENE_DIR_ . $obj->id . '-large_scene.jpg" /><br />';
            echo '
						<div id="ajax_choose_product" style="display:none; padding:6px; padding-top:2px; width:600px;">
							' . $this->l('Begin typing the first letters of the product name, then select the product from the drop-down list:') . '<br /><input type="text" value="" id="product_autocomplete_input" style="width: 450px"/> <input type="button" class="button" value="' . $this->l('OK') . '" onclick="$(this).prev().search();"/><input type="button" class="button" value="' . $this->l('Delete') . '" onclick="undoEdit();" />
						</div>
				';
            echo '
						<link rel="stylesheet" type="text/css" href="' . __PS_BASE_URI__ . 'css/jquery.autocomplete.css" />
						<link rel="stylesheet" type="text/css" href="' . __PS_BASE_URI__ . 'js/jquery/imgareaselect/imgareaselect-default.css" />
						<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/jquery/jquery.autocomplete.js"></script>
						<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/jquery/imgareaselect/jquery.imgareaselect.pack.js"></script>
						<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/admin-scene-cropping.js"></script>
			';
            echo '</div>';
            echo '<label>' . $this->l('Alternative thumbnail:') . ' </label>
					<div class="margin-form">
						<input type="file" name="thumb" id="thumb_input" />&nbsp;&nbsp;' . $this->l('(optional)') . '
						<p>' . $this->l('If you want to use a thumbnail other than one generated from simply reducing the mapped image, please upload it here.') . '<br />' . $this->l('Format:') . ' JPG, GIF, PNG. ' . $this->l('Filesize:') . ' ' . $this->maxImageSize / 1000 . '' . $this->l('Kb max.') . ' ' . $this->l('Automatically resized to') . ' ' . $thumbSceneImageType['width'] . 'x' . $thumbSceneImageType['height'] . 'px ' . $this->l('(width x height)') . '.<br />' . $this->l('Note: To change image dimensions, please change the \'thumb_scene\' image type settings to the desired size (in Back Office > Preferences > Images).') . '</p>
						';
            if ($obj->id && file_exists(_PS_SCENE_IMG_DIR_ . 'thumbs/' . $obj->id . '-thumb_scene.jpg')) {
                echo '<img id="large_scene_image" style="clear:both;border:1px solid black;" alt="" src="' . _THEME_SCENE_DIR_ . 'thumbs/' . $obj->id . '-thumb_scene.jpg" /><br />';
            }
            echo '</div>
				 ';
            $selectedCat = array();
            if (Tools::isSubmit('categories')) {
                foreach (Tools::getValue('categories') as $k => $row) {
                    $selectedCat[] = $row;
                }
            } elseif ($obj->id) {
                foreach (Scene::getIndexedCategories($obj->id) as $k => $row) {
                    $selectedCat[] = $row['id_category'];
                }
            }
            $trads = array('Home' => $this->l('Home'), 'selected' => $this->l('selected'), 'Collapse All' => $this->l('Collapse All'), 'Expand All' => $this->l('Expand All'), 'Check All' => $this->l('Check All'), 'Uncheck All' => $this->l('Uncheck All'));
            echo '
				<label>' . $this->l('Categories:') . '</label>
				<div class="margin-form">
			';
            echo Helper::renderAdminCategorieTree($trads, $selectedCat, 'categories');
            echo '
				</div>
				<div id="save_scene" class="margin-form">
					<input type="submit" name="save_image_map" value="' . $this->l('Save Image Map(s)') . '" class="button" />
				</div>
			';
        } else {
            echo '
					<br/><span class="bold">' . $this->l('Please add a picture to continue mapping the image...') . '</span><br/><br/>';
        }
        echo '
		<div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div>
			</fieldset>
		</form>
		';
    }
Exemple #3
0
    public function getContent()
    {
        global $cookie;
        $html = '';
        if (Tools::isSubmit('SubmitFilter')) {
            if (!Tools::getValue('layered_tpl_name')) {
                $html .= '
				<div class="error">
					<span style="float:right">
						<a href="" id="hideError"><img src="../img/admin/close.png" alt="X"></a>
					</span>
					<img src="../img/admin/error2.png">' . $this->l('Filter template name required (cannot be empty)') . '
				</div>';
            } else {
                if (isset($_POST['id_layered_filter']) && $_POST['id_layered_filter']) {
                    Db::getInstance()->Execute('DELETE FROM ' . _DB_PREFIX_ . 'layered_filter WHERE id_layered_filter = ' . (int) Tools::getValue('id_layered_filter'));
                }
                if (Tools::getValue('scope') == 1) {
                    Db::getInstance()->Execute('TRUNCATE TABLE ' . _DB_PREFIX_ . 'layered_filter');
                    $categories = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT id_category FROM ' . _DB_PREFIX_ . 'category');
                    foreach ($categories as $category) {
                        $_POST['categoryBox'][] = (int) $category['id_category'];
                    }
                }
                if (version_compare(_PS_VERSION_, '1.5', '>')) {
                    $id_layered_filter = (int) $_POST['id_layered_filter'];
                    if (!$id_layered_filter) {
                        $id_layered_filter = (int) Db::getInstance()->Insert_ID();
                    }
                    $shop_list = array();
                    if (isset($_POST['checkBoxShopAsso_layered_filter'])) {
                        foreach ($_POST['checkBoxShopAsso_layered_filter'] as $id_asso_object => $row) {
                            foreach ($row as $id_shop => $value) {
                                $assos[] = array('id_object' => (int) $id_layered_filter, 'id_shop' => (int) $id_shop);
                                $shop_list[] = (int) $id_shop;
                            }
                        }
                    } else {
                        $shop_list = array(Context::getContext()->shop->getID(true));
                    }
                } else {
                    $shop_list = array(0);
                }
                if (count($_POST['categoryBox'])) {
                    /* Clean categoryBox before use */
                    if (isset($_POST['categoryBox']) && is_array($_POST['categoryBox'])) {
                        foreach ($_POST['categoryBox'] as &$categoryBoxTmp) {
                            $categoryBoxTmp = (int) $categoryBoxTmp;
                        }
                    }
                    Db::getInstance()->Execute('DELETE FROM ' . _DB_PREFIX_ . 'layered_category
						WHERE
							id_category IN (' . implode(',', array_map('intval', $_POST['categoryBox'])) . ')
							AND id_shop IN (' . implode(',', $shop_list) . ')');
                    $filterValues = array();
                    foreach ($_POST['categoryBox'] as $idc) {
                        $filterValues['categories'][] = (int) $idc;
                    }
                    $sqlToInsert = 'INSERT INTO ' . _DB_PREFIX_ . 'layered_category (id_category, id_shop, id_value, type, position, filter_show_limit, filter_type) VALUES ';
                    $values = false;
                    foreach ($_POST['categoryBox'] as $id_category_layered) {
                        $n = 0;
                        foreach ($_POST as $key => $value) {
                            if (substr($key, 0, 17) == 'layered_selection' && $value == 'on') {
                                $values = true;
                                $type = 0;
                                $limit = 0;
                                if (Tools::getValue($key . '_filter_type')) {
                                    $type = Tools::getValue($key . '_filter_type');
                                }
                                if (Tools::getValue($key . '_filter_show_limit')) {
                                    $limit = Tools::getValue($key . '_filter_show_limit');
                                }
                                $filterValues[$key] = array('filter_type' => (int) $type, 'filter_show_limit' => (int) $limit);
                                $n++;
                                foreach ($shop_list as $id_shop) {
                                    if ($key == 'layered_selection_stock') {
                                        $sqlToInsert .= '(' . (int) $id_category_layered . ', ' . (int) $id_shop . ', NULL,\'quantity\',' . (int) $n . ', ' . (int) $limit . ', ' . (int) $type . '),';
                                    } else {
                                        if ($key == 'layered_selection_subcategories') {
                                            $sqlToInsert .= '(' . (int) $id_category_layered . ', ' . (int) $id_shop . ', NULL,\'category\',' . (int) $n . ', ' . (int) $limit . ', ' . (int) $type . '),';
                                        } else {
                                            if ($key == 'layered_selection_condition') {
                                                $sqlToInsert .= '(' . (int) $id_category_layered . ', ' . (int) $id_shop . ', NULL,\'condition\',' . (int) $n . ', ' . (int) $limit . ', ' . (int) $type . '),';
                                            } else {
                                                if ($key == 'layered_selection_weight_slider') {
                                                    $sqlToInsert .= '(' . (int) $id_category_layered . ', ' . (int) $id_shop . ', NULL,\'weight\',' . (int) $n . ', ' . (int) $limit . ', ' . (int) $type . '),';
                                                } else {
                                                    if ($key == 'layered_selection_price_slider') {
                                                        $sqlToInsert .= '(' . (int) $id_category_layered . ', ' . (int) $id_shop . ', NULL,\'price\',' . (int) $n . ', ' . (int) $limit . ', ' . (int) $type . '),';
                                                    } else {
                                                        if ($key == 'layered_selection_manufacturer') {
                                                            $sqlToInsert .= '(' . (int) $id_category_layered . ', ' . (int) $id_shop . ', NULL,\'manufacturer\',' . (int) $n . ', ' . (int) $limit . ', ' . (int) $type . '),';
                                                        } else {
                                                            if (substr($key, 0, 21) == 'layered_selection_ag_') {
                                                                $sqlToInsert .= '(' . (int) $id_category_layered . ', ' . (int) $id_shop . ', ' . (int) str_replace('layered_selection_ag_', '', $key) . ',
											\'id_attribute_group\',' . (int) $n . ', ' . (int) $limit . ', ' . (int) $type . '),';
                                                            } else {
                                                                if (substr($key, 0, 23) == 'layered_selection_feat_') {
                                                                    $sqlToInsert .= '(' . (int) $id_category_layered . ', ' . (int) $id_shop . ', ' . (int) str_replace('layered_selection_feat_', '', $key) . ',
											\'id_feature\',' . (int) $n . ', ' . (int) $limit . ', ' . (int) $type . '),';
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if ($values) {
                        Db::getInstance()->Execute(rtrim($sqlToInsert, ','));
                    }
                    $valuesToInsert = array('name' => pSQL(Tools::getValue('layered_tpl_name')), 'filters' => pSQL(serialize($filterValues)), 'n_categories' => (int) count($filterValues['categories']), 'date_add' => date('Y-m-d H:i:s'));
                    if (isset($_POST['id_layered_filter']) && $_POST['id_layered_filter']) {
                        $valuesToInsert['id_layered_filter'] = (int) Tools::getValue('id_layered_filter');
                    }
                    Db::getInstance()->autoExecute(_DB_PREFIX_ . 'layered_filter', $valuesToInsert, 'INSERT');
                    if (version_compare(_PS_VERSION_, '1.5', '>')) {
                        Db::getInstance()->execute('DELETE FROM ' . _DB_PREFIX_ . 'layered_filter_shop WHERE `id_layered_filter` = ' . (int) $id_layered_filter);
                        if (isset($assos)) {
                            foreach ($assos as $asso) {
                                Db::getInstance()->execute('INSERT INTO layered_filter_shop (`id_layered_filter`, `id_shop`)
									VALUES(' . $id_layered_filter . ', ' . (int) $asso['id_shop'] . ')');
                            }
                        }
                    }
                    $html .= '<div class="conf">' . (version_compare(_PS_VERSION_, '1.5', '>') ? '' : '<img src="../img/admin/ok2.png" alt="" />') . $this->l('Your filter') . ' "' . Tools::safeOutput(Tools::getValue('layered_tpl_name')) . '" ' . (isset($_POST['id_layered_filter']) && $_POST['id_layered_filter'] ? $this->l('was updated successfully.') : $this->l('was added successfully.')) . '</div>';
                }
            }
        } else {
            if (Tools::isSubmit('submitLayeredSettings')) {
                Configuration::updateValue('PS_LAYERED_HIDE_0_VALUES', Tools::getValue('ps_layered_hide_0_values'));
                Configuration::updateValue('PS_LAYERED_SHOW_QTIES', Tools::getValue('ps_layered_show_qties'));
                Configuration::updateValue('PS_LAYERED_FULL_TREE', Tools::getValue('ps_layered_full_tree'));
                Configuration::updateValue('PS_LAYERED_FILTER_PRICE_USETAX', Tools::getValue('ps_layered_filter_price_usetax'));
                $html .= '
			<div class="conf">' . (version_compare(_PS_VERSION_, '1.5', '>') ? '' : '<img src="../img/admin/ok2.png" alt="" />') . $this->l('Settings saved successfully') . '
			</div>';
            } else {
                if (isset($_GET['deleteFilterTemplate'])) {
                    $layeredValues = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
			SELECT filters 
			FROM ' . _DB_PREFIX_ . 'layered_filter 
			WHERE id_layered_filter = ' . (int) $_GET['id_layered_filter']);
                    if ($layeredValues) {
                        Db::getInstance()->Execute('DELETE FROM ' . _DB_PREFIX_ . 'layered_filter WHERE id_layered_filter = ' . (int) $_GET['id_layered_filter'] . ' LIMIT 1');
                        $html .= '
				<div class="conf">' . (version_compare(_PS_VERSION_, '1.5', '>') ? '' : '<img src="../img/admin/ok2.png" alt="" />') . '
					' . $this->l('Filters template deleted, categories updated (reverted to default Filters template).') . '
				</div>';
                    } else {
                        $html .= '
				<div class="error">
					<img src="../img/admin/error.png" alt="" title="" /> ' . $this->l('Filters template not found') . '
				</div>';
                    }
                }
            }
        }
        $html .= '
		<div id="ajax-message-ok" class="conf ajax-message" style="display: none">
			' . (version_compare(_PS_VERSION_, '1.5', '>') ? '' : '<img src="../img/admin/ok2.png" alt="" />') . '<span class="message"></span>
		</div>
		<div id="ajax-message-ko" class="error ajax-message" style="display: none">
			' . (version_compare(_PS_VERSION_, '1.5', '>') ? '' : '<img src="../img/admin/errors.png" alt="" />') . '<span class="message"></span>
		</div>
		<h2>' . $this->l('Layered navigation') . '</h2>
		<fieldset class="width4">
			<legend><img src="../img/admin/cog.gif" alt="" />' . $this->l('Indexes and caches') . '</legend>
			<span id="indexing-warning" style="display: none; color:red; font-weight: bold">' . $this->l('Indexing are in progress. Please don\'t leave this page') . '<br/><br/></span>';
        if (version_compare(_PS_VERSION_, '1.5', '<') && !Configuration::get('PS_LAYERED_INDEXED') || version_compare(_PS_VERSION_, '1.5', '>') && !Configuration::getGlobalValue('PS_LAYERED_INDEXED')) {
            $html .= '
			<script type="text/javascript">
			$(document).ready(function() {
				$(\'#url-indexer\').click();
				$(\'#full-index\').click();
			});
			</script>';
        }
        $categoryList = array();
        foreach (Db::getInstance()->ExecuteS('SELECT id_category FROM `' . _DB_PREFIX_ . 'category`') as $category) {
            if ($category['id_category'] != 1) {
                $categoryList[] = $category['id_category'];
            }
        }
        if (Tools::usingSecureMode()) {
            $domain = Tools::getShopDomainSsl(true);
        } else {
            $domain = Tools::getShopDomain(true);
        }
        $html .= '
			<a class="bold ajaxcall-recurcive"
			style="width: 250px; text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px"
			href="' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-price-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '">' . $this->l('Index all missing prices') . '</a>
			<br />
			<a class="bold ajaxcall-recurcive"
			style="width: 250px; text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px" id="full-index"
			href="' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-price-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&full=1">' . $this->l('Re-build entire price index') . '</a>
			<br />
			<a class="bold ajaxcall" id="attribute-indexer"
			style="width: 250px; text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px" id="full-index"
			href="' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-attribute-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '">' . $this->l('Build attribute index') . '</a>
			<br />
			<a class="bold ajaxcall" id="url-indexer"
			style="width: 250px; text-align:center;display:block;border:1px solid #aaa;text-decoration:none;background-color:#fafafa;color:#123456;margin:2px;padding:2px" id="full-index"
			href="' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-url-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&truncate=1">' . $this->l('Build url index') . '</a>
			<br />
			<br />
			' . $this->l('You can set a cron job that will re-build price index using the following URL:') . '<br /><b>' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-price-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&full=1</b>
			<br />
			' . $this->l('You can set a cron job that will re-build url index using the following URL:') . '<br /><b>' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-url-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&truncate=1</b>
			<br />
			' . $this->l('You can set a cron job that will re-build attribute index using the following URL:') . '<br /><b>' . $domain . __PS_BASE_URI__ . 'modules/blocklayered/blocklayered-attribute-indexer.php' . '?token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '</b>
			<br /><br />
			' . $this->l('A nightly rebuild is recommended.') . '
			<script type="text/javascript">
				$(\'.ajaxcall\').click(function() {
					if (this.legend == undefined)
						this.legend = $(this).html();
						
					if (this.running == undefined)
						this.running = false;
					
					if (this.running == true)
						return false;
					
					$(\'.ajax-message\').hide();
					
					this.running = true;
					
					if (typeof(this.restartAllowed) == \'undefined\' || this.restartAllowed)
					{
						$(this).html(this.legend+\' ' . addslashes($this->l('(in progress)')) . '\');
						$(\'#indexing-warning\').show();
					}
						
					this.restartAllowed = false;
					
					$.ajax({
						url: this.href+\'&ajax=1\',
						context: this,
						dataType: \'json\',
						cache: \'false\',
						success: function(res)
						{
							this.running = false;
							this.restartAllowed = true;
							$(\'#indexing-warning\').hide();
							$(this).html(this.legend);
							$(\'#ajax-message-ok span\').html(\'' . addslashes($this->l('Url indexation finished')) . '\');
							$(\'#ajax-message-ok\').show();
							return;
						},
						error: function(res)
						{
							this.restartAllowed = true;
							$(\'#indexing-warning\').hide();
							$(\'#ajax-message-ko span\').html(\'' . addslashes($this->l('Url indexation failed')) . '\');
							$(\'#ajax-message-ko\').show();
							$(this).html(this.legend);
							
							this.running = false;
						}
					});
					return false;
				});
				$(\'.ajaxcall-recurcive\').each(function(it, elm) {
					$(elm).click(function() {
						if (this.cursor == undefined)
							this.cursor = 0;
						
						if (this.legend == undefined)
							this.legend = $(this).html();
							
						if (this.running == undefined)
							this.running = false;
						
						if (this.running == true)
							return false;
						
						$(\'.ajax-message\').hide();
						
						this.running = true;
						
						if (typeof(this.restartAllowed) == \'undefined\' || this.restartAllowed)
						{
							$(this).html(this.legend+\' ' . addslashes($this->l('(in progress)')) . '\');
							$(\'#indexing-warning\').show();
						}
							
						this.restartAllowed = false;
						
						$.ajax({
							url: this.href+\'&ajax=1&cursor=\'+this.cursor,
							context: this,
							dataType: \'json\',
							cache: \'false\',
							success: function(res)
							{
								this.running = false;
								if (res.result)
								{
									this.cursor = 0;
									$(\'#indexing-warning\').hide();
									$(this).html(this.legend);
									$(\'#ajax-message-ok span\').html(\'' . addslashes($this->l('Price indexation finished')) . '\');
									$(\'#ajax-message-ok\').show();
									return;
								}
								this.cursor = parseInt(res.cursor);
								$(this).html(this.legend+\' ' . addslashes($this->l('(in progress, %s products price to index)')) . '\'.replace(\'%s\', res.count));
								$(this).click();
							},
							error: function(res)
							{
								this.restartAllowed = true;
								$(\'#indexing-warning\').hide();
								$(\'#ajax-message-ko span\').html(\'' . addslashes($this->l('Price indexation failed')) . '\');
								$(\'#ajax-message-ko\').show();
								$(this).html(this.legend);
								
								this.cursor = 0;
								this.running = false;
							}
						});
						return false;
					});
				});
			</script>
		</fieldset>
		<br />
		<fieldset class="width4">
			<legend><img src="../img/admin/cog.gif" alt="" />' . $this->l('Existing filters templates') . '</legend>';
        $filtersTemplates = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT * FROM ' . _DB_PREFIX_ . 'layered_filter ORDER BY date_add DESC');
        if (count($filtersTemplates)) {
            $html .= '<p>' . count($filtersTemplates) . ' ' . $this->l('filters templates are configured:') . '</p>
			<table id="table-filter-templates" class="table" style="width: 700px;">
				<tr>
					<th>' . $this->l('ID') . '</th>
					<th>' . $this->l('Name') . '</th>
					<th>' . $this->l('Categories') . '</th>
					<th>' . $this->l('Created on') . '</th>
					<th>' . $this->l('Actions') . '</th>
				</tr>';
            foreach ($filtersTemplates as $filtersTemplate) {
                /* Clean request URI first */
                $_SERVER['REQUEST_URI'] = preg_replace('/&deleteFilterTemplate=[0-9]*&id_layered_filter=[0-9]*/', '', $_SERVER['REQUEST_URI']);
                $html .= '
				<tr>
					<td>' . (int) $filtersTemplate['id_layered_filter'] . '</td>
					<td style="text-align: left; padding-left: 10px; width: 270px;">' . $filtersTemplate['name'] . '</td>
					<td style="text-align: center;">' . (int) $filtersTemplate['n_categories'] . '</td>
					<td>' . Tools::displayDate($filtersTemplate['date_add'], (int) $cookie->id_lang, true) . '</td>
					<td>
						<a href="#" onclick="return updElements(' . ($filtersTemplate['n_categories'] ? 0 : 1) . ', ' . (int) $filtersTemplate['id_layered_filter'] . ');">
						<img src="../img/admin/edit.gif" alt="" title="' . $this->l('Edit') . '" /></a> 
						<a href="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '&deleteFilterTemplate=1&id_layered_filter=' . (int) $filtersTemplate['id_layered_filter'] . '"
						onclick="return confirm(\'' . addslashes($this->l('Delete filter template #')) . (int) $filtersTemplate['id_layered_filter'] . $this->l('?') . '\');">
						<img src="../img/admin/delete.gif" alt="" title="' . $this->l('Delete') . '" /></a>
					</td>
				</tr>';
            }
            $html .= '
			</table>';
        } else {
            $html .= $this->l('No filter template found.');
        }
        $html .= '
		</fieldset><br />
		<fieldset class="width4">
			<legend><img src="../img/admin/cog.gif" alt="" />' . $this->l('Build your own filters template') . '</legend>
			<link rel="stylesheet" href="' . _PS_CSS_DIR_ . 'jquery-ui-1.8.10.custom.css" />
			<style type="text/css">
				#error-filter-name { display: none; }
				#layered_container_left ul, #layered_container_right ul { list-style-type: none; padding-left: 0px; }
				.ui-effects-transfer { border: 1px solid #CCC; }
				.ui-state-highlight { height: 1.5em; line-height: 1.2em; }
				ul#selected_filters, #layered_container_right ul { list-style-type: none; margin: 0; padding: 0; }
				ul#selected_filters li, #layered_container_right ul li { width: 326px; font-size: 11px; padding: 8px 9px 7px 20px; height: 14px; margin-bottom: 5px; }
				ul#selected_filters li span.ui-icon { position: absolute; margin-top: -2px; margin-left: -18px; }
				#layered_container_right ul li span { display: none; }
				#layered_container_right ul li { padding-left: 8px; position: relative; }
				#layered_container_left ul li { cursor: move; position: relative; }
				#layered-cat-counter { display: none; }
				#layered-step-2, #layered-step-3 { display: none; }
				#layered-step-2 h3 { margin-top: 0; }
				#table-filter-templates tr th, #table-filter-templates tr td { text-align: center; }
				.filter_type { width: 70px; position: absolute; right: 53px; top: 5px;}
				.filter_show_limit { position: absolute; width: 40px; right: 5px; top: 5px; }
				#layered-step-3 .alert { width: auto; }
				#fancybox-content {
					height: 400px !important;
					overflow: auto !important;
				}
			</style>
			<form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post" onsubmit="return checkForm();">';
        $html .= '
			<h2>' . $this->l('Step 1/3 - Select categories') . '</h2>
			<p style="margin-top: 20px;">
				<span style="color: #585A69;display: block;float: left;font-weight: bold;text-align: right;width: 200px;" >' . $this->l('Use this template for:') . '</span>
				<input type="radio" id="scope_1" name="scope" value="1" style="margin-left: 15px;" onclick="$(\'#error-treeview\').hide(); $(\'#layered-step-2\').show(); updElements(1, 0);" /> 
				<label for="scope_1" style="float: none;">' . $this->l('All categories') . '</label>
				<input type="radio" id="scope_2" name="scope" value="2" style="margin-left: 15px;" onclick="$(\'label a#inline\').click(); $(\'#layered-step-2\').show();" /> 
				<label for="scope_2" style="float: none;"><a id="inline" href="#layered-categories-selection" style="text-decoration: underline;">' . $this->l('Specific') . '</a>
				' . $this->l('categories') . ' (<span id="layered-cat-counter"></span> ' . $this->l('selected') . ')</label>
			</p>';
        if (version_compare(_PS_VERSION_, '1.5', '>')) {
            $helper = new Helper();
            $helper->id = null;
            $helper->table = 'layered_filter';
            $helper->identifier = 'id_layered_filter';
            if (Shop::isFeatureActive()) {
                $html .= '<span style="color: #585A69;display: block;float: left;font-weight: bold;text-align: right;width: 200px;" >' . $this->l('Choose shop association:') . '</span>';
                $html .= '<div id="shop_association" style="width: 300px;margin-left: 215px;">' . $helper->renderAssoShop() . '</div>';
            }
        }
        $html .= '
			<div id="error-treeview" class="error" style="display: none;">
				<img src="../img/admin/error2.png" alt="" /> ' . $this->l('Please select at least one specific category or select "All categories".') . '
			</div>
			<div style="display: none;">
				<div id="layered-categories-selection" style="padding: 10px; text-align: left;">
					<h2>' . $this->l('Categories using this template') . '</h2>
					<ol style="padding-left: 20px;">
						<li>' . $this->l('Select one ore more category using this filter template') . '</li>
						<li>' . $this->l('Press "Save this selection" or close the window to save') . '</li>
					</ol>';
        $selectedCat = array();
        // Translations are not automatic for the moment ;)
        if (version_compare(_PS_VERSION_, '1.5', '>')) {
            if ($this->context->shop() == Shop::CONTEXT_SHOP) {
                $root_category = Category::getRootCategory();
                $root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name);
            } else {
                $root_category = array('id_category' => '0', 'name' => $this->l('Root'));
            }
            $helper = new Helper();
            $html .= $helper->renderCategoryTree(null, $selectedCat, 'categoryBox');
        } else {
            $trads = array('Home' => $this->l('Home'), 'selected' => $this->l('selected'), 'Collapse All' => $this->l('Collapse All'), 'Expand All' => $this->l('Expand All'), 'Check All' => $this->l('Check All'), 'Uncheck All' => $this->l('Uncheck All'), 'search' => $this->l('Search a category'));
            $html .= Helper::renderAdminCategorieTree($trads, $selectedCat, 'categoryBox');
        }
        $html .= '
					<br />
					<center><input type="button" class="button" value="' . $this->l('Save this selection') . '" onclick="$.fancybox.close();" /></center>
				</div>
			</div>
			<div id="layered-step-2">
				<hr size="1" noshade />
				<h2>' . $this->l('Step 2/3 - Select filters') . '</h2>
				<div id="layered_container">
					<div id="layered_container_left" style="width: 360px; float: left; height: 200px; overflow-y: auto;">
						<h3>' . $this->l('Selected filters') . ' <span id="num_sel_filters">(0)</span></h3>
						<p id="no-filters">' . $this->l('No filters selected yet.') . '</p>
						<ul id="selected_filters"></ul>
					</div>
					<div id="layered-ajax-refresh">
					' . $this->ajaxCallBackOffice() . '
					</div>
				</div>
				<div class="clear"></div>
				<hr size="1" noshade />';
        if (version_compare(_PS_VERSION_, '1.5', '>')) {
            $this->context->controller->addJQueryPlugin('fancybox');
            $this->context->controller->addJQueryUI('ui.sortable');
            $this->context->controller->addJQueryUI('ui.draggable');
            $this->context->controller->addJQueryUI('effects.transfer');
            $id_lang = Context::getContext()->cookie->id_lang;
        } else {
            $html .= '<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/jquery/jquery-ui-1.8.10.custom.min.js"></script>
					<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/jquery/jquery.fancybox-1.3.4.js"></script>
					<link type="text/css" rel="stylesheet" href="' . __PS_BASE_URI__ . 'css/jquery.fancybox-1.3.4.css" />';
            $id_lang = (int) $cookie->id_lang;
        }
        $html .= '
				<script type="text/javascript">
					function updLayCounters(showAlert)
					{
						$(\'#num_sel_filters\').html(\'(\'+$(\'ul#selected_filters\').find(\'li\').length+\')\');
						$(\'#num_avail_filters\').html(\'(\'+$(\'#layered_container_right ul\').find(\'li\').length+\')\');
						
						if ($(\'ul#selected_filters\').find(\'li\').length >= 1)
						{
							$(\'#layered-step-3\').show();
							$(\'#layered-step-3 .alert\').hide();
						}
						else
						{
							if (showAlert)
								$(\'#layered-step-3\').show();
							else
								$(\'#layered-step-3\').hide();
							
							$(\'#layered-step-3 .alert\').show();
							
						}
					}

					function updPositions()
					{
						$(\'#layered_container_left li\').each(function(idx) {
							$(this).find(\'span.position\').html(parseInt(1+idx)+\'. \');
						});
					}

					function updCatCounter()
					{
						$(\'#layered-cat-counter\').html($(\'#categories-treeview\').find(\'input:checked\').length);
						$(\'#layered-cat-counter\').show();
					}

					function updHeight()
					{
						$(\'#layered_container_left\').css(\'height\', 30+(1+$(\'#layered_container_left\').find(\'li\').length)*34);
						$(\'#layered_container_right\').css(\'height\', 30+(1+$(\'#layered_container_right\').find(\'li\').length)*34);
					}

					function updElements(all, id_layered_filter)
					{
						if ($(\'#error-treeview\').is(\':hidden\'))
							$(\'#layered-step-2\').show();
						else
							$(\'#layered-step-2\').hide();
						$(\'#layered-ajax-refresh\').css(\'background-color\', \'black\');
						$(\'#layered-ajax-refresh\').css(\'opacity\', \'0.2\');
						$(\'#layered-ajax-refresh\').html(\'<div style="margin: 0 auto; padding: 10px; text-align: center;">\'
						+\'<img src="../img/admin/ajax-loader-big.gif" alt="" /><br /><p style="color: white;">' . addslashes($this->l('Loading...')) . '</p></div>\');
						
						$.ajax(
						{
							type: \'POST\',
							url: \'' . __PS_BASE_URI__ . '\' + \'modules/blocklayered/blocklayered-ajax-back.php\',
							data: \'layered_token=' . substr(Tools::encrypt('blocklayered/index'), 0, 10) . '&id_lang=' . $id_lang . '&\'
								+(all ? \'\' : $(\'input[name="categoryBox[]"]\').serialize()+\'&\')
								+(id_layered_filter ? \'id_layered_filter=\'+parseInt(id_layered_filter) : \'\')
								+\'&base_folder=' . _PS_ADMIN_DIR_ . '\',
							success: function(result)
							{
								$(\'#layered-ajax-refresh\').css(\'background-color\', \'transparent\');
								$(\'#layered-ajax-refresh\').css(\'opacity\', \'1\');
								$(\'#layered-ajax-refresh\').html(result);
								
								$(\'#layered_container_right li input\').each(function() {
									if ($(\'#layered_container_left\').find(\'input[id="\'+$(this).attr(\'id\')+\'"]\').length > 0)
										$(this).parent().remove();
								});
								
								updHeight();
								updLayCounters(true);
							}
						});
						return false;
					}
					
					function checkForm()
					{
						if ($(\'#layered_tpl_name\').val() == \'\')
						{
							$(\'#error-filter-name\').show();
							return false;
						}
						else if ($(\'#scope_1\').attr(\'checked\') && $(\'#n_existing\').val() > 0)
							if (!confirm(\'' . addslashes($this->l('You selected -All categories-, all existing filter templates will be deleted, OK?')) . '\'))
								return false;

						return true;
					}

					function launch()
					{
						$(\'#layered_container input\').live(\'click\', function ()
						{
							if ($(this).parent().hasClass(\'layered_right\'))
							{
								$(\'p#no-filters\').hide();
								$(this).parent().css(\'background\', \'url("../img/jquery-ui/ui-bg_glass_100_fdf5ce_1x400.png") repeat-x scroll 50% 50% #FDF5CE\');
								$(this).parent().removeClass(\'layered_right\');
								$(this).parent().addClass(\'layered_left\');
								$(this).effect(\'transfer\', { to: $(\'#layered_container_left ul#selected_filters\') }, 300, function() {
									$(this).parent().appendTo(\'ul#selected_filters\');
									updLayCounters(false);
									updHeight();
									updPositions();
								});
							}
							else
							{
								$(this).parent().css(\'background\', \'url("../img/jquery-ui/ui-bg_glass_100_f6f6f6_1x400.png") repeat-x scroll 50% 50% #F6F6F6\');
								$(this).effect(\'transfer\', { to: $(\'#layered_container_right ul#all_filters\') }, 300, function() {
									$(this).parent().removeClass(\'layered_left\');
									$(this).parent().addClass(\'layered_right\');
									$(this).parent().appendTo(\'ul#all_filters\');
									updLayCounters(true);
									updHeight();
									updPositions();
									if ($(\'#layered_container_left ul\').length == 0)
										$(\'p#no-filters\').show();
								});
							}
							enableSortable();
						});
						
						$(\'label a#inline\').fancybox({ 
							\'hideOnContentClick\': false,
							\'onClosed\': function() {
								lock_treeview_hidding = false;
								$(\'#categories-treeview\').parent().parent().hide();
								updCatCounter();
								if ($(\'#categories-treeview\').find(\'input:checked\').length == 0)
									$(\'#error-treeview\').show();
								else
									$(\'#error-treeview\').hide();
								updElements(0, 0);
							},
							\'onComplete\': function() {
								lock_treeview_hidding = true;
								$(\'#categories-treeview\').parent().parent().show();
								if($($(\'#categories-treeview li\')[0]).attr(\'cleaned\'))
									return;
								if($($(\'#categories-treeview li\')[0]).attr(\'cleaned\', true))
								$($(\'#categories-treeview li\')[0]).removeClass(\'static\');
								$($(\'#categories-treeview li span\')[0]).trigger(\'click\');
								$($(\'#categories-treeview li\')[0]).children(\'div\').remove();
								$($(\'#categories-treeview li\')[0]).
									removeClass(\'collapsable lastCollapsable\').
									addClass(\'last static\');
								$(\'.hitarea\').live(\'click\', function(it)
								{
									$(this).parent().find(\'> .category_label\').click();
								});
							}
						});

						updHeight();
						updLayCounters(false);
						updPositions();
						updCatCounter();
						enableSortable();
					}
					
					function enableSortable()
					{
						$(function() {
							$(\'ul#selected_filters\').sortable({
								axis: \'y\',
								update: function() { updPositions(); },
								placeholder: \'ui-state-highlight\'

							});
							$(\'ul#selected_filters\').disableSelection();
						});
					}

					$(document).ready(function() {
						launch();
					});
				</script>
			</div>
			<div id="layered-step-3">
				<div id="error-filter-name" class="error">
					<img src="../img/admin/error.png" alt="" title="" />' . $this->l('Errors:') . '
					<ul>
						<li>' . $this->l('Filter template name required (cannot be empty)') . '</li>
					</ul>
				</div>
				<h2>' . $this->l('Step 3/3 - Name your template') . '</h2>
				<p>' . $this->l('Template name:') . ' <input type="text" id="layered_tpl_name" onkeyup="if ($(this).val() != \'\')
				{ $(\'#error-filter-name\').hide(); } else { $(\'#error-filter-name\').show(); }" name="layered_tpl_name" maxlength="64" value="' . $this->l('My template') . ' ' . date('Y-m-d') . '"
				style="width: 200px; font-size: 11px;" /> <span style="font-size: 10px; font-style: italic;">(' . $this->l('only as a reminder') . ')</span></p>
				<hr size="1" noshade />
				<p class="alert">' . $this->l('No filters selected, the blocklayered will be disable for the categories seleted.') . '</p>
				<br />
				<center><input type="submit" class="button" name="SubmitFilter" value="' . $this->l('Save this filter template') . '" /></center>
			</div>
				<input type="hidden" name="id_layered_filter" id="id_layered_filter" value="0" />
				<input type="hidden" name="n_existing" id="n_existing" value="' . (int) count($filtersTemplates) . '" />
			</form>
		</fieldset><br />
		<fieldset class="width4">
			<legend><img src="../img/admin/cog.gif" alt="" /> ' . $this->l('Configuration') . '</legend>
			<form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post">			
				<table border="0" style="font-size: 11px; width: 100%; margin: 0 auto;" class="table">
					<tr>
						<th style="text-align: center;">' . $this->l('Option') . '</th>
						<th style="text-align: center; width: 200px;">' . $this->l('Value') . '</th>
					</tr>
					<tr>
						<td style="text-align: right;">' . $this->l('Hide filter values with no product is matching') . '</td>
						<td style="text-align: center;">
							<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />
							' . $this->l('Yes') . ' <input type="radio" name="ps_layered_hide_0_values" value="1" ' . (Configuration::get('PS_LAYERED_HIDE_0_VALUES') ? 'checked="checked"' : '') . ' />
							<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" style="margin-left: 10px;" />
							' . $this->l('No') . ' <input type="radio" name="ps_layered_hide_0_values" value="0" ' . (!Configuration::get('PS_LAYERED_HIDE_0_VALUES') ? 'checked="checked"' : '') . ' />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;">' . $this->l('Show the number of matching products') . '</td>
						<td style="text-align: center;">
							<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />
							' . $this->l('Yes') . ' <input type="radio" name="ps_layered_show_qties" value="1" ' . (Configuration::get('PS_LAYERED_SHOW_QTIES') ? 'checked="checked"' : '') . ' />
							<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" style="margin-left: 10px;" />
							' . $this->l('No') . ' <input type="radio" name="ps_layered_show_qties" value="0" ' . (!Configuration::get('PS_LAYERED_SHOW_QTIES') ? 'checked="checked"' : '') . ' />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;">' . $this->l('Show products from subcategories') . '</td>
						<td style="text-align: center;">
							<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />
							' . $this->l('Yes') . ' <input type="radio" name="ps_layered_full_tree" value="1" ' . (Configuration::get('PS_LAYERED_FULL_TREE') ? 'checked="checked"' : '') . ' />
							<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" style="margin-left: 10px;" />
							' . $this->l('No') . ' <input type="radio" name="ps_layered_full_tree" value="0" ' . (!Configuration::get('PS_LAYERED_FULL_TREE') ? 'checked="checked"' : '') . ' />
						</td>
					</tr>
					<tr style="text-align: center;">
						<td style="text-align: right;">' . $this->l('Use tax to filter price') . '</td>
						<td>
							<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />
							' . $this->l('Yes') . ' <input type="radio" name="ps_layered_filter_price_usetax" value="1" ' . (Configuration::get('PS_LAYERED_FILTER_PRICE_USETAX') ? 'checked="checked"' : '') . ' />
							<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" style="margin-left: 10px;" />
							' . $this->l('No') . ' <input type="radio" name="ps_layered_filter_price_usetax" value="0" ' . (!Configuration::get('PS_LAYERED_FILTER_PRICE_USETAX') ? 'checked="checked"' : '') . ' />
						</td>
					</tr>
				</table>
				<p style="text-align: center;"><input type="submit" class="button" name="submitLayeredSettings" value="' . $this->l('Save configuration') . '" /></p>
			</form>
		</fieldset>';
        return $html;
    }
Exemple #4
0
    UIAdminAlerts::MError($errors);
}
?>
<div class="row">
	<div class="col-md-2 sidebar">
		<div class="panel panel-default">
			<div class="panel-heading">检索分类</div>
			<div class="panel-body">
			<script type="text/javascript">
				$(document).ready(function(){
					var base_url = 'index.php?rule=cms';
					// Load category products page when category is clicked
					$(document).on('click','#categories-treeview input', function(){
						if (this.value !== "")
							location.href = base_url + '&id_cms_category=' + parseInt(this.value);
						else
							location.href = base_url;
					});
				});
			</script>
			<?php 
$trads = array('Home' => '根分类', 'selected' => '选择', 'Collapse All' => '关闭', 'Expand All' => '展开');
echo Helper::renderAdminCategorieTree($trads, array(Tools::getRequest('id_cms_category') ? Tools::getRequest('id_cms_category') : 1), 'categoryBox', true, 'CMSTree');
?>
		 </div>
		</div>
	</div>
</div>
<?php 
$btn_group = array(array('type' => 'button', 'title' => '删除选中', 'confirm' => '确定要删除选中项?', 'name' => 'subDelete', 'btn_type' => 'submit', 'class' => 'btn-danger'), array('type' => 'button', 'title' => '激活选中', 'name' => 'subActiveON', 'btn_type' => 'submit', 'class' => 'btn-default'), array('type' => 'button', 'title' => '关闭选中', 'name' => 'subActiveOFF', 'btn_type' => 'submit', 'class' => 'btn-default'));
echo UIViewBlock::area(array('title' => '文章', 'table' => $table, 'class' => 'col-md-10 col-md-offset-2', 'result' => $result, 'btn_groups' => $btn_group), 'table');
Exemple #5
0
<?php

if (isset($_POST['SEOCateMetaUpdate'])) {
    if (isset($_POST['categoryBox']) && count($_POST['categoryBox']) > 0) {
        SEOHelper::updateCategoryMeta($_POST);
    }
}
/** 错误处理 */
if (isset($errors)) {
    UIAdminAlerts::MError($errors);
}
/** 导航 */
$breadcrumb = new UIAdminBreadcrumb();
$breadcrumb->home();
$breadcrumb->add(array('href' => 'index.php?rule=seo_meta', 'title' => 'Meta管理'));
$breadcrumb->add(array('title' => '编辑', 'active' => true));
$bread = $breadcrumb->draw();
$btn_group = array(array('type' => 'a', 'title' => '产品Metat管理', 'href' => 'index.php?rule=seo_meta_product', 'class' => 'btn-primary', 'icon' => 'share'), array('type' => 'button', 'title' => '更新', 'id' => 'save-seo-meta-form', 'class' => 'btn-success', 'icon' => 'save'));
echo UIViewBlock::area(array('bread' => $bread, 'btn_groups' => $btn_group), 'breadcrumb');
/** 构建表单 */
$form = new UIAdminEditForm('post', 'index.php?rule=seo_meta', 'form-horizontal', 'seo-meta-form');
$cate = array();
if (isset($_POST['categoryBox'])) {
    $cate = Tools::getRequest('categoryBox');
}
$trads = array('Home' => '根分类', 'selected' => '选择', 'Collapse All' => '关闭', 'Expand All' => '展开', 'Check All' => '全选', 'Uncheck All' => '全不选');
$form->items = array('title' => array('title' => 'Title规则', 'type' => 'text', 'value' => Tools::Q('title'), 'info' => '可用参数:C_ID,C_NAME,{关键词1|关键词2|关键词3}'), 'keywords' => array('title' => 'Keywords规则', 'type' => 'text', 'value' => Tools::Q('keywords'), 'info' => '可用参数:C_ID,C_NAME,{关键词1|关键词2|关键词3}'), 'description' => array('title' => 'Keywords', 'type' => 'text', 'value' => Tools::Q('description'), 'info' => '可用参数:C_ID,C_NAME,{关键词1|关键词2|关键词3}'), 'rewrite' => array('title' => 'Keywords', 'type' => 'text', 'value' => Tools::Q('rewrite'), 'info' => '可用参数:C_ID,C_NAME,{关键词1|关键词2|关键词3}'), 'categoryBox' => array('title' => '应用到分类', 'type' => 'custom', 'value' => Helper::renderAdminCategorieTree($trads, $cate, 'categoryBox', false, 'Tree')), 'SEOCateMetaUpdate' => array('type' => 'submit', 'class' => 'btn-success', 'icon' => 'save', 'title' => '生成'));
echo UIViewBlock::area(array('title' => '编辑', 'body' => $form->draw()), 'panel');
    public function displayForm($token = NULL)
    {
        global $currentIndex, $cookie;
        parent::displayForm();
        if (!($obj = $this->loadObject(true))) {
            return;
        }
        $active = $this->getFieldValue($obj, 'active');
        $customer_groups = $obj->getGroups();
        echo '
		<form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . ($token != NULL ? $token : $this->token) . '" method="post" enctype="multipart/form-data">
		' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . '
			<fieldset><legend><img src="../img/admin/tab-categories.gif" />' . $this->l('Category') . '</legend>
				<label>' . $this->l('Name:') . ' </label>
				<div class="margin-form translatable">';
        foreach ($this->_languages as $language) {
            echo '
					<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
						<input type="text" style="width: 260px" name="name_' . $language['id_lang'] . '" id="name_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'name', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" ' . (!$obj->id ? ' onkeyup="copy2friendlyURL();"' : '') . ' /><sup> *</sup>
						<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
					</div>';
        }
        echo '	<p class="clear"></p>
				</div>
				<label>' . $this->l('Displayed:') . ' </label>
				<div class="margin-form">
					<input type="radio" name="active" id="active_on" value="1" ' . ($active ? 'checked="checked" ' : '') . '/>
					<label class="t" for="active_on"><img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" /></label>
					<input type="radio" name="active" id="active_off" value="0" ' . (!$active ? 'checked="checked" ' : '') . '/>
					<label class="t" for="active_off"><img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" /></label>
				</div>
				<label>' . $this->l('Parent category:') . ' </label>
				<div class="margin-form">';
        // Translations are not automatic for the moment ;)
        $trads = array('Home' => $this->l('Home'), 'selected' => $this->l('selected'), 'Collapse All' => $this->l('Collapse All'), 'Expand All' => $this->l('Expand All'));
        echo Helper::renderAdminCategorieTree($trads, array(isset($obj->id_parent) ? $obj->id_parent : Tools::getValue('id_parent', 1)), 'id_parent', true);
        echo '</div>
				<label>' . $this->l('Description:') . ' </label>
				<div class="margin-form translatable">';
        foreach ($this->_languages as $language) {
            echo '
					<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
						<textarea name="description_' . $language['id_lang'] . '" rows="10" cols="100">' . htmlentities($this->getFieldValue($obj, 'description', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '</textarea>
					</div>';
        }
        echo '	<p class="clear"></p>
				</div>
				<label>' . $this->l('Image:') . ' </label>
				<div class="margin-form">';
        echo $this->displayImage($obj->id, _PS_IMG_DIR_ . 'c/' . $obj->id . '.jpg', 350, NULL, Tools::getAdminToken('AdminCatalog' . (int) Tab::getIdFromClassName('AdminCatalog') . (int) $cookie->id_employee), true);
        echo '	<br /><input type="file" name="image" />
					<p>' . $this->l('Upload category logo from your computer') . '</p>
				</div>
				<div class="clear"><br /></div>	
				<label>' . $this->l('Meta title:') . ' </label>
				<div class="margin-form translatable">';
        foreach ($this->_languages as $language) {
            echo '
					<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
						<input type="text" name="meta_title_' . $language['id_lang'] . '" id="meta_title_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'meta_title', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
						<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
					</div>';
        }
        echo '	<p class="clear"></p>
				</div>
				<label>' . $this->l('Meta description:') . ' </label>
				<div class="margin-form translatable">';
        foreach ($this->_languages as $language) {
            echo '<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
						<input type="text" name="meta_description_' . $language['id_lang'] . '" id="meta_description_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'meta_description', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
						<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
				</div>';
        }
        echo '	<p class="clear"></p>
				</div>
				<label>' . $this->l('Meta keywords:') . ' </label>
				<div class="margin-form translatable">';
        foreach ($this->_languages as $language) {
            echo '
					<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
						<input type="text" name="meta_keywords_' . $language['id_lang'] . '" id="meta_keywords_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'meta_keywords', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" />
						<span class="hint" name="help_box">' . $this->l('Forbidden characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
					</div>';
        }
        echo '	<p class="clear"></p>
				</div>
				<label>' . $this->l('Friendly URL:') . ' </label>
				<div class="margin-form translatable">';
        foreach ($this->_languages as $language) {
            echo '<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
						<input type="text" name="link_rewrite_' . $language['id_lang'] . '" id="link_rewrite_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'link_rewrite', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" onchange="this.value = str2url(this.value);" /><sup> *</sup>
						<span class="hint" name="help_box">' . $this->l('Only letters and the minus (-) character are allowed') . '<span class="hint-pointer">&nbsp;</span></span>
					</div>';
        }
        echo '	<p class="clear"></p>
				</div>
				<label>' . $this->l('Groups access:') . ' </label>
				<div class="margin-form">';
        $groups = Group::getGroups((int) $cookie->id_lang);
        if (sizeof($groups)) {
            echo '
					<table cellspacing="0" cellpadding="0" class="table" style="width: 28em;">
						<tr>
							<th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'groupBox[]\', this.checked)"' . (!isset($obj->id) ? 'checked="checked" ' : '') . ' /></th>
							<th>' . $this->l('ID') . '</th>
							<th>' . $this->l('Group name') . '</th>
						</tr>';
            $irow = 0;
            foreach ($groups as $group) {
                echo '
							<tr class="' . ($irow++ % 2 ? 'alt_row' : '') . '">
								<td><input type="checkbox" name="groupBox[]" class="groupBox" id="groupBox_' . $group['id_group'] . '" value="' . $group['id_group'] . '" ' . ((in_array($group['id_group'], $customer_groups) or !isset($obj->id)) ? 'checked="checked" ' : '') . '/></td>
								<td>' . $group['id_group'] . '</td>
								<td><label for="groupBox_' . $group['id_group'] . '" class="t">' . $group['name'] . '</label></td>
							</tr>';
            }
            echo '
					</table>
					<p style="padding:0px; margin:10px 0px 10px 0px;">' . $this->l('Mark all groups you want to give access to this category') . '</p>
					';
        } else {
            echo '<p>' . $this->l('No group created') . '</p>';
        }
        echo '
				</div>
				<div class="margin-form">
					<input type="submit" value="' . $this->l('Save and back to parent category') . '" name="submitAdd' . $this->table . 'AndBackToParent" class="button" />
					&nbsp;<input type="submit" class="button" name="submitAdd' . $this->table . '" value="' . $this->l('Save') . '"/>
				</div>
				<div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div>
			</fieldset>
		</form>
		<p class="clear"></p>';
    }
    public function getContent()
    {
        global $cookie;
        $this->instanceDefaultStates();
        $this->_postProcess();
        $categories = Category::getCategories((int) $cookie->id_lang);
        $order_states = OrderState::getOrderStates((int) $cookie->id_lang);
        $currency = new Currency((int) Configuration::get('PS_CURRENCY_DEFAULT'));
        $defaultLanguage = (int) Configuration::get('PS_LANG_DEFAULT');
        $languages = Language::getLanguages(false);
        $languageIds = 'voucher_details¤default_loyalty_state¤none_award_loyalty_state¤convert_loyalty_state¤validation_loyalty_state¤cancel_loyalty_state';
        $html = '
		<script type="text/javascript">
			id_language = Number(' . $defaultLanguage . ');
		</script>
		<h2>' . $this->l('Loyalty Program') . '</h2>
		<form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post">
			<fieldset>
				<legend>' . $this->l('Settings') . '</legend>
				
				<label>' . $this->l('Ratio') . '</label>
				<div class="margin-form">
					<input type="text" size="2" id="point_rate" name="point_rate" value="' . (double) Configuration::get('PS_LOYALTY_POINT_RATE') . '" /> ' . $currency->sign . '
					<label for="point_rate" class="t"> = ' . $this->l('1 reward point') . '.</label>
					<br />
					<label for="point_value" class="t">' . $this->l('1 point = ') . '</label>
					<input type="text" size="2" name="point_value" id="point_value" value="' . (double) Configuration::get('PS_LOYALTY_POINT_VALUE') . '" /> ' . $currency->sign . '
					<label for="point_value" class="t">' . $this->l('for the discount') . '.</label>
				</div>
				<div class="clear"></div>
				<label>' . $this->l('Voucher details') . '</label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            $html .= '
					<div id="voucher_details_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="voucher_details_' . $language['id_lang'] . '" value="' . Configuration::get('PS_LOYALTY_VOUCHER_DETAILS', (int) $language['id_lang']) . '" />
					</div>';
        }
        $html .= $this->displayFlags($languages, $defaultLanguage, $languageIds, 'voucher_details', true);
        $html .= '	</div>
				<div class="clear" style="margin-top: 20px"></div>
				<label>' . $this->l('Minimum amount in which the voucher can be used') . '</label>
				<div class="margin-form">
					<input type="text" size="2" name="minimal" value="' . (double) Configuration::get('PS_LOYALTY_MINIMAL') . '" /> ' . $currency->sign . '
				</div>
				<div class="clear" style="margin-top: 20px"></div>
				<label>' . $this->l('Give points on discounted products') . ' </label>
				<div class="margin-form">
					<input type="radio" name="PS_LOYALTY_NONE_AWARD" id="PS_LOYALTY_NONE_AWARD_on" value="1" ' . (Configuration::get('PS_LOYALTY_NONE_AWARD') ? 'checked="checked" ' : '') . '/>
					<label class="t" for="PS_LOYALTY_NONE_AWARD_on"><img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Yes') . '" /></label>
					<input type="radio" name="PS_LOYALTY_NONE_AWARD" id="PS_LOYALTY_NONE_AWARD_off" value="0" ' . (!Configuration::get('PS_LOYALTY_NONE_AWARD') ? 'checked="checked" ' : '') . '/>
					<label class="t" for="PS_LOYALTY_NONE_AWARD_off"><img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('No') . '" /></label>
					</div>
				<div class="clear"></div>
				<label>' . $this->l('Points are awarded when the order is') . '</label>
				<div class="margin-form" style="margin-top:10px">
					<select id="id_order_state_validation" name="id_order_state_validation">';
        foreach ($order_states as $order_state) {
            $html .= '<option value="' . $order_state['id_order_state'] . '" style="background-color:' . $order_state['color'] . ';"';
            if ((int) $this->loyaltyStateValidation->id_order_state == $order_state['id_order_state']) {
                $html .= ' selected="selected"';
            }
            $html .= '>' . $order_state['name'] . '</option>';
        }
        $html .= '</select>
				</div>
				<div class="clear"></div>
				<label>' . $this->l('Points are cancelled when the order is') . '</label>
				<div class="margin-form" style="margin-top:10px">
					<select id="id_order_state_cancel" name="id_order_state_cancel">';
        foreach ($order_states as $order_state) {
            $html .= '<option value="' . $order_state['id_order_state'] . '" style="background-color:' . $order_state['color'] . ';"';
            if ((int) $this->loyaltyStateCancel->id_order_state == $order_state['id_order_state']) {
                $html .= ' selected="selected"';
            }
            $html .= '>' . $order_state['name'] . '</option>';
        }
        $html .= '</select>
				</div>
				<div class="clear"></div>
				<label>' . $this->l('Vouchers created by the loyalty system can be used in the following categories :') . '</label>';
        $index = explode(',', Configuration::get('PS_LOYALTY_VOUCHER_CATEGORY'));
        $indexedCategories = isset($_POST['categoryBox']) ? $_POST['categoryBox'] : $index;
        // Translations are not automatic for the moment ;)
        $trads = array('Home' => $this->l('Home'), 'selected' => $this->l('selected'), 'Collapse All' => $this->l('Collapse All'), 'Expand All' => $this->l('Expand All'), 'Check All' => $this->l('Check All'), 'Uncheck All' => $this->l('Uncheck All'));
        $html .= '<div class="margin-form">' . Helper::renderAdminCategorieTree($trads, $indexedCategories) . '</div>';
        $html .= '
				<p style="padding-left:200px;">' . $this->l('Mark the box(es) of categories in which loyalty vouchers are usable.') . '</p>
				<div class="clear"></div>
				<h3 style="margin-top:20px">' . $this->l('Loyalty points progression') . '</h3>
				<label>' . $this->l('Initial') . '</label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            $html .= '
					<div id="default_loyalty_state_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="default_loyalty_state_' . $language['id_lang'] . '" value="' . (isset($this->loyaltyStateDefault->name[(int) $language['id_lang']]) ? $this->loyaltyStateDefault->name[(int) $language['id_lang']] : $this->loyaltyStateDefault->name[(int) $defaultLanguage]) . '" />
					</div>';
        }
        $html .= $this->displayFlags($languages, $defaultLanguage, $languageIds, 'default_loyalty_state', true);
        $html .= '	</div>
				<div class="clear"></div>
				<label>' . $this->l('Unavailable') . '</label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            $html .= '
					<div id="none_award_loyalty_state_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="none_award_loyalty_state_' . $language['id_lang'] . '" value="' . (isset($this->loyaltyStateNoneAward->name[(int) $language['id_lang']]) ? $this->loyaltyStateNoneAward->name[(int) $language['id_lang']] : $this->loyaltyStateNoneAward->name[(int) $defaultLanguage]) . '" />
					</div>';
        }
        $html .= $this->displayFlags($languages, $defaultLanguage, $languageIds, 'none_award_loyalty_state', true);
        $html .= '	</div>
				<div class="clear"></div>
				<label>' . $this->l('Converted') . '</label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            $html .= '
					<div id="convert_loyalty_state_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="convert_loyalty_state_' . $language['id_lang'] . '" value="' . (isset($this->loyaltyStateConvert->name[(int) $language['id_lang']]) ? $this->loyaltyStateConvert->name[(int) $language['id_lang']] : $this->loyaltyStateConvert->name[(int) $defaultLanguage]) . '" />
					</div>';
        }
        $html .= $this->displayFlags($languages, $defaultLanguage, $languageIds, 'convert_loyalty_state', true);
        $html .= '	</div>
				<div class="clear"></div>
				<label>' . $this->l('Validation') . '</label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            $html .= '
					<div id="validation_loyalty_state_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="validation_loyalty_state_' . $language['id_lang'] . '" value="' . (isset($this->loyaltyStateValidation->name[(int) $language['id_lang']]) ? $this->loyaltyStateValidation->name[(int) $language['id_lang']] : $this->loyaltyStateValidation->name[(int) $defaultLanguage]) . '" />
					</div>';
        }
        $html .= $this->displayFlags($languages, $defaultLanguage, $languageIds, 'validation_loyalty_state', true);
        $html .= '	</div>
				<div class="clear"></div>
				<label>' . $this->l('Cancelled') . '</label>
				<div class="margin-form">';
        foreach ($languages as $language) {
            $html .= '
					<div id="cancel_loyalty_state_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="cancel_loyalty_state_' . $language['id_lang'] . '" value="' . (isset($this->loyaltyStateCancel->name[(int) $language['id_lang']]) ? $this->loyaltyStateCancel->name[(int) $language['id_lang']] : $this->loyaltyStateCancel->name[(int) $defaultLanguage]) . '" />
					</div>';
        }
        $html .= $this->displayFlags($languages, $defaultLanguage, $languageIds, 'cancel_loyalty_state', true);
        $html .= '	</div>
				<div class="clear center">
					<input type="submit" style="margin-top:20px" name="submitLoyalty" id="submitLoyalty" value="' . $this->l('   Save   ') . '" class="button" />
				</div>
			</fieldset>
		</form>';
        return $html;
    }
Exemple #8
0
								<div class="col-md-10 form-horizontal">
									<div class="form-group">
										<label for="categoryBox" class="col-sm-2 control-label">关联分类</label>
										<div class="col-sm-10">
											<?php 
$trads = array('Home' => '根分类', 'selected' => '选择', 'Collapse All' => '关闭', 'Expand All' => '展开', 'Check All' => '全选', 'Uncheck All' => '全不选');
if (!isset($obj)) {
    $categoryBox = Tools::getRequest('categoryBox') ? Tools::getRequest('categoryBox') : array();
} else {
    if (Tools::isSubmit('categoryBox')) {
        $categoryBox = Tools::getRequest('categoryBox');
    } else {
        $categoryBox = Product::getProductCategoriesFullId($obj->id);
    }
}
echo Helper::renderAdminCategorieTree($trads, $categoryBox, 'categoryBox', false, 'Tree');
?>
											<a href="index.php?rule=category_edit" class="btn btn-link bt-icon confirm_leave">
												<span class="glyphicon glyphicon-plus"></span> 创建一个新分类 <span class="glyphicon glyphicon-new-window"></span>
											</a>
										</div>
									</div>
									<?php 
if (!isset($obj)) {
    $selectedCat = Category::getCategoryInformations(Tools::getRequest('categoryBox'));
} else {
    if (Tools::isSubmit('categoryBox')) {
        $selectedCat = Category::getCategoryInformations(Tools::getRequest('categoryBox'));
    } else {
        $selectedCat = Product::getProductCategoriesFull($obj->id);
    }
Exemple #9
0
        SEOHelper::updateProductMeta($_POST);
    }
}
/** 错误处理 */
if (isset($errors)) {
    UIAdminAlerts::MError($errors);
}
/** 导航 */
$breadcrumb = new UIAdminBreadcrumb();
$breadcrumb->home();
$breadcrumb->add(array('href' => 'index.php?rule=seo_meta', 'title' => 'Meta管理'));
$breadcrumb->add(array('title' => '编辑', 'active' => true));
$bread = $breadcrumb->draw();
$btn_group = array(array('type' => 'a', 'title' => '分类Metat管理', 'href' => 'index.php?rule=seo_meta', 'class' => 'btn-primary', 'icon' => 'share'), array('type' => 'button', 'title' => '更新', 'id' => 'save-seo-meta-form', 'class' => 'btn-success', 'icon' => 'save'));
echo UIViewBlock::area(array('bread' => $bread, 'btn_groups' => $btn_group), 'breadcrumb');
/** 构建表单 */
$form = new UIAdminEditForm('post', 'index.php?rule=seo_meta', 'form-horizontal', 'seo-meta-form');
$cate = array();
if (isset($_POST['categoryBox'])) {
    $cate = Tools::getRequest('categoryBox');
}
$brands = Brand::loadData();
$brandKeyVal = array();
if ($brands) {
    foreach ($brands['items'] as $brand) {
        $brandKeyVal[$brand['id_brand']] = $brand['name'];
    }
}
$trads = array('Home' => '根分类', 'selected' => '选择', 'Collapse All' => '关闭', 'Expand All' => '展开', 'Check All' => '全选', 'Uncheck All' => '全不选');
$form->items = array('title' => array('title' => 'Title规则', 'type' => 'text', 'value' => Tools::Q('title'), 'info' => '可用参数:P_ID,P_NAME,P_PRICE,P_OLD_PRICE,P_SKU,P_CATEGORY,P_COLOR,{关键词1|关键词2|关键词3}'), 'keywords' => array('title' => 'Keywords规则', 'type' => 'text', 'value' => Tools::Q('keywords'), 'info' => '可用参数:P_ID,P_NAME,P_PRICE,P_OLD_PRICE,P_SKU,P_CATEGORY,P_COLOR,{关键词1|关键词2|关键词3}'), 'description' => array('title' => 'Keywords', 'type' => 'text', 'value' => Tools::Q('description'), 'info' => '可用参数:P_ID,P_NAME,P_PRICE,P_OLD_PRICE,P_SKU,P_CATEGORY,P_COLOR,{关键词1|关键词2|关键词3}'), 'rewrite' => array('title' => 'Keywords', 'type' => 'text', 'value' => Tools::Q('rewrite'), 'info' => '可用参数:P_ID,P_NAME,P_PRICE,P_OLD_PRICE,P_SKU,P_CATEGORY,P_COLOR,{关键词1|关键词2|关键词3}'), 'categoryBox' => array('title' => '应用到分类', 'type' => 'custom', 'value' => Helper::renderAdminCategorieTree($trads, $cate, 'categoryBox', false, 'Tree')), 'id_brands' => array('title' => '应用到品牌', 'type' => 'select', 'value' => Tools::Q('id_brands'), 'option' => $brandKeyVal, 'info' => '不选则应用到所有品牌'), 'SEOProductMetaUpdate' => array('type' => 'submit', 'class' => 'btn-success', 'icon' => 'save', 'title' => '生成'));
echo UIViewBlock::area(array('title' => '编辑', 'body' => $form->draw()), 'panel');
Exemple #10
0
$breadcrumb->home();
$breadcrumb->add(array('title' => 'CMS', 'href' => 'index.php?rule=cms'));
$breadcrumb->add(array('title' => '编辑', 'active' => true));
$bread = $breadcrumb->draw();
$btn_group = array(array('type' => 'a', 'title' => '返回', 'href' => 'index.php?rule=cms', 'class' => 'btn-primary', 'icon' => 'level-up'), array('type' => 'button', 'title' => '保存', 'id' => 'save-cms-form', 'class' => 'btn-success', 'icon' => 'save'));
echo UIViewBlock::area(array('bread' => $bread, 'btn_groups' => $btn_group), 'breadcrumb');
if (isset($errors)) {
    UIAdminAlerts::MError($errors);
}
?>
<script language="javascript">
	$("#save-cms-save").click(function(){
		$("#cms-form").submit();
	})
</script>
<?php 
$form = new UIAdminEditForm('post', 'index.php?rule=cms_edit' . (isset($id) ? '&id=' . $id : ''), 'form-horizontal', 'cms-form');
$trads = array('selected' => '选择', 'Home' => '根分类', 'Collapse All' => '关闭', 'Expand All' => '展开');
if (!isset($obj)) {
    $categoryBox = Tools::P('categoryBox') ? Tools::P('categoryBox') : array();
} else {
    if (Tools::isSubmit('categoryBox')) {
        $categoryBox = Tools::P('categoryBox');
    } else {
        $categoryBox = CMS::getCMSCategoriesFullId($obj->id);
    }
}
$category = Helper::renderAdminCategorieTree($trads, $categoryBox, 'categoryBox', true, 'CMSTree');
$tag = '<div class="tagify-container"><input type="text" value="' . (isset($obj) ? Tag::tagToString($obj->id) : Tools::P('tags')) . '" class="form-control" data-role="tagsinput" name="tags" ></div>';
$form->items = array('title' => array('title' => '标题', 'type' => 'text', 'value' => isset($obj) ? $obj->title : Tools::Q('title')), 'active' => array('title' => '状态', 'type' => 'bool', 'value' => isset($obj) ? $obj->active : Tools::Q('active')), 'is_top' => array('title' => '置顶', 'type' => 'bool', 'value' => isset($obj) ? $obj->is_top : Tools::Q('is_top')), 'categoryBox' => array('title' => '分类', 'type' => 'custom', 'value' => $category), 'tags' => array('title' => 'Tag标签', 'type' => 'custom', 'value' => $tag), 'meta_title' => array('title' => 'Meta标题', 'type' => 'text', 'value' => isset($obj) ? $obj->meta_title : Tools::Q('meta_title')), 'meta_keywords' => array('title' => 'Meta关键词', 'type' => 'text', 'value' => isset($obj) ? $obj->meta_keywords : Tools::Q('meta_keywords')), 'meta_description' => array('title' => 'Meta描述', 'type' => 'text', 'value' => isset($obj) ? $obj->meta_description : Tools::Q('meta_description')), 'rewrite' => array('title' => '静态链接', 'type' => 'text', 'value' => isset($obj) ? $obj->rewrite : Tools::Q('rewrite')), 'content' => array('title' => '内容', 'type' => 'textarea', 'class' => 'tinymce', 'value' => isset($obj) ? $obj->content : Tools::Q('content')), 'saveCMS' => array('type' => 'hidden', 'value' => isset($id) ? 'edit' : 'add'));
echo UIViewBlock::area(array('col' => 'col-md-12', 'title' => '编辑', 'body' => $form->draw()), 'panel');
    private function _displayForm()
    {
        global $cookie;
        /* Check requirements */
        if (!function_exists('curl_init')) {
            $this->_html .= '<div class="alert error">' . $this->l('Facebook needs the CURL PHP extension. Please install and / or activate the extension before continuing with the configuration.') . '</div>';
            return;
        }
        if (!function_exists('json_decode')) {
            $this->_html .= '<div class="alert error">' . $this->l('Facebook needs the JSON PHP extension. Please install and / or activate the extension before continuing with the configuration.') . '</div>';
            return;
        }
        /* Delayed Posts */
        $aDelayedPosts = $this->_getDelayedPosts();
        /* Languages */
        $defaultLanguage = (int) Configuration::get('PS_LANG_DEFAULT');
        $languages = Language::getLanguages();
        $iso = Language::getIsoById($defaultLanguage);
        $isoCurrent = Language::getIsoById(intval($cookie->id_lang));
        if ($isoCurrent != 'fr') {
            $isoCurrent = 'en';
        }
        /* Product description type */
        $p_description_types = array('description_short' => $this->l('Short description'), 'description' => $this->l('Long description'), 'meta_description' => $this->l('Meta-description'));
        /* FB Redirect URL */
        $fb_redirect_url = _PS_BASE_URL_ . urlencode($_SERVER['REQUEST_URI']);
        $fb_page_token_link = 'https://graph.facebook.com/me/accounts?access_token=' . $this->_configuration['FBWALLPOSTS_AUTH_TOKEN'];
        /* Selected categories */
        $cIndex = array();
        $categories = Category::getCategories((int) $cookie->id_lang, false);
        $indexedCategories = $this->getCategories();
        if ($indexedCategories && is_array($indexedCategories)) {
            foreach ($indexedCategories as $k => $row) {
                $cIndex[] = $row['id_category'];
            }
        }
        $this->_html .= '
		<script type="text/javascript">id_language = Number(' . $defaultLanguage . ');</script>
		<script type="text/javascript" src="' . _MODULE_DIR_ . $this->name . '/js/jquery-ui-1.5.3.min.js"></script>
		<script type="text/javascript" src="' . _MODULE_DIR_ . $this->name . '/js/admin.js"></script>
		<link rel="stylesheet" type="text/css" href="' . _MODULE_DIR_ . $this->name . '/css/admin.css" />
		
		<style type="text/css">
			@import url(\'' . self::BT_API_MAIN_URL . 'css/styles.css?ts=' . time() . '\');
		</style>

		<style type="text/css">
		div.ui-tabs-panel, ul#fbwptabs {
			padding: 0;
		}
		div.ui-tabs-hide {
			display: none;
		}
		</style>

		<form action="' . $_SERVER['REQUEST_URI'] . '" method="post" enctype="multipart/form-data">
			<fieldset>
				<legend><img src="../img/admin/cog.gif" alt="" />' . $this->l('Settings') . '</legend>
				
				<ul id="fbwptabs" class="ui-tabs-nav" style="float: left; width: 180px; list-style-type: none;">
				<li class="ui-tabs-nav-item" id="nav-fragment-0" style="padding: 5px; border-bottom: 1px solid #666;"><a href="#fragment-0">' . $this->l('Welcome') . '</a></li>
				<li class="ui-tabs-nav-item" id="nav-fragment-1" style="padding: 5px; border-bottom: 1px solid #666;"><a href="#fragment-1">' . $this->l('Application settings') . '</a></li>
				<li class="ui-tabs-nav-item" id="nav-fragment-2" style="padding: 5px; border-bottom: 1px solid #666;"><a href="#fragment-2">' . $this->l('Module options') . '</a></li>
				<li class="ui-tabs-nav-item" id="nav-fragment-3" style="padding: 5px; border-bottom: 1px solid #666;"><a href="#fragment-3">' . $this->l('Categories selection') . '</a></li>
				<li class="ui-tabs-nav-item" id="nav-fragment-4" style="padding: 5px; border-bottom: 1px solid #666;"><a href="#fragment-4">' . $this->l('Manual publication') . '</a></li>
				<li class="ui-tabs-nav-item" id="nav-fragment-5" style="padding: 5px; border-bottom: 1px solid #666;"><a href="#fragment-5">' . $this->l('Delayed posts') . '</a></li>
				<li class="ui-tabs-nav-item" id="nav-fragment-6" style="padding: 5px; border-bottom: 1px solid #666;"><a style="font-weight: bold; color: green;" href="#fragment-6">' . $this->l('Documentation & Help') . '</a></li>
				</ul>

				<div id="tabsheets" style="float: left; width: 650px; margin-left: 25px; display: inline;">
				
				<p><img src="' . _MODULE_DIR_ . $this->name . '/images/admin/logo.png" width="360" height="60" alt="Facebook PS Wall Posts" /></p><br />
				
				<div id="fragment-0" class="ui-tabs-panel">

					<h2 style="font-size: 16px;">' . $this->l('Welcome') . '</h2>
					<p>' . $this->l('Welcome and thank your for purchasing our module. Please follow the instructions in the PDF documentation carefully (visit the "Documentation & Help" tab), especially when it comes to the application configuration on Facebook.') . '</p>
					<br />
					<h2 style="font-size: 16px;">' . $this->l('Unleash the power with Google Rich Snippets + Product Ratings and Reviews') . '</h2>
					<p>' . $this->l('Facebook PS Wall Posts is particulary powerful when you install it in conjunction with our') . ' <a href="' . $this->l('http://prestashop-modules.businesstech.fr/en/google-and-advertising-modules-for-prestashop/23-google-rich-snippets-product-ratings-and-reviews.html') . '" style="font-weight: bold; text-decoration: underline;" target="_blank">' . $this->l('Google Rich Snippets + Product Ratings and Reviews module') . '</a>. ' . $this->l('Featuring a full product rating and review system, when coupled with Facebook PS Wall Posts, any review posted on your PrestaShop product page will also be posted on your Facebook fan page. Visitors can their share these comments on their own Facebook personal page via the Facebook Like button that will be included below each product review. And you can also configure vouchers to encourage your customer to review and share your products. This module is, hands down, the best reviewing module with social integration on the market.') . '</p><p>&nbsp;</p>
					
					<iframe class="btxsellingiframe" src="' . self::BT_API_MAIN_URL . '?ts=' . time() . '&sName=' . $this->name . '&sLang=' . $isoCurrent . '"></iframe>
				</div>
				
				<div id="fragment-1" class="ui-tabs-panel">

					<h2 style="font-size: 16px;">' . $this->l('Facebook application settings') . '</h2>
	
					<label>' . $this->l('Your Facebook Application ID') . '</label>
					<div class="margin-form">
						<input type="text" size="25" name="app_id" id="app_id" class="ajxupd" value="' . Tools::getValue('app_id', $this->_configuration['FBWALLPOSTS_APP_ID']) . '" />
						<p class="clear">' . $this->l('Example:') . ' 195620783662078</p>
					</div>
	
					<label>' . $this->l('Your Facebook Application Secret') . '</label>
					<div class="margin-form">
						<input type="text" size="40" name="api_secret" id="api_secret" class="ajxupd" value="' . Tools::getValue('api_secret', $this->_configuration['FBWALLPOSTS_API_SECRET']) . '" />
						<input type="hidden" name="page_id" id="page_id" value="' . Tools::getValue('page_id', $this->_configuration['FBWALLPOSTS_PAGE_ID']) . '" />
						<p class="clear">' . $this->l('Example:') . ' 7c23af569e04fe5a541d5a9c6ea36d9</p>
					</div>
					
					
	
					<label>' . $this->l('Your main Facebook PROFILE Access Token') . '</label>
					<div class="margin-form">
						<textarea name="auth_token" id="auth_token" class="ajxupd" cols="60" rows="3">' . Tools::getValue('auth_token', $this->_configuration['FBWALLPOSTS_AUTH_TOKEN']) . '</textarea>
						<p class="clear">' . $this->l('First, enter your Facebook application ID and application secret, and update the settings.') . '<br />' . $this->l('When you are ready, click the link below to start the authorization procedure and obtain your access token: ') . '<br /><a id="profileaccesstokenlink" style="text-decoration: underline;" href="https://www.facebook.com/dialog/oauth?client_id=' . $this->_configuration['FBWALLPOSTS_APP_ID'] . '&ext_perm=offline_access&scope=offline_access,manage_pages,publish_stream&redirect_uri=' . $fb_redirect_url . '">' . $this->l('CLICK HERE') . '</a></p>
					</div>
	
					<label>' . $this->l('Your Facebook PAGE Access Token') . '</label>
					<div class="margin-form">
						<select name="page_auth_token" id="page_auth_token">';
        if (!empty($this->_configuration['FBWALLPOSTS_PAGES_LIST'])) {
            $this->buildPagesMenu();
        } else {
            $this->_html .= '
							<option value="0">--</option>
							';
        }
        $this->_html .= '
						</select>
						<p class="clear">' . $this->l('Once you have obtained your main PROFILE access token above, click the link below to obtain your PAGE access token. A list of all the pages you manage will be displayed in a pull-down menu above, so simply select the desired page.') . '<br /><a id="pageaccesstokenlink" style="text-decoration: underline;" href="https://graph.facebook.com/me/accounts?access_token=' . $this->_configuration['FBWALLPOSTS_AUTH_TOKEN'] . '">' . $this->l('CLICK HERE') . '</a></p>
					</div>
					
					<center style="color: red;">
					<input type="submit" name="submitFBWP" value="' . $this->l('Update') . '" class="button" />
					<input type="submit" name="testFBWP" value="' . $this->l('Test (only once config is done)') . '" class="button" /><br /><br />' . $this->l('NOTE: Only click the test button once you have fully completed the configuration') . '
					</center>
				
				</div>
				
				<div id="fragment-2" class="ui-tabs-panel">

					<h2 style="font-size: 16px;">' . $this->l('Module options') . '</h2>
	
					<label>' . $this->l('Language of your Facebook Wall Posts') . '</label>
					<div class="margin-form">
						<select name="lang_id">';
        $available_languages = Language::getLanguages(true);
        foreach ($available_languages as $l) {
            $this->_html .= '<option value="' . $l['id_lang'] . '"' . ((int) $l['id_lang'] === (int) Tools::getValue('lang_id', $this->_configuration['FBWALLPOSTS_LANG_ID']) ? ' selected="selected"' : '') . '>' . $l['name'] . '</option>' . "\n";
        }
        $this->_html .= '
						</select>
						<p class="clear">&nbsp;</p>
					</div>
	
					<label>' . $this->l('Use this for product description') . '</label>
					<div class="margin-form">
						<select name="p_descr_type">';
        foreach ($p_description_types as $k => $v) {
            $this->_html .= '<option value="' . $k . '"' . (strval($k) == strval(Tools::getValue('p_descr_type', $this->_configuration['FBWALLPOSTS_P_DESCR_TYPE'])) ? ' selected="selected"' : '') . '>' . $v . '</option>';
        }
        $this->_html .= '
						</select>
						<p class="clear">' . $this->l('Short description or meta-description is best. If using long description, all HTML tags will be automatically removed.') . '</p>
					</div>
	
					<label>' . $this->l('Image size for products') . '</label>
					<div class="margin-form">
						<select name="img_size">';
        $available_types = ImageType::getImagesTypes('products');
        foreach ($available_types as $t) {
            $this->_html .= '<option value="' . $t['name'] . '"' . ($t['name'] === Tools::getValue('img_size', $this->_configuration['FBWALLPOSTS_IMG_SIZE']) ? ' selected="selected"' : '') . '>' . $t['name'] . '</option>' . "\n";
        }
        $this->_html .= '
						</select>
						<p class="clear">' . $this->l('Select medium or large (must be at least 90 x 90 pixels)') . '</p>
					</div>
	
					<label>' . $this->l('Generate wall posts for new products ?') . '</label>
					<div class="margin-form">
						<select name="inc_new">
							<option value="1"' . ((int) 1 === (int) Tools::getValue('inc_new', $this->_configuration['FBWALLPOSTS_INC_NEW']) ? ' selected="selected"' : '') . '>' . $this->l('Yes') . '</option>' . "\n" . '<option value="0"' . ((int) 0 === (int) Tools::getValue('inc_new', $this->_configuration['FBWALLPOSTS_INC_NEW']) ? ' selected="selected"' : '') . '>' . $this->l('No') . '</option>';
        $this->_html .= '
						</select>
						<p class="clear">' . $this->l('Select if you wish to create wall posts for new products') . '</p>
					</div>
	
					<label>' . $this->l('Facebook status update text for new products') . '</label>
					<div class="margin-form">
						<input type="text" size="80" name="new_prod_txt" value="' . Tools::getValue('new_prod_txt', $this->_configuration['FBWALLPOSTS_NEW_PROD_TXT']) . '" />
						<p class="clear">' . $this->l('This phrase will be the main text (status update) of your new product wall posts. Example: A new product has been added on our shop !') . '</p>
					</div>
	
					<label>' . $this->l('Generate wall posts for back in stock products ?') . '</label>
					<div class="margin-form">
						<select name="inc_stock">
							<option value="1"' . ((int) 1 === (int) Tools::getValue('inc_stock', $this->_configuration['FBWALLPOSTS_INC_STOCK']) ? ' selected="selected"' : '') . '>' . $this->l('Yes') . '</option>' . "\n" . '<option value="0"' . ((int) 0 === (int) Tools::getValue('inc_stock', $this->_configuration['FBWALLPOSTS_INC_STOCK']) ? ' selected="selected"' : '') . '>' . $this->l('No') . '</option>';
        $this->_html .= '
						</select>
						<p class="clear">' . $this->l('Select if you wish to create wall posts for products that are back in stock.') . '</p>
					</div>
	
					<label>' . $this->l('Facebook status update text for products that are back in stock') . '</label>
					<div class="margin-form">
						<input type="text" size="80" name="stock_prod_txt" value="' . Tools::getValue('stock_prod_txt', $this->_configuration['FBWALLPOSTS_STOCK_PROD_TXT']) . '" />
						<p class="clear">' . $this->l('This phrase will be the main text (status update) of your back in stock product wall posts. Example: This product is back in stock on our shop !') . '</p>
					</div>

					<label>' . $this->l('Generate wall posts for product attributes ?') . '</label>
					<div class="margin-form">
						<select name="attribute_post">
							<option value="1"' . ((int) 1 === (int) Tools::getValue('attribute_post', $this->_configuration['FBWALLPOSTS_INC_ATTR_POST']) ? ' selected="selected"' : '') . '>' . $this->l('Yes') . '</option>' . "\n" . '<option value="0"' . ((int) 0 === (int) Tools::getValue('attribute_post', $this->_configuration['FBWALLPOSTS_INC_ATTR_POST']) ? ' selected="selected"' : '') . '>' . $this->l('No') . '</option>';
        $this->_html .= '
						</select>
						<p class="clear">' . $this->l('') . '</p>
					</div>

					<label>' . $this->l('Automatic posts management for new products') . '</label>
					<div class="margin-form">
						<select name="post_action">
							<option value="creation"' . ('creation' === Tools::getValue('post_action', $this->_configuration['FBWALLPOSTS_ACTION_NEW_POST']) ? ' selected="selected"' : '') . '>' . $this->l('Post on product creation') . '</option>' . "\n" . '<option value="delay"' . ('delay' === Tools::getValue('post_action', $this->_configuration['FBWALLPOSTS_ACTION_NEW_POST']) ? ' selected="selected"' : '') . '>' . $this->l('Put in queue and delayed post') . '</option>';
        $this->_html .= '
						</select>
						<p class="clear">' . $this->l('A product posted on initial creation will only be posted if it is marked as "Active" and only when you click on the "Save" button for the ') . ' <b>' . $this->l('first time.') . '</b> ' . $this->l('If you save it as inactive the first time to finish up your product sheet before publishing, and then mark it "active" and update it, it will not be posted. This is due to the fact that we can only use the "New product" hook. To get around this problem, we let you archive products for posting and you can then manully fire the posts in one click in the "Delayed posts" tab.') . '
						</p>
						<p style="font-weight: bold; color: red;">
						' . $this->l('NOTE FOR PRESTASHOP 1.5 USERS: You MUST use the delayed posts mode, otherwise the post on Facebook will be done without the photo. This is because, as of version 1.5, you can no longer upload a photo on initial product creation.') . '
						</p>
					</div>

					<center style="color: red;">
					<input type="submit" name="submitFBWP" value="' . $this->l('Update') . '" class="button" />
					<input type="submit" name="testFBWP" value="' . $this->l('Test (only once config is done)') . '" class="button" /><br /><br />' . $this->l('NOTE: Only click the test button once you have fully completed the configuration') . '
					</center>
				
				</div>
				
				
				<div id="fragment-3" class="ui-tabs-panel">
				
				<h2 style="font-size: 16px;">' . $this->l('Categories selection') . '</h2>
				
				<p>' . $this->l('Only products whose main (default) category is part of the categories checked below will be posted to your Facebook wall.') . '</p>
				
				<p>&nbsp;</p>
				';
        $trads = array('Home' => $this->l('Home'), 'selected' => $this->l('selected'), 'Collapse All' => $this->l('Collapse All'), 'Expand All' => $this->l('Expand All'), 'Check All' => $this->l('Check All'), 'Uncheck All' => $this->l('Uncheck All'));
        if (is_file(_PS_ROOT_DIR_ . '/classes/Helper.php')) {
            if (method_exists('Helper', 'renderAdminCategorieTree')) {
                $this->_html .= @Helper::renderAdminCategorieTree($trads, $cIndex);
            }
        } else {
            $this->_html .= '
					<script type="text/javascript">


					function doCheckAll()
					{
						$("input.categoryBox").attr("checked", true);
					}
					
					function doUncheckAll()
					{
						$("input.categoryBox").attr("checked", false);
					}
					</script>
					<table cellspacing="0" cellpadding="0" class="table">';
            $this->_html .= '<tr><td colspan="3"><a href="#" onclick="return doCheckAll();">' . $this->l('Check All') . '</a> - <a href="#" onclick="return doUncheckAll();">' . $this->l('Uncheck All') . '</a></td></tr>';
            $this->recurseCategoryForInclude($cIndex, $categories, $categories[0][1], 1);
            $this->_html .= '</table><br /><br />';
        }
        $this->_html .= '
					<center style="color: red;">
					<input type="submit" name="submitFBWP" value="' . $this->l('Update') . '" class="button" />
					<input type="submit" name="testFBWP" value="' . $this->l('Test (only once config is done)') . '" class="button" /><br /><br />' . $this->l('NOTE: Only click the test button once you have fully completed the configuration') . '
					</center>
					
				</div>
				
				<div id="fragment-4" class="ui-tabs-panel">
				
					<h2 style="font-size: 16px;">' . $this->l('Manual publication') . '</h2>
					
					<p>' . $this->l('In some cases, you may decide to set a product as inactive when you first create it. And only products marked as active will be published on your Facebook wall, so some new products may not make it there. This tool allows you to manually post a product on your wall when you see it fit for publication, with a post title of your choice.') . '</p>
					
					<p>' . $this->l('You can also publish categories or brands (manufacturers) manually.') . '</p>
					
					<p>&nbsp;</p>';
        if (version_compare(_PS_VERSION_, '1.5', '>')) {
            $this->_html .= '
					<link rel="stylesheet" type="text/css" href="' . __PS_BASE_URI__ . 'js/jquery/plugins/autocomplete/jquery.autocomplete.css" />
					<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/jquery/plugins/autocomplete/jquery.autocomplete.js"></script>
					';
        } else {
            $this->_html .= '
					<link rel="stylesheet" type="text/css" href="' . __PS_BASE_URI__ . 'css/jquery.autocomplete.css" />
					<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/jquery/jquery.autocomplete.js"></script>
					';
        }
        $this->_html .= '
					<h3>' . $this->l('Products') . '</h3>
					
					<p>' . $this->l('Begin typing the first letters of the product name, then select the product from the drop-down list:') . '</p>
					<input type="text" value="" id="product_autocomplete_input" style="width: 450px;" />
					<!-- <img id="addprodimg" onclick="$(this).prev().search();" style="cursor: pointer;" src="../img/admin/add.gif" alt="" /> -->
					<input type="hidden" name="inputProduct" id="inputProduct" value="" />
					<span id="nameProduct" style="font-weight: bold;"></span>
					
					<p>&nbsp;</p>
					
					<h3>' . $this->l('Categories') . '</h3>
					
					<p>' . $this->l('Begin typing the first letters of the category name, then select the category from the drop-down list:') . '</p>
					<input type="text" value="" id="cat_autocomplete_input" style="width: 450px;" />
					<!-- <img id="addcatimg" onclick="$(this).prev().search();" style="cursor: pointer;" src="../img/admin/add.gif" alt="" /> -->
					<input type="hidden" name="inputCat" id="inputCat" value="" />
					<span id="nameCat" style="font-weight: bold;"></span>
					
					<p>&nbsp;</p>
					
					<h3>' . $this->l('Brands / manufacturers') . '</h3>
					
					<p>' . $this->l('Begin typing the first letters of the brand / manufacturer name, then select the brand / manufacturer from the drop-down list:') . '</p>
					<input type="text" value="" id="man_autocomplete_input" style="width: 450px;" />
					<!-- <img id="addmanimg" onclick="$(this).prev().search();" style="cursor: pointer;" src="../img/admin/add.gif" alt="" /> -->
					<input type="hidden" name="inputMan" id="inputMan" value="" />
					<span id="nameMan" style="font-weight: bold;"></span>

				</div>

				<div id="fragment-5" class="ui-tabs-panel">
					<h2 style="font-size: 16px;">' . $this->l('Posts Delayed') . '</h2>
					<div id="delayedPostDiv">
					' . $this->_displayDelayedPosts($aDelayedPosts, null) . '
					</div>
					<div id="delayedPostsError"></div>
				</div>

				<div id="fragment-6" class="ui-tabs-panel">
					<h2 style="font-size: 16px;">' . $this->l('Documentation & Help') . '</h2>

					<p><strong style="font-weight: bold;">' . $this->l('MODULE PDF DOCUMENTATION: ') . '</strong> <a target="_blank" href="' . _PS_BASE_URL_ . _MODULE_DIR_ . $this->name . '/readme_' . $isoCurrent . '.pdf">readme_' . $isoCurrent . '.pdf</a></p>
					<p><strong style="font-weight: bold;">' . $this->l('SUPPORT E-MAIL: ') . '</strong> <a target="_blank" href="http://www.businesstech.fr/' . ($isoCurrent == 'fr' ? $isoCurrent . '/contactez-nous' : $isoCurrent . '/contact-us') . '">http://www.businesstech.fr/' . ($isoCurrent == 'fr' ? $isoCurrent . '/contactez-nous' : $isoCurrent . '/contact-us') . '</a></p>
				</div>
				
			</fieldset>
		</form>

		<div id="loadingDiv" style="display: none;"><img src="' . _MODULE_DIR_ . $this->name . '/images/admin/loading.gif" alt="Loading" /><br /><br />' . $this->l('Facebook update / synch in progress...') . '</div>
		
		<script type="text/javascript">
		urlToCall = null;
		
		/* function autocomplete */
		$(function() {
			$(\'#product_autocomplete_input\')
				.autocomplete(\'' . $_SERVER['REQUEST_URI'] . '&search_type=p\', {
					minChars: 2,
					autoFill: true,
					max:20,
					matchContains: true,
					mustMatch:true,
					scroll:false,
					cacheLength:0,
					formatItem: function(item) {
						return item[1]+\' - \'+item[0];

					}
				}).result(setProduct);
			$(\'#product_autocomplete_input\').setOptions({
				extraParams: {}
			});
		});
		
		function setProduct(event, data, formatted)
		{
			if (data == null)
				return false;
			var productId = data[1];
			var productName = data[0];
			
			$(\'#nameProduct\').html(productName +  \'<span onclick="delProduct(\' + productId + \');" style="cursor: pointer;"><img src="../img/admin/delete.gif" /></span><br /><br /><span style="font-weight: normal;">' . $this->l('Title of your Facebook post:') . '</span> <input type="text" name="productPostTitle" value="" size="50" /><input class="button" type="submit" name="publishProduct" value="' . $this->l('Publish on Facebook now') . '" /> <br />\');
			$(\'#inputProduct\').val(productId);
			$(\'#product_autocomplete_input\').val(\'\');
			$(\'#product_autocomplete_input\').css(\'display\', \'none\');
			$(\'#addprodimg\').css(\'display\', \'none\');
		}
		
		function delProduct(id)
		{
			$(\'#nameProduct\').html(\'\');
			$(\'#inputProduct\').val(\'\');
			$(\'#product_autocomplete_input\').css(\'display\', \'inline\');
			$(\'#addprodimg\').css(\'display\', \'inline\');
		}
		
		/* function autocomplete */
		$(function() {
			$(\'#cat_autocomplete_input\')
				.autocomplete(\'' . $_SERVER['REQUEST_URI'] . '&search_type=c\', {
					minChars: 2,
					autoFill: true,
					max:20,
					matchContains: true,
					mustMatch:true,
					scroll:false,
					cacheLength:0,
					formatItem: function(item) {
						return item[1]+\' - \'+item[0];
					}
				}).result(setCat);
			$(\'#cat_autocomplete_input\').setOptions({
				extraParams: {}
			});
		});
		
		function setCat(event, data, formatted)
		{
			if (data == null)
				return false;
			var catId = data[1];
			var catName = data[0];
			
			$(\'#nameCat\').html(catName +  \'<span onclick="delCat(\' + catId + \');" style="cursor: pointer;"><img src="../img/admin/delete.gif" /></span><br /><br /><span style="font-weight: normal;">' . $this->l('Title of your Facebook post:') . '</span> <input type="text" name="catPostTitle" value="" size="50" /><input class="button" type="submit" name="publishCat" value="' . $this->l('Publish on Facebook now') . '" /> <br />\');
			$(\'#inputCat\').val(catId);
			$(\'#cat_autocomplete_input\').val(\'\');
			$(\'#cat_autocomplete_input\').css(\'display\', \'none\');
			$(\'#addcatimg\').css(\'display\', \'none\');
		}
		
		function delCat(id)
		{
			$(\'#nameCat\').html(\'\');
			$(\'#inputCat\').val(\'\');
			$(\'#cat_autocomplete_input\').css(\'display\', \'inline\');
			$(\'#addcatimg\').css(\'display\', \'inline\');
		}
		
		/* function autocomplete */
		$(function() {
			$(\'#man_autocomplete_input\')
				.autocomplete(\'' . $_SERVER['REQUEST_URI'] . '&search_type=m\', {
					minChars: 2,
					autoFill: true,
					max:20,
					matchContains: true,
					mustMatch:true,
					scroll:false,
					cacheLength:0,
					formatItem: function(item) {
						return item[1]+\' - \'+item[0];
					}
				}).result(setMan);
			$(\'#man_autocomplete_input\').setOptions({
				extraParams: {}
			});
		});
		
		function setMan(event, data, formatted)
		{
			if (data == null)
				return false;
			var manId = data[1];
			var manName = data[0];
			
			$(\'#nameMan\').html(manName +  \'<span onclick="delMan(\' + manId + \');" style="cursor: pointer;"><img src="../img/admin/delete.gif" /></span><br /><br /><span style="font-weight: normal;">' . $this->l('Title of your Facebook post:') . '</span> <input type="text" name="manPostTitle" value="" size="50" /><input class="button" type="submit" name="publishMan" value="' . $this->l('Publish on Facebook now') . '" /> <br />\');
			$(\'#inputMan\').val(manId);
			$(\'#man_autocomplete_input\').val(\'\');
			$(\'#man_autocomplete_input\').css(\'display\', \'none\');
			$(\'#addmanimg\').css(\'display\', \'none\');
		}
		
		function delMan(id)
		{
			$(\'#nameMan\').html(\'\');
			$(\'#inputMan\').val(\'\');
			$(\'#man_autocomplete_input\').css(\'display\', \'inline\');
			$(\'#addmanimg\').css(\'display\', \'inline\');
		}

		function center_div(div)
		{
			var wWidth = window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth);
			var wHeight = window.innerHeight || (window.document.documentElement.clientHeight || window.document.body.clientHeight);
			if(typeof self.pageYOffset!="undefined") yOffset=self.pageYOffset;
			else if(document.compatMode && document.compatMode != "BackCompat") yOffset=document.documentElement.scrollTop;
			else if(document.body && typeof(document.body.scrollTop)!="undefined") yOffset=document.body.scrollTop;		
			var x = Math.round((wWidth - div.width()) / 2);
			var y = Math.round((wHeight - div.height()) / 2) + yOffset;
			div.css({position:"absolute", top:y+"px", left:x+"px"});
		}

		function populatePagesList() 
		{
			center_div($("#loadingDiv"));
			$("#loadingDiv").show();

			$.ajax({
				type: "GET",
				url: "' . urldecode($fb_redirect_url) . '",
				dataType: "json",
				data: "fetchPages=1&encodedlink=' . base64_encode($fb_page_token_link) . '", 
				async : true,
				success: function(data) 
				{	
					if (data.length > 0) 
					{
						$("#page_auth_token").html("");
						$.each(data, function(i, el) {
							$("#page_auth_token").append("<option value="+ el.id + "' . self::TOKEN_DELIMITER . '" + el.access_token +">" + el.name + "</option>");
						});
						$("#loadingDiv").hide();
					}
					return false;
				},
				error: function() 
				{
					$("#loadingDiv").hide();
					alert("' . $this->l('Could not obtain your list of pages. Please make sure you have correctly configured your Facebook application and are logged in to Facebook. Please also make sure you have obtained your PROFILE access token in the previous steps.') . '");
					return false;
				}
			});
		}

		$(document).ready(function(){
			$("ul.ui-tabs-nav").tabs();
			
			$(\'.ajxupd\').blur(function(){
				
				var id = $(this).attr("id");
				var val = $("#"+id).val();
				
				$.ajax({
					type: "GET",
					url: "' . $_SERVER['REQUEST_URI'] . '",
					dataType: "json",
					data: "updField=1&field_id="+id+"&field_value="+val, 
					async : true,
					success: function(data) 
					{	
						$(\'#profileaccesstokenlink\').attr("href", data[0].profileaccesstokenlink);
						$(\'#pageaccesstokenlink\').attr("href", data[0].pageaccesstokenlink);
						return true;
					},
					error: function() 
					{
						return false;
					}
				});
			});


			$("#pageaccesstokenlink").click(function(e) {
				populatePagesList();
				e.stopPropagation();
				return false;
			});

		});
		</script>
		';
    }
Exemple #12
0
?>
">
								<input type="radio" name="active" value="1" autocomplete="off" >启用
							</label>
							<label class="btn btn-grey">
								<input type="radio" name="active" value="0" autocomplete="off">关闭
							</label>
						</div>
					</div>
				</div>
				<div class="form-group">
					<label for="categoryBox" class="col-sm-2 control-label">关联分类</label>
					<div class="col-sm-10">
				<?php 
$trads = array('Home' => '根分类', 'selected' => '选择', 'Collapse All' => '关闭', 'Expand All' => '展开');
echo Helper::renderAdminCategorieTree($trads, array(isset($obj) ? $obj->id_parent : 1), 'id_parent', true, 'CMSTree');
?>
					</div>
				</div>
				<div class="form-group">
					<label for="meta_title" class="col-sm-2 control-label">Meta Title</label>
					<div class="col-sm-10">
						<input type="text" value="<?php 
echo isset($obj) ? $obj->meta_title : Tools::getRequest('meta_title');
?>
" class="form-control" name="meta_title" >
					</div>
				</div>
				<div class="form-group">
					<label for="meta_keywords" class="col-sm-2 control-label">Meta Keywords</label>
					<div class="col-sm-10">