/** * Copy product localizations. * * @param int $oldProductUid Old product uid * @param int $newProductUid New product uid * * @return void */ protected function copyProductTanslations($oldProductUid, $newProductUid) { $database = $this->getDatabaseConnection(); $backendUser = $this->getBackendUser(); $products = $database->exec_SELECTgetRows('*', 'tx_commerce_products', 'l18n_parent = ' . $oldProductUid); foreach ($products as $product) { $oldTranslationProductUid = $product['uid']; /** * Data handler. * * @var DataHandler */ $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler'); $tce->stripslashes_values = 0; $tcaDefaultOverride = $backendUser->getTSConfigProp('TCAdefaults'); if (is_array($tcaDefaultOverride)) { $tce->setDefaultsFromUserTS($tcaDefaultOverride); } // start $tce->start(array(), array()); $overrideArray = array('l18n_parent' => $newProductUid); $newTranslationProductUid = $tce->copyRecord('tx_commerce_products', $oldTranslationProductUid, $product['pid'], 1, $overrideArray); $this->belib->copyArticlesByProduct($newTranslationProductUid, $oldTranslationProductUid); } }