import colors attributes
This commit is contained in:
@@ -50,7 +50,7 @@ try {
|
|||||||
|
|
||||||
|
|
||||||
$categories = createCategories();
|
$categories = createCategories();
|
||||||
|
createColors();
|
||||||
|
|
||||||
$con->commit();
|
$con->commit();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@@ -84,6 +84,36 @@ function createCategories()
|
|||||||
return $categories;
|
return $categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createColors()
|
||||||
|
{
|
||||||
|
if (($handle = fopen(THELIA_ROOT . '/install/import/colors.csv', "r")) !== FALSE) {
|
||||||
|
$row=0;
|
||||||
|
$attribute = new \Thelia\Model\Attribute();
|
||||||
|
$attribute
|
||||||
|
->setPosition(1)
|
||||||
|
->setLocale('fr_FR')
|
||||||
|
->setTitle('Couleur')
|
||||||
|
->setLocale('en_US')
|
||||||
|
->setTitle('Colors');
|
||||||
|
|
||||||
|
while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
|
||||||
|
$row++;
|
||||||
|
$attributeAv = new \Thelia\Model\AttributeAv();
|
||||||
|
$attributeAv
|
||||||
|
->setPosition($row)
|
||||||
|
->setLocale('fr_FR')
|
||||||
|
->setTitle($data[0])
|
||||||
|
->setLocale('en_US')
|
||||||
|
->setTitle($data[1]);
|
||||||
|
|
||||||
|
$attribute->addAttributeAv($attributeAv);
|
||||||
|
}
|
||||||
|
$attribute->save();
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function clearTables()
|
function clearTables()
|
||||||
{
|
{
|
||||||
$productAssociatedContent = Thelia\Model\ProductAssociatedContentQuery::create()
|
$productAssociatedContent = Thelia\Model\ProductAssociatedContentQuery::create()
|
||||||
|
|||||||
13
install/import/colors.csv
Normal file
13
install/import/colors.csv
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
"Bleu";"Blue"
|
||||||
|
"Jaune";"Yellow"
|
||||||
|
"Orange";"Orange"
|
||||||
|
"Rose";"Pink"
|
||||||
|
"Vert";"Green"
|
||||||
|
"Violet";"Purple"
|
||||||
|
"Rouge";"Red"
|
||||||
|
"Gris";"Gray"
|
||||||
|
"Noir";"Black"
|
||||||
|
"Beige";"Beige"
|
||||||
|
"Turquoise";"Turquoise"
|
||||||
|
"Marron";"Brown"
|
||||||
|
"Blanc";"White"
|
||||||
|
Reference in New Issue
Block a user