[-] BO : fix #PSCFV-4988
This commit is contained in:
1 parent
9296a801ec
commit
80d9afc1e5
3 files changed
+24
-14
No files matched your search
+23
-12
@@ -203,19 +203,30 @@ class FeatureCore extends ObjectModel
|
|||||||
WHERE `name` = \''.pSQL($name).'\'
|
WHERE `name` = \''.pSQL($name).'\'
|
||||||
GROUP BY `id_feature`
|
GROUP BY `id_feature`
|
||||||
');
|
');
|
||||||
if (!empty($rq))
|
if (empty($rq))
|
||||||
return (int)$rq['id_feature'];
|
{
|
||||||
// Feature doesn't exist, create it
|
// Feature doesn't exist, create it
|
||||||
$feature = new Feature();
|
$feature = new Feature();
|
||||||
$languages = Language::getLanguages();
|
$languages = Language::getLanguages();
|
||||||
foreach ($languages as $language)
|
foreach ($languages as $language)
|
||||||
$feature->name[$language['id_lang']] = strval($name);
|
$feature->name[$language['id_lang']] = strval($name);
|
||||||
if ($position)
|
if ($position)
|
||||||
$feature->position = (int)$position;
|
$feature->position = (int)$position;
|
||||||
|
else
|
||||||
|
$feature->position = Feature::getHigherPosition() + 1;
|
||||||
|
$feature->add();
|
||||||
|
return $feature->id;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
$feature->position = Feature::getHigherPosition() + 1;
|
{
|
||||||
$feature->add();
|
if ($position && $feature = new Feature((int)$rq['id_feature']))
|
||||||
return $feature->id;
|
{
|
||||||
|
$feature->position = (int)$position;
|
||||||
|
$feature->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (int)$rq['id_feature'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFeaturesForComparison($list_ids_product, $id_lang)
|
public static function getFeaturesForComparison($list_ids_product, $id_lang)
|
||||||
|
|||||||
@@ -138,7 +138,6 @@ class FeatureValueCore extends ObjectModel
|
|||||||
ON (fvl.`id_feature_value` = fv.`id_feature_value`)
|
ON (fvl.`id_feature_value` = fv.`id_feature_value`)
|
||||||
WHERE `value` = \''.pSQL($name).'\'
|
WHERE `value` = \''.pSQL($name).'\'
|
||||||
AND fv.`id_feature` = '.(int)$id_feature.'
|
AND fv.`id_feature` = '.(int)$id_feature.'
|
||||||
AND fv.`custom` = 1
|
|
||||||
GROUP BY fv.`id_feature_value` LIMIT 1
|
GROUP BY fv.`id_feature_value` LIMIT 1
|
||||||
');
|
');
|
||||||
|
|
||||||
|
|||||||
@@ -1437,7 +1437,7 @@ class AdminImportControllerCore extends AdminController
|
|||||||
$tab_feature = explode(':', $single_feature);
|
$tab_feature = explode(':', $single_feature);
|
||||||
$feature_name = trim($tab_feature[0]);
|
$feature_name = trim($tab_feature[0]);
|
||||||
$feature_value = trim($tab_feature[1]);
|
$feature_value = trim($tab_feature[1]);
|
||||||
$position = isset($tab_feature[2]) ? $tab_feature[1]: false;
|
$position = isset($tab_feature[2]) ? $tab_feature[2]: false;
|
||||||
$id_feature = Feature::addFeatureImport($feature_name, $position);
|
$id_feature = Feature::addFeatureImport($feature_name, $position);
|
||||||
$id_feature_value = FeatureValue::addFeatureValueImport($id_feature, $feature_value);
|
$id_feature_value = FeatureValue::addFeatureValueImport($id_feature, $feature_value);
|
||||||
Product::addFeatureProductImport($product->id, $id_feature, $id_feature_value);
|
Product::addFeatureProductImport($product->id, $id_feature, $id_feature_value);
|
||||||
|
|||||||
Reference in new issue
Block a user