예제 #1
0
파일: faker.php 프로젝트: hadesain/thelia
     if ($i === 1 || $i === 3) {
         for ($j = 0; $j < rand(1, 5); $j++) {
             $featureAv = new Thelia\Model\FeatureAv();
             $featureAv->setFeature($feature);
             $featureAv->setPosition($j);
             setI18n($featureAv);
             $featureAv->save();
             $featureList[$featureId][] = $featureAv->getId();
         }
     }
 }
 echo "Creating attributes\n";
 //attributes and attributes_av
 $attributeList = array();
 for ($i = 0; $i < 4; $i++) {
     $attribute = new Thelia\Model\Attribute();
     $attribute->setPosition($i);
     setI18n($attribute);
     $attribute->save();
     $attributeId = $attribute->getId();
     $attributeList[$attributeId] = array();
     for ($j = 0; $j < rand(1, 5); $j++) {
         $attributeAv = new Thelia\Model\AttributeAv();
         $attributeAv->setAttribute($attribute);
         $attributeAv->setPosition($j);
         setI18n($attributeAv);
         $attributeAv->save();
         $attributeList[$attributeId][] = $attributeAv->getId();
     }
 }
 echo "Creating templates\n";
예제 #2
0
파일: import.php 프로젝트: alex63530/thelia
function createColors($con)
{
    echo "start creating colors attributes\n";
    if (($handle = fopen(THELIA_ROOT . '/setup/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($con);
        fclose($handle);
    }
    echo "colors attributes created with success\n";
    return $attribute;
}