public function displayFormFeatures($obj, $languages, $defaultLanguage)
    {
        global $cookie, $currentIndex;
        //duplicate AdminTab::displayForm for display flag near traanslateable input fields
        $allowEmployeeFormLang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
        echo '
			<script type="text/javascript">
				$(document).ready(function() {
					id_language = ' . $defaultLanguage . ';
					languages = new Array();';
        foreach ($languages as $k => $language) {
            echo '
					languages[' . $k . '] = {
						id_lang: ' . (int) $language['id_lang'] . ',
						iso_code: \'' . $language['iso_code'] . '\',
						name: \'' . htmlentities($language['name'], ENT_COMPAT, 'UTF-8') . '\'
					};';
        }
        echo '
					displayFlags(languages, id_language, ' . $allowEmployeeFormLang . ');
				});
			</script>';
        if ($obj->id) {
            //  		$feature = Feature::getFeatures(intval($cookie->id_lang));
            include_once 'ExFeature.php';
            $feature = ExFeature::getFeatures($defaultLanguage);
            $ctab = '';
            foreach ($feature as $group) {
                foreach ($group["features"] as $f) {
                    $ctab .= 'ccustom_' . $f['id'] . '¤';
                }
            }
            $ctab = rtrim($ctab, '¤');
            ?>
			<table cellpadding="5">
				<tr>
					<td colspan="2"><b><?php 
            echo $this->l('Assign features to this product');
            ?>
</b></td>
				</tr>
			</table>
			<hr style="width:730px;" />
            <a href="#" id="all_close" class="module_toggle_all"><?php 
            echo $this->l('Collapse all');
            ?>
</a> 
            <a id="all_open" class="module_toggle_all" href="#"><?php 
            echo $this->l('Expand all');
            ?>
</a><br /> 
			
            <?php 
            // Header
            $nb_feature = Feature::nbFeatures(intval($cookie->id_lang));
            ?>
			<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:906px;">
				<tr>
					<th style="width:30%; padding-left:10px;"><?php 
            echo $this->l('Features');
            ?>
</td>
					<th style="width:25%"><?php 
            echo $this->l('Value');
            ?>
</td>
					<th style="width:45%"><?php 
            echo $this->l('Customized');
            ?>
</td>
				</tr>
            <?php 
            if (!$nb_feature) {
                ?>
					<tr><td colspan="3" style="text-align:center;">'.$this->l('No features defined').'</td></tr>
            <?php 
            }
            ?>
			</table>
            
            <?php 
            // Listing
            if ($nb_feature) {
                $pfeatures = Product::getFeaturesStatic($obj->id);
                $product_features = array();
                foreach ($pfeatures as $pf) {
                    if (!array_key_exists($pf["id_feature"], $product_features)) {
                        $product_features[$pf["id_feature"]] = array();
                    }
                    $product_features[$pf["id_feature"]][] = $pf["id_feature_value"];
                }
                unset($pfeatures);
                $odd = 0;
                ?>
				
                <?php 
                // <table cellpadding="5" style="width:743px; margin-top:10px">
                ?>
                
                <?php 
                //Main loop
                foreach ($feature as $gid => $group) {
                    ?>
                    <div id="cgroup<?php 
                    echo $gid;
                    ?>
" class="header_module">
				        <span class="nbr_module" style="width:100px;text-align:right; margin-right: 125px;"><?php 
                    echo count($group["features"]);
                    ?>
 <?php 
                    echo $this->l('features');
                    ?>
</span>
	                    <a class="header_module_toggle" id="group_<?php 
                    echo $gid;
                    ?>
" href="modgo_search_filter" style="margin-left: 5px;">
                            <span style="padding-right:0.5em">
       					        <img class="header_module_img" id="search_filter_img" src="../img/admin/more.png" alt="" />
                            </span><?php 
                    echo $group["name"];
                    ?>
                        </a> 
				    </div>
                    <div id="group_<?php 
                    echo $gid;
                    ?>
_content" class="tab_module_content" style="display:none;border:solid 1px #CCC">
                        <div id="modgo_blocksearch">
                            <table style="width:100%" cellpadding="0" cellspacing="0">
                <?php 
                    foreach ($group["features"] as $tab_features) {
                        $current_item = false;
                        $custom = true;
                        foreach ($obj->getFeatures() as $tab_products) {
                            if ($tab_products['id_feature'] == $tab_features['id_feature']) {
                                $current_item = $tab_products['id_feature_value'];
                            }
                        }
                        $featureValues = FeatureValue::getFeatureValuesWithLang((int) $cookie->id_lang, (int) $tab_features['id_feature']);
                        echo '
					<tr>
						<td style="padding-left: 10px; width: 30%">' . $tab_features['name'] . '</td>
						<td style="width: 25%">';
                        if (sizeof($featureValues)) {
                            echo '
							<select id="feature_' . $tab_features['id_feature'] . '_value" name="feature_' . $tab_features['id_feature'] . '_value"
								onchange="$(\'.custom_' . $tab_features['id_feature'] . '_\').val(\'\');">
								<option value="0">---&nbsp;</option>';
                            foreach ($featureValues as $value) {
                                if ($current_item == $value['id_feature_value']) {
                                    $custom = false;
                                }
                                echo '<option value="' . $value['id_feature_value'] . '"' . ($current_item == $value['id_feature_value'] ? ' selected="selected"' : '') . '>' . substr($value['value'], 0, 40) . (Tools::strlen($value['value']) > 40 ? '...' : '') . '&nbsp;</option>';
                            }
                            echo '</select>';
                        } else {
                            echo '<input type="hidden" name="feature_' . $tab_features['id_feature'] . '_value" value="0" /><span style="font-size: 10px; color: #666;">' . $this->l('N/A') . ' - <a href="index.php?tab=AdminFeatures&addfeature_value&id_feature=' . (int) $tab_features['id_feature'] . '&token=' . Tools::getAdminToken('AdminFeatures' . (int) Tab::getIdFromClassName('AdminFeatures') . (int) $cookie->id_employee) . '" style="color: #666; text-decoration: underline;">' . $this->l('Add pre-defined values first') . '</a></span>';
                        }
                        echo '
						</td>
						<td style="width:45%" class="translatable">';
                        $tab_customs = $custom ? FeatureValue::getFeatureValueLang($current_item) : array();
                        foreach ($languages as $language) {
                            echo '
							<div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left; margin-top: 5px; margin-bottom: 5px;">
								<textarea class="custom_' . $tab_features['id_feature'] . '_" name="custom_' . $tab_features['id_feature'] . '_' . $language['id_lang'] . '" cols="40" rows="1"
									onkeyup="$(\'#feature_' . $tab_features['id_feature'] . '_value\').val(0);" >' . htmlentities(Tools::getValue('custom_' . $tab_features['id_feature'] . '_' . $language['id_lang'], FeatureValue::selectLang($tab_customs, $language['id_lang'])), ENT_COMPAT, 'UTF-8') . '</textarea>
							</div>';
                        }
                        /*                    echo '<div style="
                                                      float: left;
                                                      margin-top: 10px;
                                                      margin-left: 5px">'
                                              .$this->displayFlags($languages, $defaultLanguage, $ctab, 'ccustom_'.$tab_features['id_feature'], true).
                                              '</div>'; */
                        echo '
						</td>
					</tr>';
                    }
                    ?>
		                        

                            </table>
				        </div>
				    </div> 
                <?php 
                }
                ?>
                <div id="updateFeatureAdminContainer" style="text-align: center; margin-top: 10px;">    
                    <input type="submit" name="submitProductFeature" id="submitProductFeature" value="<?php 
                echo $this->l('Update features');
                ?>
" class="button" />
                </div>
			<?php 
            }
            ?>
            
            
			<hr style="width:730px;" />
			<div style="text-align:center;">
				<a href="index.php?tab=AdminExFeatures&addfeature&token=<?php 
            echo Tools::getAdminToken('AdminExFeatures' . intval(Tab::getIdFromClassName('AdminExFeatures')) . intval($cookie->id_employee));
            ?>
" onclick="return confirm('<?php 
            echo $this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false);
            ?>
');">
                    <img src="../img/admin/add.gif" alt="new_features" title="<?php 
            echo $this->l('Create new features');
            ?>
" />&nbsp;<?php 
            echo $this->l('Create new features');
            ?>
                </a>
			</div>
		<?php 
        } else {
            echo '<b>' . $this->l('You must save this product before adding features') . '.</b>';
        }
    }
    function displayFormFeatures($obj, $languages, $defaultLanguage)
    {
        global $cookie, $currentIndex;
        if ($obj->id) {
            $feature = Feature::getFeatures(intval($cookie->id_lang));
            $ctab = '';
            foreach ($feature as $tab) {
                $ctab .= 'ccustom_' . $tab['id_feature'] . '¤';
            }
            $ctab = rtrim($ctab, '¤');
            echo '
			<table cellpadding="5">
				<tr>
					<td colspan="2"><b>' . $this->l('Assign features to this product') . '</b></td>
				</tr>
			</table>
			<hr style="width:730px;"><br />';
            // Header
            $nb_feature = Feature::nbFeatures(intval($cookie->id_lang));
            echo '
			<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:600px;">
				<tr>
					<th>' . $this->l('Features') . '</td>
					<th style="width:220px">' . $this->l('Value') . '</td>
					<th style="width:170px">' . $this->l('Customized') . '</td>
				</tr>';
            if (!$nb_feature) {
                echo '<tr><td colspan="3" style="text-align:center;">' . $this->l('No features defined') . '</td></tr>';
            }
            echo '</table>';
            // Listing
            if ($nb_feature) {
                echo '
				<table cellpadding="5" style="width:600px; margin-top:10px">';
                foreach ($feature as $tab_features) {
                    $current_item = false;
                    $custom = false;
                    $product_features = $obj->getFeatures();
                    foreach ($product_features as $tab_products) {
                        if ($tab_products['id_feature'] == $tab_features['id_feature']) {
                            $current_item = $tab_products['id_feature_value'];
                        }
                    }
                    echo '
					<tr>
						<td>' . $tab_features['name'] . '</td>
						<td style="width:220px">
							<select name="feature_' . $tab_features['id_feature'] . '_value">
							<option value="0">---&nbsp;</option>';
                    $feature_values = FeatureValue::getFeatureValues($tab_features['id_feature']);
                    foreach ($feature_values as $tab_values) {
                        if (!$tab_values['custom']) {
                            $value = FeatureValue::selectLang(FeatureValue::getFeatureValueLang($tab_values['id_feature_value']), intval($cookie->id_lang));
                            echo '<option value="' . $tab_values['id_feature_value'] . '"' . ($current_item == $tab_values['id_feature_value'] ? ' selected="selected"' : '') . '>' . substr($value, 0, 40) . (Tools::strlen($value) > 40 ? '...' : '') . '&nbsp;</option>';
                        } else {
                            $custom = true;
                        }
                    }
                    echo '
							</select>
						</td>
						<td style="width:170px">';
                    $tab_customs = array();
                    if ($custom) {
                        $tab_customs = FeatureValue::getFeatureValueLang($current_item);
                    }
                    foreach ($languages as $language) {
                        $custom_lang = FeatureValue::selectLang($tab_customs, $language['id_lang']);
                        echo '
								<div id="ccustom_' . $tab_features['id_feature'] . '_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
									<input type="text" name="custom_' . $tab_features['id_feature'] . '_' . $language['id_lang'] . '" size="20" value="' . htmlentities(Tools::getValue('custom_' . $tab_features['id_feature'] . '_' . $language['id_lang'], $custom_lang), ENT_COMPAT, 'UTF-8') . '" />
								</div>';
                    }
                    $this->displayFlags($languages, $defaultLanguage, $ctab, 'ccustom_' . $tab_features['id_feature']);
                    echo '
						</td>
					</tr>';
                }
                echo '
				<tr>
					<td>&nbsp;</td>
					<td style="height:50px; " valign="bottom"><input type="submit" name="submitProductFeature" id="submitProductFeature" value="' . $this->l('Update features') . '" class="button" /></td>
				</tr>';
            }
            echo '</table>
			<hr style="width:730px;">
			<div style="text-align:center;">
				<a href="index.php?tab=AdminFeatures&addfeature&token=' . Tools::getAdminToken('AdminFeatures' . intval(Tab::getIdFromClassName('AdminFeatures')) . intval($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="new_features" title="' . $this->l('Create new features') . '" />&nbsp;' . $this->l('Create new features') . '</a>
			</div>';
        } else {
            echo '<b>' . $this->l('You must save this product before adding features') . '.</b>';
        }
    }
    function displayFormFeatures($obj)
    {
        global $cookie, $currentIndex;
        parent::displayForm();
        if ($obj->id) {
            $feature = Feature::getFeatures((int) $cookie->id_lang);
            $ctab = '';
            foreach ($feature as $tab) {
                $ctab .= 'ccustom_' . $tab['id_feature'] . '¤';
            }
            $ctab = rtrim($ctab, '¤');
            echo '
			<table cellpadding="5">
				<tr>
					<td colspan="2">
						<b>' . $this->l('Assign features to this product:') . '</b><br />
						<ul style="margin: 10px 0 0 20px;">
							<li>' . $this->l('You can specify a value for each relevant feature regarding this product, empty fields will not be displayed.') . '</li>
							<li>' . $this->l('You can either set a specific value, or select among existing pre-defined values you added previously.') . '</li>
						</ul>
					</td>
				</tr>
			</table>
			<hr style="width:100%;" /><br />';
            // Header
            $nb_feature = Feature::nbFeatures((int) $cookie->id_lang);
            echo '
			<table border="0" cellpadding="0" cellspacing="0" class="table" style="width:900px;">
				<tr>
					<th>' . $this->l('Feature') . '</td>
					<th style="width:30%">' . $this->l('Pre-defined value') . '</td>
					<th style="width:40%"><u>' . $this->l('or') . '</u> ' . $this->l('Customized value') . '</td>
				</tr>';
            if (!$nb_feature) {
                echo '<tr><td colspan="3" style="text-align:center;">' . $this->l('No features defined') . '</td></tr>';
            }
            echo '</table>';
            // Listing
            if ($nb_feature) {
                echo '
				<table cellpadding="5" style="width: 900px; margin-top: 10px">';
                foreach ($feature as $tab_features) {
                    $current_item = false;
                    $custom = true;
                    foreach ($obj->getFeatures() as $tab_products) {
                        if ($tab_products['id_feature'] == $tab_features['id_feature']) {
                            $current_item = $tab_products['id_feature_value'];
                        }
                    }
                    $featureValues = FeatureValue::getFeatureValuesWithLang((int) $cookie->id_lang, (int) $tab_features['id_feature']);
                    echo '
					<tr>
						<td>' . $tab_features['name'] . '</td>
						<td style="width: 30%">';
                    if (sizeof($featureValues)) {
                        echo '
							<select id="feature_' . $tab_features['id_feature'] . '_value" name="feature_' . $tab_features['id_feature'] . '_value"
								onchange="$(\'.custom_' . $tab_features['id_feature'] . '_\').val(\'\');">
								<option value="0">---&nbsp;</option>';
                        foreach ($featureValues as $value) {
                            if ($current_item == $value['id_feature_value']) {
                                $custom = false;
                            }
                            echo '<option value="' . $value['id_feature_value'] . '"' . ($current_item == $value['id_feature_value'] ? ' selected="selected"' : '') . '>' . substr($value['value'], 0, 40) . (Tools::strlen($value['value']) > 40 ? '...' : '') . '&nbsp;</option>';
                        }
                        echo '</select>';
                    } else {
                        echo '<input type="hidden" name="feature_' . $tab_features['id_feature'] . '_value" value="0" /><span style="font-size: 10px; color: #666;">' . $this->l('N/A') . ' - <a href="index.php?tab=AdminFeatures&addfeature_value&id_feature=' . (int) $tab_features['id_feature'] . '&token=' . Tools::getAdminToken('AdminFeatures' . (int) Tab::getIdFromClassName('AdminFeatures') . (int) $cookie->id_employee) . '" style="color: #666; text-decoration: underline;">' . $this->l('Add pre-defined values first') . '</a></span>';
                    }
                    echo '
						</td>
						<td style="width:40%" class="translatable">';
                    $tab_customs = $custom ? FeatureValue::getFeatureValueLang($current_item) : array();
                    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="custom_' . $tab_features['id_feature'] . '_" name="custom_' . $tab_features['id_feature'] . '_' . $language['id_lang'] . '" cols="40" rows="1"
									onkeyup="if (isArrowKey(event)) return ;$(\'#feature_' . $tab_features['id_feature'] . '_value\').val(0);" >' . htmlentities(Tools::getValue('custom_' . $tab_features['id_feature'] . '_' . $language['id_lang'], FeatureValue::selectLang($tab_customs, $language['id_lang'])), ENT_COMPAT, 'UTF-8') . '</textarea>
							</div>';
                    }
                    echo '
						</td>
					</tr>';
                }
                echo '
				<tr>
					<td style="height: 50px; text-align: center;" colspan="3"><input type="submit" name="submitProductFeature" id="submitProductFeature" value="' . $this->l('Save modifications') . '" class="button" /></td>
				</tr>';
            }
            echo '</table>
			<hr style="width:100%;" />
			<div style="text-align:center;">
				<a href="index.php?tab=AdminFeatures&addfeature&token=' . Tools::getAdminToken('AdminFeatures' . (int) Tab::getIdFromClassName('AdminFeatures') . (int) $cookie->id_employee) . '" onclick="return confirm(\'' . $this->l('You will lose all modifications not saved, you may want to save modifications first?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="new_features" title="' . $this->l('Add a new feature') . '" />&nbsp;' . $this->l('Add a new feature') . '</a>
			</div>';
        } else {
            echo '<b>' . $this->l('You must save this product before adding features') . '.</b>';
        }
    }