本文整理汇总了PHP中FeatureValue::getFeatureValueLang方法的典型用法代码示例。如果您正苦于以下问题:PHP FeatureValue::getFeatureValueLang方法的具体用法?PHP FeatureValue::getFeatureValueLang怎么用?PHP FeatureValue::getFeatureValueLang使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FeatureValue
的用法示例。
在下文中一共展示了FeatureValue::getFeatureValueLang方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initFormFeatures
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();
}
示例2: displayFormFeatures
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">--- </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 ? '...' : '') . ' </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: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') . '" /> ' . $this->l('Create new features') . '</a>
</div>';
} else {
echo '<b>' . $this->l('You must save this product before adding features') . '.</b>';
}
}
示例3: getFeatures
function getFeatures($prod_id)
{
$features = Product::getFeaturesStatic((int) $prod_id);
$params = array();
foreach ($features as $feature) {
$feature_name = Feature::getFeature($this->id_lang, $feature['id_feature']);
$feature_name = $feature_name['name'];
$feature_values = FeatureValue::getFeatureValueLang($feature['id_feature_value']);
$feature_value = null;
foreach ($feature_values as $f_value) {
$feature_value = $f_value['value'];
if ($f_value['id_lang'] == $this->id_lang) {
break;
}
}
if ($feature_value != null) {
$params[$feature_name] = $feature_value;
}
}
return $params;
}
示例4: displayFormFeatures
//.........这里部分代码省略.........
</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>';
}
}
示例5: displayFormFeatures
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>';
}
}
示例6: initContentForFeatures
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"]}));
}
示例7: initFormFeatures
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();
}