src/ShopBundle/objects/TCMSFields/TCMSFieldShopVariantDetails.class.php
public function generateVariants()
    {
        /**
         * @var array|null $aVariantParameters
         */
        $aVariantParameters = $this->getInputFilterUtil()->getFilteredInput('variantParameters');
        if (null === $aVariantParameters) {
            return '';
        }

        foreach ($aVariantParameters as $aVariant) {
            $oTableEditorManager = new TCMSTableEditorManager();
            $oTableEditorManager->sRestrictionField = 'variant_parent_id';
            $oTableEditorManager->sRestriction = $this->oTableRow->id;
            $oTableEditorManager->Init($this->oDefinition->fieldCmsTblConfId, $this->oTableRow->id);
            $oTableEditorManager->AllowEditByAll(true);
            $oTableEditorManager->Insert();
            $oTableEditorManager->oTableEditor->SaveFields($this->mapVariantArticleData($aVariant));

            foreach ($aVariant['variantIDs'] as $sVariantID) {
                $oTableEditorManager->AddMLTConnection($this->name, $sVariantID);
            }

            $nameList = $this->getProductVariantNameGenerator()->generateNamesForAllLanguages($oTableEditorManager->oTableEditor->oTable);
            $originalLanguageId = $oTableEditorManager->oTableEditor->oTableConf->GetLanguage();
            foreach ($nameList as $languageId => $name) {
                $oTableEditorManager->oTableEditor->oTableConf->SetLanguage($languageId);
                $oTableEditorManager->SaveField('name_variant_info', $name);
            }
            $oTableEditorManager->oTableEditor->oTableConf->SetLanguage($originalLanguageId);
        }

        return TGlobal::Translate('chameleon_system_shop.field_shop_variant_details.msg_created_variants', array('%generatedVariantsCount%' => count($aVariantParameters)));
    }
public function generateVariants()
    {
        /**
         * @var array|null $aVariantParameters
         */
        $aVariantParameters = $this->getInputFilterUtil()->getFilteredInput('variantParameters');
        if (null === $aVariantParameters) {
            return '';
        }

        foreach ($aVariantParameters as $aVariant) {
            $oTableEditorManager = new TCMSTableEditorManager();
            $oTableEditorManager->sRestrictionField = 'variant_parent_id';
            $oTableEditorManager->sRestriction = $this->oTableRow->id;
            $oTableEditorManager->Init($this->oDefinition->fieldCmsTblConfId, $this->oTableRow->id);
            $oTableEditorManager->AllowEditByAll(true);
            $oTableEditorManager->Insert();
            $oTableEditorManager->oTableEditor->SaveFields($this->mapVariantArticleData($aVariant));

            foreach ($aVariant['variantIDs'] as $sVariantID) {
                $oTableEditorManager->AddMLTConnection($this->name, $sVariantID);
            }

            $nameList = $this->getProductVariantNameGenerator()->generateNamesForAllLanguages($oTableEditorManager->oTableEditor->oTable);
            $originalLanguageId = $oTableEditorManager->oTableEditor->oTableConf->GetLanguage();
            foreach ($nameList as $languageId => $name) {
                $oTableEditorManager->oTableEditor->oTableConf->SetLanguage($languageId);
                $oTableEditorManager->SaveField('name_variant_info', $name);
            }
            $oTableEditorManager->oTableEditor->oTableConf->SetLanguage($originalLanguageId);
        }

        return TGlobal::Translate('chameleon_system_shop.field_shop_variant_details.msg_created_variants', array('%generatedVariantsCount%' => count($aVariantParameters)));
    }
public function generateVariants ( ) { /**
         * @var array|null $aVariantParameters
         */ $ aVariantParameters = $ this -> getInputFilterUtil ( ) -> getFilteredInput ( 'variantParameters' ) ; if ( null === $ aVariantParameters ) { return '' ; } foreach ( $ aVariantParameters as $ aVariant ) { $ oTableEditorManager = new TCMSTableEditorManager ( ) ; $ oTableEditorManager -> sRestrictionField = 'variant_parent_id' ; $ oTableEditorManager -> sRestriction = $ this -> oTableRow -> id ; $ oTableEditorManager -> Init ( $ this -> oDefinition -> fieldCmsTblConfId , $ this -> oTableRow -> id ) ; $ oTableEditorManager -> AllowEditByAll ( true ) ; $ oTableEditorManager -> Insert ( ) ; $ oTableEditorManager -> oTableEditor -> SaveFields ( $ this -> mapVariantArticleData ( $ aVariant ) ) ; foreach ( $ aVariant [ 'variantIDs' ] as $ sVariantID ) { $ oTableEditorManager -> AddMLTConnection ( $ this -> name , $ sVariantID ) ; } $ nameList = $ this -> getProductVariantNameGenerator ( ) -> generateNamesForAllLanguages ( $ oTableEditorManager -> oTableEditor -> oTable ) ; $ originalLanguageId = $ oTableEditorManager -> oTableEditor -> oTableConf -> GetLanguage ( ) ; foreach ( $ nameList as $ languageId => $ name ) { $ oTableEditorManager -> oTableEditor -> oTableConf -> SetLanguage ( $ languageId ) ; $ oTableEditorManager -> SaveField ( 'name_variant_info' , $ name ) ; } $ oTableEditorManager -> oTableEditor -> oTableConf -> SetLanguage ( $ originalLanguageId ) ; } return TGlobal :: Translate ( 'chameleon_system_shop.field_shop_variant_details.msg_created_variants' , array ( '%generatedVariantsCount%' => count ( $ aVariantParameters ) ) ) ; }
called via ajax
generates all variants that where checked in the field matrix.

@return string
called via ajax generates all variants that where checked in the field matrix .