本文整理汇总了PHP中Feature::isFeatureActive方法的典型用法代码示例。如果您正苦于以下问题:PHP Feature::isFeatureActive方法的具体用法?PHP Feature::isFeatureActive怎么用?PHP Feature::isFeatureActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Feature
的用法示例。
在下文中一共展示了Feature::isFeatureActive方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initFieldsetFeaturesDetachables
public function initFieldsetFeaturesDetachables()
{
$this->fields_form[2]['form'] = array('legend' => array('title' => $this->l('Optional features'), 'icon' => 'icon-puzzle-piece'), 'description' => $this->l('Some features can be disabled in order to improve performance.'), 'input' => array(array('type' => 'hidden', 'name' => 'features_detachables_up'), array('type' => 'switch', 'label' => $this->l('Combinations'), 'name' => 'combination', 'is_bool' => true, 'disabled' => Combination::isCurrentlyUsed(), 'values' => array(array('id' => 'combination_1', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'combination_0', 'value' => 0, 'label' => $this->l('No'))), 'hint' => $this->l('Choose "No" to disable Product Combinations.'), 'desc' => Combination::isCurrentlyUsed() ? $this->l('You cannot set this parameter to No when combinations are already used by some of your products') : null), array('type' => 'switch', 'label' => $this->l('Features'), 'name' => 'feature', 'is_bool' => true, 'values' => array(array('id' => 'feature_1', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'feature_0', 'value' => 0, 'label' => $this->l('No'))), 'hint' => $this->l('Choose "No" to disable Product Features.')), array('type' => 'switch', 'label' => $this->l('Customer Groups'), 'name' => 'customer_group', 'is_bool' => true, 'disabled' => Group::isCurrentlyUsed(), 'values' => array(array('id' => 'group_1', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'group_0', 'value' => 0, 'label' => $this->l('No'))), 'hint' => $this->l('Choose "No" to disable Customer Groups.'))), 'submit' => array('title' => $this->l('Save')));
$this->fields_value['combination'] = Combination::isFeatureActive();
$this->fields_value['feature'] = Feature::isFeatureActive();
$this->fields_value['customer_group'] = Group::isFeatureActive();
}
示例2: processFeatures
public function processFeatures()
{
if (!Feature::isFeatureActive()) {
return;
}
if (Validate::isLoadedObject($product = new Product((int) Tools::getValue('id_product')))) {
// delete all objects
$product->deleteFeatures();
// add new objects
$languages = Language::getLanguages(false);
foreach ($_POST as $key => $val) {
if (preg_match('/^feature_([0-9]+)_value/i', $key, $match)) {
if (!empty($val)) {
foreach ($val as $v) {
$product->addFeaturesToDB($match[1], $v);
}
} else {
if ($default_value = $this->checkFeatures($languages, $match[1])) {
$id_value = $product->addFeaturesToDB($match[1], 0, 1);
foreach ($languages as $language) {
if ($cust = Tools::getValue('custom_' . $match[1] . '_' . (int) $language['id_lang'])) {
$product->addFeaturesCustomToDB($id_value, (int) $language['id_lang'], $cust);
} else {
$product->addFeaturesCustomToDB($id_value, (int) $language['id_lang'], $default_value);
}
}
}
}
}
}
} else {
$this->errors[] = Tools::displayError('A product must be created before adding features.');
}
}
示例3: getFrontFeaturesStatic
public static function getFrontFeaturesStatic($id_lang, $id_product)
{
if (!Feature::isFeatureActive()) {
return array();
}
if (!array_key_exists($id_product . '-' . $id_lang, self::$_frontFeaturesCache)) {
self::$_frontFeaturesCache[$id_product . '-' . $id_lang] = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT name, GROUP_CONCAT(value ORDER BY fv.position SEPARATOR ", ") AS value, pf.id_feature
FROM ' . _DB_PREFIX_ . 'feature_product pf
LEFT JOIN ' . _DB_PREFIX_ . 'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = ' . (int) $id_lang . ')
LEFT JOIN ' . _DB_PREFIX_ . 'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = ' . (int) $id_lang . ')
LEFT JOIN ' . _DB_PREFIX_ . 'feature f ON f.id_feature = pf.id_feature
LEFT JOIN ' . _DB_PREFIX_ . 'feature_value fv ON fv.id_feature_value = pf.id_feature_value
' . Shop::addSqlAssociation('feature', 'f') . '
WHERE pf.id_product = ' . (int) $id_product . '
GROUP BY name, pf.id_feature
ORDER BY f.position ASC');
}
return self::$_frontFeaturesCache[$id_product . '-' . $id_lang];
}
示例4: getFrontFeaturesStatic
public static function getFrontFeaturesStatic($id_lang, $id_product)
{
if (!Feature::isFeatureActive()) {
return array();
}
if (!array_key_exists($id_product . '-' . $id_lang, self::$_frontFeaturesCache)) {
if (Module::isInstalled('blocklayered') && Module::isEnabled('blocklayered')) {
Db::getInstance(_PS_USE_SQL_SLAVE_)->execute('SET @@group_concat_max_len = 4096');
self::$_frontFeaturesCache[$id_product . '-' . $id_lang] = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT `name`, GROUP_CONCAT(value ORDER BY `fv`.`position` SEPARATOR ", ") AS `value`, `pf`.`id_feature`, `liflv`.`url_name`, `liflv`.`meta_title`
FROM `' . _DB_PREFIX_ . 'feature_product` `pf`
LEFT JOIN `' . _DB_PREFIX_ . 'feature_lang` `fl` ON (`fl`.`id_feature` = `pf`.`id_feature` AND `fl`.`id_lang` = ' . (int) $id_lang . ')
LEFT JOIN `' . _DB_PREFIX_ . 'feature_value_lang` `fvl` ON (`fvl`.`id_feature_value` = `pf`.`id_feature_value` AND `fvl`.`id_lang` = ' . (int) $id_lang . ')
LEFT JOIN `' . _DB_PREFIX_ . 'feature` `f` ON (`f`.`id_feature` = `pf`.`id_feature` AND `fl`.`id_lang` = ' . (int) $id_lang . ')
LEFT JOIN ' . _DB_PREFIX_ . 'feature_value `fv` ON `fv`.`id_feature_value` = `pf`.`id_feature_value`
LEFT JOIN `' . _DB_PREFIX_ . 'layered_indexable_feature_lang_value` `liflv` ON (`f`.`id_feature` = `liflv`.`id_feature` AND `liflv`.`id_lang` = ' . (int) $id_lang . ')
' . Shop::addSqlAssociation('feature', 'f') . '
WHERE pf.`id_product` = ' . (int) $id_product . '
GROUP BY `name`, pf.`id_feature`
ORDER BY f.`position` ASC');
} else {
Db::getInstance(_PS_USE_SQL_SLAVE_)->execute('SET @@group_concat_max_len = 4096');
self::$_frontFeaturesCache[$id_product . '-' . $id_lang] = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT `name`, GROUP_CONCAT(value ORDER BY `fv`.`position` SEPARATOR ", ") AS `value`, `pf`.`id_feature`
FROM ' . _DB_PREFIX_ . 'feature_product `pf`
LEFT JOIN ' . _DB_PREFIX_ . 'feature_lang `fl` ON (`fl`.`id_feature` = `pf`.`id_feature` AND `fl`.`id_lang` = ' . (int) $id_lang . ')
LEFT JOIN ' . _DB_PREFIX_ . 'feature_value_lang `fvl` ON (`fvl`.`id_feature_value` = `pf`.`id_feature_value` AND `fvl`.`id_lang` = ' . (int) $id_lang . ')
LEFT JOIN ' . _DB_PREFIX_ . 'feature `f` ON `f`.`id_feature` = `pf`.`id_feature`
LEFT JOIN ' . _DB_PREFIX_ . 'feature_value `fv` ON `fv`.`id_feature_value` = `pf`.`id_feature_value`
' . Shop::addSqlAssociation('feature', 'f') . '
WHERE pf.id_product = ' . (int) $id_product . '
GROUP BY `name`, pf.`id_feature`
ORDER BY f.`position` ASC');
}
}
return self::$_frontFeaturesCache[$id_product . '-' . $id_lang];
}
示例5: getFeatures
public static function getFeatures($db, $id_product, $id_lang)
{
if (!Feature::isFeatureActive()) {
return '';
}
$features = '';
$featuresArray = $db->executeS('
SELECT fvl.value FROM ' . _DB_PREFIX_ . 'feature_product fp
LEFT JOIN ' . _DB_PREFIX_ . 'feature_value_lang fvl ON (fp.id_feature_value = fvl.id_feature_value AND fvl.id_lang = ' . (int) $id_lang . ')
WHERE fp.id_product = ' . (int) $id_product);
foreach ($featuresArray as $feature) {
$features .= $feature['value'] . ' ';
}
return $features;
}
示例6: getFeaturesForComparison
public static function getFeaturesForComparison($list_ids_product, $id_lang)
{
if (!Feature::isFeatureActive()) {
return false;
}
$ids = '';
foreach ($list_ids_product as $id) {
$ids .= (int) $id . ',';
}
$ids = rtrim($ids, ',');
if (empty($ids)) {
return false;
}
return Db::getInstance()->executeS('
SELECT f.*, fl.*
FROM `' . _DB_PREFIX_ . 'feature` f
LEFT JOIN `' . _DB_PREFIX_ . 'feature_product` fp
ON f.`id_feature` = fp.`id_feature`
LEFT JOIN `' . _DB_PREFIX_ . 'feature_lang` fl
ON f.`id_feature` = fl.`id_feature`
WHERE fp.`id_product` IN (' . $ids . ')
AND `id_lang` = ' . (int) $id_lang . '
GROUP BY f.`id_feature`
ORDER BY f.`position` ASC
');
}
示例7: initFieldsetFeaturesDetachables
public function initFieldsetFeaturesDetachables()
{
$this->fields_form[2]['form'] = array('legend' => array('title' => $this->l('Optional features'), 'image' => '../img/admin/tab-plugins.gif'), 'desc' => $this->l('Some features can be disabled in order to improve performance.'), 'input' => array(array('type' => 'hidden', 'name' => 'features_detachables_up'), array('type' => 'radio', 'label' => $this->l('Combinations'), 'name' => 'combination', 'class' => 't', 'is_bool' => true, 'disabled' => Combination::isCurrentlyUsed(), 'values' => array(array('id' => 'combination_1', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'combination_0', 'value' => 0, 'label' => $this->l('No'))), 'desc' => $this->l('These features will be disabled')), array('type' => 'radio', 'label' => $this->l('Features'), 'name' => 'feature', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'feature_1', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'feature_0', 'value' => 0, 'label' => $this->l('No'))), 'desc' => $this->l('These features will be disabled'))));
$this->fields_value['combination'] = Combination::isFeatureActive();
$this->fields_value['feature'] = Feature::isFeatureActive();
}
示例8: getFrontFeaturesStatic
public static function getFrontFeaturesStatic($id_lang, $id_product)
{
if (!Feature::isFeatureActive()) {
return array();
}
if (!array_key_exists($id_product . '-' . $id_lang, self::$_frontFeaturesCache)) {
self::$_frontFeaturesCache[$id_product . '-' . $id_lang] = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT name, value, pf.id_feature
FROM ' . _DB_PREFIX_ . 'feature_product pf
LEFT JOIN ' . _DB_PREFIX_ . 'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = ' . (int) $id_lang . ')
LEFT JOIN ' . _DB_PREFIX_ . 'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = ' . (int) $id_lang . ')
LEFT JOIN ' . _DB_PREFIX_ . 'feature f ON (f.id_feature = pf.id_feature AND fl.id_lang = ' . (int) $id_lang . ')
WHERE pf.id_product = ' . (int) $id_product . '
ORDER BY f.position ASC');
}
return self::$_frontFeaturesCache[$id_product . '-' . $id_lang];
}
示例9: postProcess
public function postProcess()
{
if (!Feature::isFeatureActive()) {
return;
}
if ($this->table == 'feature_value' && ($this->action == 'save' || $this->action == 'delete' || $this->action == 'bulkDelete')) {
Hook::exec('displayFeatureValuePostProcess', array('errors' => &$this->errors));
} else {
Hook::exec('displayFeaturePostProcess', array('errors' => &$this->errors));
}
// send errors as reference to allow displayFeaturePostProcess to stop saving process
parent::postProcess();
if ($this->table == 'feature_value' && ($this->display == 'edit' || $this->display == 'add')) {
$this->display = 'editFeatureValue';
}
}
示例10: processFeatures
public function processFeatures()
{
if (!Feature::isFeatureActive()) {
return;
}
if (!Validate::isLoadedObject($this->object)) {
$this->errors[] = Tools::displayError("Product must be created before adding features.");
return;
}
$this->object->deleteFeatures();
${${"GLOBALS"}["emgichjdg"]} = Language::getLanguages(false);
foreach ($_POST as ${${"GLOBALS"}["szxtvkafnfh"]} => ${${"GLOBALS"}["thcmvewqwmi"]}) {
${"GLOBALS"}["bgthjnfnf"] = "match";
if (preg_match("/^feature_([0-9]+)_value/i", ${${"GLOBALS"}["szxtvkafnfh"]}, ${${"GLOBALS"}["bgthjnfnf"]})) {
$ugphilfazj = "val";
$ynigvj = "val";
if (${$ynigvj}) {
$this->object->addFeaturesToDB(${${"GLOBALS"}["usgefpnkvmi"]}[1], ${$ugphilfazj});
} else {
${"GLOBALS"}["dfizdymik"] = "default_value";
${"GLOBALS"}["olyvvjyq"] = "match";
${"GLOBALS"}["eijymfuqqc"] = "languages";
if (${${"GLOBALS"}["dfizdymik"]} = $this->checkFeatures(${${"GLOBALS"}["eijymfuqqc"]}, ${${"GLOBALS"}["usgefpnkvmi"]}[1])) {
${"GLOBALS"}["gqqyeqxcmyfi"] = "languages";
$urlloqd = "language";
${${"GLOBALS"}["nidhvjuji"]} = $this->object->addFeaturesToDB(${${"GLOBALS"}["usgefpnkvmi"]}[1], 0, 1);
foreach (${${"GLOBALS"}["gqqyeqxcmyfi"]} as ${$urlloqd}) {
$dzkybeesn = "cust";
${"GLOBALS"}["ccydjt"] = "language";
${"GLOBALS"}["codlywmdltx"] = "language";
${"GLOBALS"}["ihigkmn"] = "cust";
if (${${"GLOBALS"}["ihigkmn"]} = Tools::getValue("custom_" . ${${"GLOBALS"}["usgefpnkvmi"]}[1] . "_" . (int) ${${"GLOBALS"}["exhdxhsxzdo"]}["id_lang"])) {
$this->object->addFeaturesCustomToDB(${${"GLOBALS"}["nidhvjuji"]}, (int) ${${"GLOBALS"}["codlywmdltx"]}["id_lang"], ${$dzkybeesn});
} else {
$this->object->addFeaturesCustomToDB(${${"GLOBALS"}["nidhvjuji"]}, (int) ${${"GLOBALS"}["ccydjt"]}["id_lang"], ${${"GLOBALS"}["ydddrdnk"]});
}
}
} else {
${${"GLOBALS"}["nidhvjuji"]} = $this->object->addFeaturesToDB(${${"GLOBALS"}["olyvvjyq"]}[1], 0, 1);
}
}
}
}
}
示例11: initContent
/**
* AdminController::initContent() override
* @see AdminController::initContent()
*/
public function initContent()
{
if (Feature::isFeatureActive()) {
// toolbar (save, cancel, new, ..)
$this->initTabModuleList();
$this->initToolbar();
$this->initPageHeaderToolbar();
if ($this->display == 'edit' || $this->display == 'add') {
if (!$this->loadObject(true)) {
return;
}
$this->content .= $this->renderForm();
} else {
if ($this->display == 'view') {
// Some controllers use the view action without an object
if ($this->className) {
$this->loadObject(true);
}
$this->content .= $this->renderView();
} else {
if (!$this->ajax) {
// If a feature value was saved, we need to reset the values to display the list
$this->setTypeFeature();
$this->content .= $this->renderList();
}
}
}
} else {
$url = '<a href="index.php?tab=AdminPerformance&token=' . Tools::getAdminTokenLite('AdminPerformance') . '#featuresDetachables">' . $this->l('Performance') . '</a>';
$this->displayWarning(sprintf($this->l('This feature has been disabled. You can activate it here: %s.'), $url));
}
$this->context->smarty->assign(array('content' => $this->content, 'url_post' => self::$currentIndex . '&token=' . $this->token, 'show_page_header_toolbar' => $this->show_page_header_toolbar, 'page_header_toolbar_title' => $this->page_header_toolbar_title, 'page_header_toolbar_btn' => $this->page_header_toolbar_btn));
}