public function renderForm() { if (!$this->object->id) { $this->object->price = -1; } $this->fields_form = array('legend' => array('title' => $this->l('Catalog price rules'), 'icon' => 'icon-dollar'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'maxlength' => 32, 'required' => true, 'hint' => $this->l('Forbidden characters') . ' <>;=#{}'), array('type' => 'select', 'label' => $this->l('Shop'), 'name' => 'shop_id', 'options' => array('query' => Shop::getShops(), 'id' => 'id_shop', 'name' => 'name'), 'condition' => Shop::isFeatureActive(), 'default_value' => Shop::getContextShopID()), array('type' => 'select', 'label' => $this->l('Currency'), 'name' => 'id_currency', 'options' => array('query' => array_merge(array(0 => array('id_currency' => 0, 'name' => $this->l('All currencies'))), Currency::getCurrencies()), 'id' => 'id_currency', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'options' => array('query' => array_merge(array(0 => array('id_country' => 0, 'name' => $this->l('All countries'))), Country::getCountries((int) $this->context->language->id)), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Group'), 'name' => 'id_group', 'options' => array('query' => array_merge(array(0 => array('id_group' => 0, 'name' => $this->l('All groups'))), Group::getGroups((int) $this->context->language->id)), 'id' => 'id_group', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('From quantity'), 'name' => 'from_quantity', 'maxlength' => 10, 'required' => true), array('type' => 'text', 'label' => $this->l('Price (tax excl.)'), 'name' => 'price', 'disabled' => $this->object->price == -1 ? 1 : 0, 'maxlength' => 10, 'suffix' => $this->context->currency->getSign('right')), array('type' => 'checkbox', 'name' => 'leave_bprice', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->l('Leave base price'), 'val' => '1', 'checked' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'datetime', 'label' => $this->l('From'), 'name' => 'from'), array('type' => 'datetime', 'label' => $this->l('To'), 'name' => 'to'), array('type' => 'select', 'label' => $this->l('Reduction type'), 'name' => 'reduction_type', 'options' => array('query' => array(array('reduction_type' => 'amount', 'name' => $this->l('Amount')), array('reduction_type' => 'percentage', 'name' => $this->l('Percentage'))), 'id' => 'reduction_type', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Reduction with or without taxes'), 'name' => 'reduction_tax', 'align' => 'center', 'options' => array('query' => array(array('lab' => $this->l('Tax included'), 'val' => 1), array('lab' => $this->l('Tax excluded'), 'val' => 0)), 'id' => 'val', 'name' => 'lab')), array('type' => 'text', 'label' => $this->l('Reduction'), 'name' => 'reduction', 'required' => true)), 'submit' => array('title' => $this->l('Save'))); if (($value = $this->getFieldValue($this->object, 'price')) != -1) { $price = number_format($value, 6); } else { $price = ''; } $this->fields_value = array('price' => $price, 'from_quantity' => ($value = $this->getFieldValue($this->object, 'from_quantity')) ? $value : 1, 'reduction' => number_format(($value = $this->getFieldValue($this->object, 'reduction')) ? $value : 0, 6), 'leave_bprice_on' => $price ? 0 : 1); $attribute_groups = array(); $attributes = Attribute::getAttributes((int) $this->context->language->id); foreach ($attributes as $attribute) { if (!isset($attribute_groups[$attribute['id_attribute_group']])) { $attribute_groups[$attribute['id_attribute_group']] = array('id_attribute_group' => $attribute['id_attribute_group'], 'name' => $attribute['attribute_group']); } $attribute_groups[$attribute['id_attribute_group']]['attributes'][] = array('id_attribute' => $attribute['id_attribute'], 'name' => $attribute['name']); } $features = Feature::getFeatures((int) $this->context->language->id); foreach ($features as &$feature) { $feature['values'] = FeatureValue::getFeatureValuesWithLang((int) $this->context->language->id, $feature['id_feature'], true); } $this->tpl_form_vars = array('manufacturers' => Manufacturer::getManufacturers(), 'suppliers' => Supplier::getSuppliers(), 'attributes_group' => $attribute_groups, 'features' => $features, 'categories' => Category::getSimpleCategories((int) $this->context->language->id), 'conditions' => $this->object->getConditions(), 'is_multishop' => Shop::isFeatureActive()); return parent::renderForm(); }
public function initFormFeatures($obj) { if (!$this->default_form_language) { $this->getLanguages(); } $tpl_path = _PS_MODULE_DIR_ . 'advancedfeaturesvalues/views/templates/admin/products/features.tpl'; $data = $this->context->smarty->createTemplate($tpl_path, $this->context->smarty); $data->assign('default_form_language', $this->default_form_language); $data->assign('languages', $this->_languages); if (!Feature::isFeatureActive()) { $this->displayWarning($this->l('This feature has been disabled. ') . ' <a href="index.php?tab=AdminPerformance&token=' . Tools::getAdminTokenLite('AdminPerformance') . '#featuresDetachables">' . $this->l('Performances') . '</a>'); } else { if ($obj->id) { if ($this->product_exists_in_shop) { $features = Feature::getFeatures($this->context->language->id, Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP); foreach ($features as $k => $tab_features) { $features[$k]['current_item'] = array(); $features[$k]['val'] = array(); $custom = true; foreach ($obj->getFeatures() as $tab_products) { if ($tab_products['id_feature'] == $tab_features['id_feature']) { $features[$k]['current_item'][] = $tab_products['id_feature_value']; } } $features[$k]['featureValues'] = FeatureValue::getFeatureValuesWithLang($this->context->language->id, (int) $tab_features['id_feature']); if (count($features[$k]['featureValues'])) { foreach ($features[$k]['featureValues'] as $value) { if (in_array($value['id_feature_value'], $features[$k]['current_item'])) { $custom = false; } } } if ($custom && !empty($features[$k]['current_item'])) { $features[$k]['val'] = FeatureValue::getFeatureValueLang($features[$k]['current_item'][0]); } } $data->assign('available_features', $features); $data->assign('product', $obj); $data->assign('link', $this->context->link); $data->assign('default_form_language', $this->default_form_language); } else { $this->displayWarning($this->l('You must save the product in this shop before adding features.')); } } else { $this->displayWarning($this->l('You must save this product before adding features.')); } } $this->tpl_form_vars['custom_form'] = $data->fetch(); }
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">--- </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 ? '...' : '') . ' </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'); ?> " /> <?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:764px;" /><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">--- </option>'; $feature_values = FeatureValue::getFeatureValuesWithLang(intval($cookie->id_lang), $tab_features['id_feature']); if (sizeof($feature_values)) { foreach ($feature_values as $tab_values) { if (!$tab_values['custom']) { echo '<option value="' . $tab_values['id_feature_value'] . '"' . ($current_item == $tab_values['id_feature_value'] ? ' selected="selected"' : '') . '>' . substr($tab_values['value'], 0, 40) . (Tools::strlen($tab_values['value']) > 40 ? '...' : '') . ' </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> </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:764px;" /> <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') . '" /> ' . $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">--- </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 ? '...' : '') . ' </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') . '" /> ' . $this->l('Add a new feature') . '</a> </div>'; } else { echo '<b>' . $this->l('You must save this product before adding features') . '.</b>'; } }
public function displayList() { global $currentIndex; echo '<br /> <a href="' . $currentIndex . '&add' . $this->table . '&token=' . $this->token . '"><img src="../img/admin/add.gif" border="0" /> <b>' . $this->l('Add a new feature') . '</b></a><br /> <a href="' . $currentIndex . '&addfeature_value&token=' . $this->token . '"><img src="../img/admin/add.gif" border="0" /> ' . $this->l('Add a new feature value') . '</a><br /><br /> ' . $this->l('Click on a feature name to view its values and then click again if you want to hide them.') . '<br /><br />'; $this->displayListHeader(); echo '<input type="hidden" name="groupid" value="0">'; if (!sizeof($this->_list)) { echo '<tr><td class="center" colspan="' . sizeof($this->_list) . '">' . $this->l('No features found.') . '</td></tr>'; } $irow = 0; foreach ($this->_list as $tr) { $id = (int) $tr['id_' . $this->table]; echo ' <tr' . ($irow++ % 2 ? ' class="alt_row"' : '') . '> <td style="vertical-align: top; padding: 4px 0 4px 0" class="center"><input type="checkbox" name="' . $this->table . 'Box[]" value="' . $id . '" class="noborder" /></td> <td style="width: 140px; vertical-align: top; padding: 4px 0 4px 0; cursor: pointer" onclick="$(\'#features_values_' . $id . '\').slideToggle();">' . $tr['name'] . '</td> <td style="vertical-align: top; padding: 4px 0 4px 0; width: 340px"> <div id="features_values_' . $id . '" style="display: none"> <table class="table" cellpadding="0" cellspacing="0"> <tr> <th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'feature_value' . $id . 'Box[]\', this.checked)" /></th> <th width="100%">' . $this->l('Value') . '</th> <th>' . $this->l('Actions') . '</th> </tr>'; $features = FeatureValue::getFeatureValuesWithLang((int) Configuration::get('PS_LANG_DEFAULT'), $id); foreach ($features as $feature) { echo ' <tr> <td class="center"><input type="checkbox" name="feature_value' . $id . 'Box[]" value="' . $feature['id_feature_value'] . '" class="noborder" /></td> <td>' . $feature['value'] . '</td> <td class="center"> <a href="' . $currentIndex . '&id_feature_value=' . $feature['id_feature_value'] . '&updatefeature_value&token=' . $this->token . '"> <img src="../img/admin/edit.gif" border="0" alt="' . $this->l('Edit') . '" title="' . $this->l('Edit') . '" /></a> <a href="' . $currentIndex . '&id_feature_value=' . $feature['id_feature_value'] . '&deletefeature_value&token=' . $this->token . '" onclick="return confirm(\'' . $this->l('Delete value', __CLASS__, true, false) . ' #' . $feature['id_feature_value'] . '?\');"> <img src="../img/admin/delete.gif" border="0" alt="' . $this->l('Delete') . '" title="' . $this->l('Delete') . '" /></a> </td> </tr>'; } if (!sizeof($features)) { echo ' <tr><td colspan="3" style="text-align:center">' . $this->l('No values defined') . '</td></tr>'; } echo ' </table> <p><input type="Submit" class="button" name="submitDelfeature_value" value="' . $this->l('Delete selection') . '" onclick="changeFormParam(this.form, \'?tab=AdminFeatures\', ' . $id . '); return confirm(\'' . $this->l('Delete selected items?', __CLASS__, true, false) . '\');" /></p> </div> </td>'; echo ' <td style="vertical-align: top; padding: 4px 0 4px 0" class="center"> <a href="' . $currentIndex . '&id_' . $this->table . '=' . $id . '&update' . $this->table . '&token=' . $this->token . '"> <img src="../img/admin/edit.gif" border="0" alt="' . $this->l('Edit') . '" title="' . $this->l('Edit') . '" /></a> <a href="' . $currentIndex . '&id_' . $this->table . '=' . $id . '&delete' . $this->table . '&token=' . $this->token . '" onclick="return confirm(\'' . $this->l('Delete item', __CLASS__, true, false) . ' #' . $id . '?\');"> <img src="../img/admin/delete.gif" border="0" alt="' . $this->l('Delete') . '" title="' . $this->l('Delete') . '" /></a> </td> </tr>'; } $this->displayListFooter(); }
private function initContentForFeatures() { $tlwvvxr = "features"; ${"GLOBALS"}["pihske"] = "features"; $jxbahojyvlt = "available_features_all"; $fotyrrre = "available_features_all"; $lueyeppw = "features"; ${"GLOBALS"}["iavdbtipeie"] = "tab_features"; ${$lueyeppw} = Feature::getFeatures($this->id_language); foreach (${$tlwvvxr} as ${${"GLOBALS"}["qtxqhylrbsm"]} => ${${"GLOBALS"}["iavdbtipeie"]}) { ${"GLOBALS"}["ringgeomwho"] = "tab_products"; $oovownr = "k"; $dibecrefieyf = "k"; ${"GLOBALS"}["llnriurbfb"] = "features"; ${"GLOBALS"}["krrouj"] = "k"; ${"GLOBALS"}["ezrxbtdf"] = "features"; ${${"GLOBALS"}["nrjxzlhiqjg"]}[${${"GLOBALS"}["krrouj"]}]["current_item"] = false; ${${"GLOBALS"}["nrjxzlhiqjg"]}[${$dibecrefieyf}]["val"] = array(); ${${"GLOBALS"}["vwmhyvovziq"]} = true; foreach ($this->object->getFeatures() as ${${"GLOBALS"}["ringgeomwho"]}) { $hozllwqodl = "features"; $koyfxiz = "k"; ${"GLOBALS"}["hkqtkv"] = "tab_products"; ${"GLOBALS"}["icrwrssx"] = "tab_products"; $wbqcupctp = "tab_features"; if (${${"GLOBALS"}["hkqtkv"]}["id_feature"] == ${$wbqcupctp}["id_feature"]) { ${$hozllwqodl}[${$koyfxiz}]["current_item"] = ${${"GLOBALS"}["icrwrssx"]}["id_feature_value"]; } } ${${"GLOBALS"}["nrjxzlhiqjg"]}[${${"GLOBALS"}["qtxqhylrbsm"]}]["featureValues"] = FeatureValue::getFeatureValuesWithLang($this->id_language, (int) ${${"GLOBALS"}["kowgsfpm"]}["id_feature"]); if (count(${${"GLOBALS"}["nrjxzlhiqjg"]}[${$oovownr}]["featureValues"])) { $gtmlwoq = "features"; $ryjttmtpvt = "k"; foreach (${$gtmlwoq}[${$ryjttmtpvt}]["featureValues"] as ${${"GLOBALS"}["kzwkbwmzgtl"]}) { $rtsfkxsq = "features"; $tduybwwrxb = "value"; if (${$rtsfkxsq}[${${"GLOBALS"}["qtxqhylrbsm"]}]["current_item"] == ${$tduybwwrxb}["id_feature_value"]) { ${${"GLOBALS"}["vwmhyvovziq"]} = false; } } } if (${${"GLOBALS"}["vwmhyvovziq"]}) { ${${"GLOBALS"}["llnriurbfb"]}[${${"GLOBALS"}["qtxqhylrbsm"]}]["val"] = FeatureValue::getFeatureValueLang(${${"GLOBALS"}["ezrxbtdf"]}[${${"GLOBALS"}["qtxqhylrbsm"]}]["current_item"]); } } ${$jxbahojyvlt} = ""; foreach (${${"GLOBALS"}["nrjxzlhiqjg"]} as ${${"GLOBALS"}["jtsfpdcbh"]}) { ${"GLOBALS"}["tpyuivnp"] = "available_features_all"; ${${"GLOBALS"}["mogxjutudv"]} = ${${"GLOBALS"}["tpyuivnp"]} . "custom_" . ${${"GLOBALS"}["jtsfpdcbh"]}["id_feature"] . "¤"; } self::$smarty->assign(array("available_features_all" => ${$fotyrrre}, "available_features" => ${${"GLOBALS"}["pihske"]})); }
public function getProductByFilters($selected_filters = array()) { global $cookie; if (!empty($this->products)) { return $this->products; } $home_category = Configuration::get('PS_HOME_CATEGORY'); /* If the current category isn't defined or if it's homepage, we have nothing to display */ $id_parent = (int) Tools::getValue('id_category', Tools::getValue('id_category_layered', $home_category)); if ($id_parent == $home_category) { return false; } $alias_where = 'p'; if (version_compare(_PS_VERSION_, '1.5', '>')) { $alias_where = 'product_shop'; } $query_filters_where = ' AND ' . $alias_where . '.`active` = 1 AND ' . $alias_where . '.`visibility` IN ("both", "catalog")'; $query_filters_from = ''; $parent = new Category((int) $id_parent); if (!count($selected_filters['category'])) { if (Configuration::get('PS_LAYERED_FULL_TREE')) { $query_filters_from .= ' INNER JOIN ' . _DB_PREFIX_ . 'category_product cp ON p.id_product = cp.id_product INNER JOIN ' . _DB_PREFIX_ . 'category c ON (c.id_category = cp.id_category AND c.nleft >= ' . (int) $parent->nleft . ' AND c.nright <= ' . (int) $parent->nright . ' AND c.active = 1) RIGHT JOIN ' . _DB_PREFIX_ . 'layered_category lc ON (lc.id_category = ' . (int) $id_parent . ' AND lc.id_shop = ' . (int) Context::getContext()->shop->id . ')'; } else { $query_filters_from .= ' INNER JOIN ' . _DB_PREFIX_ . 'category_product cp ON p.id_product = cp.id_product INNER JOIN ' . _DB_PREFIX_ . 'category c ON (c.id_category = cp.id_category AND c.id_category = ' . (int) $id_parent . ' AND c.active = 1)'; } } foreach ($selected_filters as $key => $filter_values) { if (!count($filter_values)) { continue; } $key_start = $key; preg_match('/^(.*[^_0-9])/', $key, $res); $key = $res[1]; switch ($key) { case 'id_feature': $key_start = explode('id_feature_', $key_start); if (count($key_start) == 1) { $sub_queries = array(); foreach ($filter_values as $filter_value) { $filter_value_array = explode('_', $filter_value); if (!isset($sub_queries[$filter_value_array[0]])) { $sub_queries[$filter_value_array[0]] = array(); } $sub_queries[$filter_value_array[0]][] = 'fp.`id_feature_value` = ' . (int) $filter_value_array[1]; } foreach ($sub_queries as $sub_query) { $query_filters_where .= ' AND p.id_product IN (SELECT `id_product` FROM `' . _DB_PREFIX_ . 'feature_product` fp WHERE '; $query_filters_where .= implode(' OR ', $sub_query) . ') '; } } else { if (count($key_start) == 2) { $id_feature = $key_start[1]; $f_values = FeatureValue::getFeatureValuesWithLang(1, $id_feature); $f_values_in = array(); foreach ($f_values as $feature_value) { if ((double) $feature_value['value'] >= (double) $filter_values[0] && (double) $feature_value['value'] <= (double) $filter_values[1]) { $f_values_in[] = $feature_value['id_feature_value']; } } $f_values_in = array_unique($f_values_in); $sub_queries = array(); foreach ($f_values_in as $f_value) { $sub_queries[$id_feature][] = 'fp.`id_feature_value` = ' . (int) $f_value; } foreach ($sub_queries as $sub_query) { $query_filters_where .= ' AND p.id_product IN (SELECT `id_product` FROM `' . _DB_PREFIX_ . 'feature_product` fp WHERE '; $query_filters_where .= implode(' OR ', $sub_query) . ') '; } } } break; case 'id_attribute_group': $sub_queries = array(); foreach ($filter_values as $filter_value) { $filter_value_array = explode('_', $filter_value); if (!isset($sub_queries[$filter_value_array[0]])) { $sub_queries[$filter_value_array[0]] = array(); } $sub_queries[$filter_value_array[0]][] = 'pac.`id_attribute` = ' . (int) $filter_value_array[1]; } foreach ($sub_queries as $sub_query) { $query_filters_where .= ' AND p.id_product IN (SELECT pa.`id_product` FROM `' . _DB_PREFIX_ . 'product_attribute_combination` pac LEFT JOIN `' . _DB_PREFIX_ . 'product_attribute` pa ON (pa.`id_product_attribute` = pac.`id_product_attribute`)' . Shop::addSqlAssociation('product_attribute', 'pa') . ' WHERE ' . implode(' OR ', $sub_query) . ') '; } break; case 'category': $query_filters_where .= ' AND p.id_product IN (SELECT id_product FROM ' . _DB_PREFIX_ . 'category_product cp WHERE '; foreach ($selected_filters['category'] as $id_category) { $query_filters_where .= 'cp.`id_category` = ' . (int) $id_category . ' OR '; } $query_filters_where = rtrim($query_filters_where, 'OR ') . ')'; break; case 'quantity': if (count($selected_filters['quantity']) == 2) { break; } $query_filters_where .= ' AND sa.quantity ' . (!$selected_filters['quantity'][0] ? '<=' : '>') . ' 0 '; $query_filters_from .= 'LEFT JOIN `' . _DB_PREFIX_ . 'stock_available` sa ON (sa.id_product = p.id_product AND sa.id_shop = ' . (int) Context::getContext()->shop->id . ') '; break; case 'manufacturer': $query_filters_where .= ' AND p.id_manufacturer IN (' . implode($selected_filters['manufacturer'], ',') . ')'; break; case 'condition': if (count($selected_filters['condition']) == 3) { break; } $query_filters_where .= ' AND ' . $alias_where . '.condition IN ('; foreach ($selected_filters['condition'] as $cond) { $query_filters_where .= '\'' . $cond . '\','; } $query_filters_where = rtrim($query_filters_where, ',') . ')'; break; case 'weight': if ($selected_filters['weight'][0] != 0 || $selected_filters['weight'][1] != 0) { $query_filters_where .= ' AND p.`weight` BETWEEN ' . (double) ($selected_filters['weight'][0] - 0.001) . ' AND ' . (double) ($selected_filters['weight'][1] + 0.001); } break; case 'price': if (isset($selected_filters['price'])) { if ($selected_filters['price'][0] !== '' || $selected_filters['price'][1] !== '') { $price_filter = array(); $price_filter['min'] = (double) $selected_filters['price'][0]; $price_filter['max'] = (double) $selected_filters['price'][1]; } } else { $price_filter = false; } break; } } $id_currency = (int) Context::getContext()->currency->id; $price_filter_query_in = ''; // All products with price range between price filters limits $price_filter_query_out = ''; // All products with a price filters limit on it price range if (isset($price_filter) && $price_filter) { $price_filter_query_in = 'INNER JOIN `' . _DB_PREFIX_ . 'layered_price_index` psi ON ( psi.price_min >= ' . (int) $price_filter['min'] . ' AND psi.price_max <= ' . (int) $price_filter['max'] . ' AND psi.`id_product` = p.`id_product` AND psi.`id_currency` = ' . $id_currency . ' )'; $price_filter_query_out = 'INNER JOIN `' . _DB_PREFIX_ . 'layered_price_index` psi ON ((psi.price_min < ' . (int) $price_filter['min'] . ' AND psi.price_max > ' . (int) $price_filter['min'] . ') OR (psi.price_max > ' . (int) $price_filter['max'] . ' AND psi.price_min < ' . (int) $price_filter['max'] . ')) AND psi.`id_product` = p.`id_product` AND psi.`id_currency` = ' . $id_currency; } $query_filters_from .= Shop::addSqlAssociation('product', 'p'); $all_products_out = self::query(' SELECT p.`id_product` id_product FROM `' . _DB_PREFIX_ . 'product` p ' . $price_filter_query_out . ' ' . $query_filters_from . ' WHERE 1 ' . $query_filters_where . ' GROUP BY id_product'); $all_products_in = self::query(' SELECT p.`id_product` id_product FROM `' . _DB_PREFIX_ . 'product` p ' . $price_filter_query_in . ' ' . $query_filters_from . ' WHERE 1 ' . $query_filters_where . ' GROUP BY id_product'); $product_id_list = array(); while ($product = DB::getInstance()->nextRow($all_products_in)) { $product_id_list[] = (int) $product['id_product']; } while ($product = DB::getInstance()->nextRow($all_products_out)) { if (isset($price_filter) && $price_filter) { $price = (int) Product::getPriceStatic($product['id_product'], Configuration::get('PS_LAYERED_FILTER_PRICE_USETAX')); // Cast to int because we don't care about cents if ($price < $price_filter['min'] || $price > $price_filter['max']) { continue; } $product_id_list[] = (int) $product['id_product']; } } $this->nbr_products = count($product_id_list); if ($this->nbr_products == 0) { $this->products = array(); } else { $n = (int) Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE')); $nb_day_new_product = Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20; $this->products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT p.*, ' . ($alias_where == 'p' ? '' : 'product_shop.*,') . ' ' . $alias_where . '.id_category_default, pl.*, MAX(image_shop.`id_image`) id_image, il.legend, m.name manufacturer_name, MAX(product_attribute_shop.id_product_attribute) id_product_attribute, DATEDIFF(' . $alias_where . '.`date_add`, DATE_SUB(NOW(), INTERVAL ' . (int) $nb_day_new_product . ' DAY)) > 0 AS new, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity FROM `' . _DB_PREFIX_ . 'category_product` cp LEFT JOIN ' . _DB_PREFIX_ . 'category c ON (c.id_category = cp.id_category) LEFT JOIN `' . _DB_PREFIX_ . 'product` p ON p.`id_product` = cp.`id_product` ' . Shop::addSqlAssociation('product', 'p') . ' ' . Product::sqlStock('p', null, false, Context::getContext()->shop) . ' LEFT JOIN ' . _DB_PREFIX_ . 'product_lang pl ON (pl.id_product = p.id_product' . Shop::addSqlRestrictionOnLang('pl') . ' AND pl.id_lang = ' . (int) $cookie->id_lang . ') LEFT JOIN `' . _DB_PREFIX_ . 'image` i ON (i.`id_product` = p.`id_product`)' . Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1') . ' LEFT JOIN `' . _DB_PREFIX_ . 'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = ' . (int) $cookie->id_lang . ') LEFT JOIN ' . _DB_PREFIX_ . 'manufacturer m ON (m.id_manufacturer = p.id_manufacturer) LEFT JOIN ' . _DB_PREFIX_ . 'product_attribute pa ON (p.id_product = pa.id_product)' . Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.`default_on` = 1') . ' WHERE ' . $alias_where . '.`active` = 1 AND ' . $alias_where . '.`visibility` IN ("both", "catalog") AND ' . (Configuration::get('PS_LAYERED_FULL_TREE') ? 'c.nleft >= ' . (int) $parent->nleft . ' AND c.nright <= ' . (int) $parent->nright : 'c.id_category = ' . (int) $id_parent) . ' AND c.active = 1 AND p.id_product IN (' . implode(',', $product_id_list) . ') GROUP BY product_shop.id_product ORDER BY `quantity` DESC, ' . Tools::getProductsOrder('by', Tools::getValue('orderby'), true) . ' ' . Tools::getProductsOrder('way', Tools::getValue('orderway')) . ' LIMIT ' . (((int) $this->page - 1) * $n . ',' . $n)); } if (Tools::getProductsOrder('by', Tools::getValue('orderby'), true) == 'p.price') { Tools::orderbyPrice($this->products, Tools::getProductsOrder('way', Tools::getValue('orderway'))); } return $this->products; }
/** * Call the right method for creating or updating object * * @return mixed */ public function processSave() { if ($this->table == 'feature') { $id_feature = (int) Tools::getValue('id_feature'); // Adding last position to the feature if not exist if ($id_feature <= 0) { $sql = 'SELECT `position`+1 FROM `' . _DB_PREFIX_ . 'feature` ORDER BY position DESC'; // set the position of the new feature in $_POST for postProcess() method $_POST['position'] = DB::getInstance()->getValue($sql); } // clean \n\r characters foreach ($_POST as $key => $value) { if (preg_match('/^name_/Ui', $key)) { $_POST[$key] = str_replace('\\n', '', str_replace('\\r', '', $value)); } } //by webkul to save image of feature with feature name $obj_feature = parent::processSave(); $feature_values = FeatureValue::getFeatureValuesWithLang(1, $obj_feature->id); if ($feature_values) { $obj_feature_value = new FeatureValue($feature_values[0]['id_feature_value']); } else { $obj_feature_value = new FeatureValue(); } //validate feature image if (isset($_FILES['logo'])) { $this->validAddFeatureImage($_FILES['logo']); } $img_path = _PS_IMG_DIR_ . 'rf/' . $obj_feature->id . '.png'; if (isset($_FILES['logo'])) { $current_file = _PS_TMP_IMG_DIR_ . 'feature_mini_' . $obj_feature->id . '_' . $this->context->shop->id . '.png'; if (file_exists($current_file)) { unlink($current_file); } $this->uploadFeatureImage($_FILES['logo'], $img_path); } $obj_feature_value->id_feature = $obj_feature->id; foreach (Language::getLanguages(true) as $lang) { $obj_feature_value->value[$lang['id_lang']] = $obj_feature->id . '.png'; } $obj_feature_value->save(); } return $obj_feature; }
public function initFormFeatures($obj) { $data = $this->createTemplate($this->tpl_form); if (!Feature::isFeatureActive()) { $this->displayWarning($this->l('This feature has been disabled, you can active this feature at this page:') . ' <a href="index.php?tab=AdminPerformance&token=' . Tools::getAdminTokenLite('AdminPerformance') . '#featuresDetachables">' . $this->l('Performances') . '</a>'); } else { if ($obj->id) { if ($this->product_exists_in_shop) { $features = Feature::getFeatures($this->context->language->id); foreach ($features as $k => $tab_features) { $features[$k]['current_item'] = false; $features[$k]['val'] = array(); $custom = true; foreach ($obj->getFeatures() as $tab_products) { if ($tab_products['id_feature'] == $tab_features['id_feature']) { $features[$k]['current_item'] = $tab_products['id_feature_value']; } } $features[$k]['featureValues'] = FeatureValue::getFeatureValuesWithLang($this->context->language->id, (int) $tab_features['id_feature']); if (count($features[$k]['featureValues'])) { foreach ($features[$k]['featureValues'] as $value) { if ($features[$k]['current_item'] == $value['id_feature_value']) { $custom = false; } } } if ($custom) { $features[$k]['val'] = FeatureValue::getFeatureValueLang($features[$k]['current_item']); } } $data->assign('available_features', $features); $data->assign('product', $obj); $data->assign('link', $this->context->link); $data->assign('languages', $this->_languages); $data->assign('default_form_language', $this->default_form_language); } else { $this->displayWarning($this->l('You must save this product in this shop before adding features.')); } } else { $this->displayWarning($this->l('You must save this product before adding features.')); } } $this->tpl_form_vars['custom_form'] = $data->fetch(); }
public function displayList() { global $currentIndex, $cookie; ?> <h2><?php echo $this->adminFeaturesGroups->loadObject()->name[$cookie->id_lang]; ?> </h2> <br /> <a href="<?php echo $currentIndex; ?> &add<?php echo $this->table . ($this->id_group ? '&id_group=' . $this->id_group : ''); ?> &token=<?php echo $this->token; ?> "> <img src="../img/admin/add.gif" border="0" /> <b><?php echo $this->l('Add feature', __CLASS__); ?> </b> </a><br /> <a href="<?php echo $currentIndex; ?> &reorderpositions=1<?php echo $this->id_group ? '&id_group=' . $this->id_group : ''; ?> &token=<?php echo $this->token; ?> "> <img src="../img/admin/add.gif" border="0" /> <b><?php echo $this->l('Reorder position', __CLASS__); ?> </b> </a><br /> <a href="<?php echo $currentIndex; ?> &addfeature_value&token=<?php echo $this->token; ?> "> <img src="../img/admin/add.gif" border="0" /> <?php echo $this->l('Add feature value', __CLASS__); ?> </a><br /><br /> <?php echo $this->l('Click on the feature name to view its values. Click again to hide them', __CLASS__); ?> <br /><br /> <script type="text/javascript" src="../js/jquery/jquery.tablednd_0_5.js"></script> <script type="text/javascript"> var token = '<?php echo $this->token; ?> '; var come_from = '<?php echo $this->table; ?> '; var alternate = '<?php echo $this->_orderWay == 'DESC' ? '1' : '0'; ?> '; </script> <script type="text/javascript" src="../js/admin-dnd.js"></script> <?php echo $this->displayListHeader(); ?> <input type="hidden" name="id_group" value="<?php echo intval(Tools::getValue("id_group")); ?> " /> <input type="hidden" name="groupid" value="0" /> <?php if (!sizeof($this->_list)) { ?> <tr><td class="center" colspan="<?php echo sizeof($this->_list); ?> "><?php echo $this->l('No features found', __CLASS__); ?> </td></tr> <?php } ?> <?php $irow = 0; foreach ($this->_list as $tr) { $id = intval($tr['id_' . $this->table]); ?> <tr<?php echo $irow++ % 2 ? ' class="alt_row"' : ''; ?> > <td style="vertical-align: top; padding: 4px 0 4px 0" class="center"> <input type="checkbox" name="<?php echo $this->table; ?> Box[]" value="<?php echo $id; ?> " class="noborder" /> </td> <td style="width: 140px; vertical-align: top; padding: 4px 0 4px 0; cursor: pointer" onclick="$('#features_values_<?php echo $id; ?> ').slideToggle();"> <?php echo $tr['name']; ?> </td> <td style="vertical-align: top; padding: 4px 0 4px 0; width: 340px"> <div id="features_values_<?php echo $id; ?> " style="display: <?php echo $this->id_feature == $id && !Tools::getValue('upposition') && !Tools::getValue('downposition') ? "block" : "none"; ?> "> <table class="table" cellpadding="0" cellspacing="0"> <tr> <th> <input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, 'feature_value<?php echo $id; ?> Box[]', this.checked)" /> </th> <th width="100%"><?php echo $this->l('Value'); ?> </th> <th><?php echo $this->l('Actions'); ?> </th> </tr> <?php $features = FeatureValue::getFeatureValuesWithLang(intval(Configuration::get('PS_LANG_DEFAULT')), $id); foreach ($features as $feature) { ?> <tr> <td class="center"> <input type="checkbox" name="feature_value<?php echo $id; ?> Box[]" value="<?php echo $feature['id_feature_value']; ?> " class="noborder" /> </td> <td><?php echo $feature['value']; ?> </td> <td class="center"> <a href="<?php echo $currentIndex; ?> &id_feature_value=<?php echo $feature['id_feature_value']; ?> &updatefeature_value&token=<?php echo $this->token; ?> "> <img src="../img/admin/edit.gif" border="0" alt="<?php echo $this->l('Edit'); ?> " title="<?php echo $this->l('Edit'); ?> " /> </a> <a href="<?php echo $currentIndex; ?> &id_feature_value=<?php echo $feature['id_feature_value']; ?> &deletefeature_value&token=<?php echo $this->token; ?> " onclick="return confirm(\'<?php echo $this->l('Delete value', __CLASS__, true, false); ?> #<?php echo $feature['id_feature_value']; ?> ?\');"> <img src="../img/admin/delete.gif" border="0" alt="<?php echo $this->l('Delete'); ?> " title="<?php echo $this->l('Delete'); ?> " /> </a> </td> </tr> <?php } ?> <?php if (!sizeof($features)) { ?> <tr><td colspan="3" style="text-align:center"><?php echo $this->l('No values defined'); ?> </td></tr> <?php } ?> </table> <p> <a href="<?php echo $currentIndex; ?> &<?php echo $this->identifier; ?> =<?php echo $id; ?> &addfeature_value&token=<?php echo $this->token; ?> " class="button"><?php echo $this->l('Add new value', __CLASS__); ?> </a> <input type="Submit" class="button" name="submitDelfeature_value" value="<?php echo $this->l('Delete selection'); ?> " onclick="changeFormParam(this.form, '?tab=AdminExFeatures', <?php echo $id; ?> ); return confirm('<?php echo $this->l('Delete selected items?', __CLASS__, true, false); ?> ');" /> </p> </div> </td> <td style="width: 40px; vertical-align: top; padding: 4px 0 4px 0; cursor: pointer" onclick="$('#features_values_<?php echo $id; ?> ').slideToggle();"> <?php $tr['group_name']; ?> </td> <td class="pointer dragHandle center" id="td_<?php echo $tr["id_feature"]; ?> "> <?php if ($irow < count($this->_list)) { ?> <a href="<?php echo $currentIndex; ?> &id_feature=<?php echo $tr["id_feature"]; ?> &downposition=<?php echo $tr["f_position"]; ?> &id_group=<?php echo intval(Tools::getValue('id_group')); ?> &token=<?php echo $this->token; ?> "> <img title="Down" alt="Down" src="../img/admin/down.gif" /> </a> <?php } ?> <?php if ($irow > 1) { ?> <a href="<?php echo $currentIndex; ?> &id_feature=<?php echo $tr["id_feature"]; ?> &upposition=<?php echo $tr["f_position"]; ?> &id_group=<?php echo intval(Tools::getValue('id_group')); ?> &token=<?php echo $this->token; ?> " style=""> <img title="Up" alt="Up" src="../img/admin/up.gif" /> </a> <?php } ?> </td> <td style="vertical-align: top; padding: 4px 0 4px 0" class="center"> <a href="<?php echo $currentIndex; ?> &id_<?php echo $this->table; ?> =<?php echo $id; ?> &update<?php echo $this->table; ?> &token=<?php echo $this->token; ?> "> <img src="../img/admin/edit.gif" border="0" alt="<?php echo $this->l('Edit'); ?> " title="<?php echo $this->l('Edit'); ?> " /></a> <a href="<?php echo $currentIndex; ?> &id_<?php echo $this->table; ?> =<?php echo $id; ?> &delete<?php echo $this->table . ($this->id_group ? '&id_group=' . $this->id_group : ''); ?> &token=<?php echo $this->token; ?> " onclick="return confirm('<?php echo $this->l('Delete item', __CLASS__, true, false); ?> #<?php echo $id; ?> ?\');"> <img src="../img/admin/delete.gif" border="0" alt="<?php echo $this->l('Delete'); ?> " title="<?php echo $this->l('Delete'); ?> " /> </a> </td> </tr> <?php } ?> <?php $this->displayListFooter(); ?> <br /><br /> <a href="<?php echo $currentIndex; ?> &token=<?php echo $this->token; ?> "> <img src="../img/admin/arrow2.gif" /> <?php echo $this->l('Back to groups list', __CLASS__); ?> </a> <br /> <?php }