[-] BO: Fix PSCFV-3865

This commit is contained in:
rGaillard
2012-09-03 13:58:18 +00:00
parent 218f9e93ca
commit 8a6d40ef17
+33 -35
View File
@@ -3893,52 +3893,50 @@ class AdminProductsControllerCore extends AdminController
public function initFormFeatures($obj) public function initFormFeatures($obj)
{ {
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>');
return;
}
$data = $this->createTemplate($this->tpl_form); $data = $this->createTemplate($this->tpl_form);
if ($obj->id) 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 ($this->product_exists_in_shop) if ($obj->id)
{ {
$features = Feature::getFeatures($this->context->language->id); if ($this->product_exists_in_shop)
foreach ($features as $k => $tab_features)
{ {
$features[$k]['current_item'] = false; $features = Feature::getFeatures($this->context->language->id);
$features[$k]['val'] = array();
$custom = true; foreach ($features as $k => $tab_features)
foreach ($obj->getFeatures() as $tab_products) {
if ($tab_products['id_feature'] == $tab_features['id_feature']) $features[$k]['current_item'] = false;
$features[$k]['current_item'] = $tab_products['id_feature_value']; $features[$k]['val'] = array();
$features[$k]['featureValues'] = FeatureValue::getFeatureValuesWithLang($this->context->language->id, (int)$tab_features['id_feature']); $custom = true;
if (count($features[$k]['featureValues'])) foreach ($obj->getFeatures() as $tab_products)
foreach ($features[$k]['featureValues'] as $value) if ($tab_products['id_feature'] == $tab_features['id_feature'])
if ($features[$k]['current_item'] == $value['id_feature_value']) $features[$k]['current_item'] = $tab_products['id_feature_value'];
$custom = false;
if ($custom) $features[$k]['featureValues'] = FeatureValue::getFeatureValuesWithLang($this->context->language->id, (int)$tab_features['id_feature']);
$features[$k]['val'] = FeatureValue::getFeatureValueLang($features[$k]['current_item']); 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
$data->assign('available_features', $features); $this->displayWarning($this->l('You must save this product in this shop before adding 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 else
$this->displayWarning($this->l('You must save this product in this shop before adding features.')); $this->displayWarning($this->l('You must save this product before adding features.'));
} }
else
$this->displayWarning($this->l('You must save this product before adding features.'));
$this->tpl_form_vars['custom_form'] = $data->fetch(); $this->tpl_form_vars['custom_form'] = $data->fetch();
} }