当前位置: 首页>>代码示例>>PHP>>正文


PHP FeatureValue::getFeatureValuesWithLang方法代码示例

本文整理汇总了PHP中FeatureValue::getFeatureValuesWithLang方法的典型用法代码示例。如果您正苦于以下问题:PHP FeatureValue::getFeatureValuesWithLang方法的具体用法?PHP FeatureValue::getFeatureValuesWithLang怎么用?PHP FeatureValue::getFeatureValuesWithLang使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FeatureValue的用法示例。


在下文中一共展示了FeatureValue::getFeatureValuesWithLang方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderForm

 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();
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:27,代码来源:AdminSpecificPriceRuleController.php

示例2: 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();
    }
开发者ID:hantonius,项目名称:advancedfeaturesvalues,代码行数:50,代码来源:AdminProductsController.php

示例3: displayFormFeatures


//.........这里部分代码省略.........
				        <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;
开发者ID:bobi,项目名称:prestashop-grouped-features,代码行数:67,代码来源:AdminProductsExFeatures.php

示例4: 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: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">---&nbsp;</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 ? '...' : '') . '&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: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') . '" />&nbsp;' . $this->l('Create new features') . '</a>
			</div>';
        } else {
            echo '<b>' . $this->l('You must save this product before adding features') . '.</b>';
        }
    }
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:94,代码来源:AdminProducts.php

示例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">---&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>';
        }
    }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:98,代码来源:AdminProducts.php

示例6: displayList

    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>&nbsp;
						<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>&nbsp;
					<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();
    }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:63,代码来源:AdminFeatures.php

示例7: 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"] . "&curren;";
     }
     self::$smarty->assign(array("available_features_all" => ${$fotyrrre}, "available_features" => ${${"GLOBALS"}["pihske"]}));
 }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:52,代码来源:sellerproductdetailbase.php

示例8: getProductByFilters

    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 ';
//.........这里部分代码省略.........
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:101,代码来源:blocklayered.php

示例9: processSave

    /**
     * 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;
    }
开发者ID:Rohit-jn,项目名称:hotelcommerce,代码行数:51,代码来源:AdminFeaturesController.php

示例10: 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();
 }
开发者ID:jicheng17,项目名称:vipinsg,代码行数:44,代码来源:AdminProductsController.php

示例11: displayList


//.........这里部分代码省略.........
').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');
开发者ID:bobi,项目名称:prestashop-grouped-features,代码行数:67,代码来源:AdminExFeatures.php


注:本文中的FeatureValue::getFeatureValuesWithLang方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。