[-] 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)
{
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);
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);
foreach ($features as $k => $tab_features)
if ($this->product_exists_in_shop)
{
$features[$k]['current_item'] = false;
$features[$k]['val'] = array();
$features = Feature::getFeatures($this->context->language->id);
$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'];
foreach ($features as $k => $tab_features)
{
$features[$k]['current_item'] = false;
$features[$k]['val'] = array();
$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;
$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'];
if ($custom)
$features[$k]['val'] = FeatureValue::getFeatureValueLang($features[$k]['current_item']);
$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);
}
$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 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();
}