/** * Executes the configured tasks. * * @return boolean True if success * @throws Exception If an error occurs */ public function execute() { $conf = Base::parseTS($this->{$this->fieldTSconfig}); if (!isset($conf['client']['html']['catalog']['detail']['url']['config'])) { $conf['client']['html']['catalog']['detail']['url']['config'] = array('plugin' => 'catalog-detail', 'extension' => 'aimeos', 'absoluteUri' => 1); } if ($this->{$this->fieldSenderFrom} != '') { $conf['client']['html']['email']['from-name'] = $this->{$this->fieldSenderFrom}; } if ($this->{$this->fieldSenderEmail} != '') { $conf['client']['html']['email']['from-email'] = $this->{$this->fieldSenderEmail}; } if ($this->{$this->fieldReplyEmail} != '') { $conf['client']['html']['email']['reply-email'] = $this->{$this->fieldReplyEmail}; } if ($this->{$this->fieldPageDetail} != '') { $conf['client']['html']['catalog']['detail']['url']['target'] = $this->{$this->fieldPageDetail}; } if ($this->{$this->fieldContentBaseurl} != '') { $conf['client']['html']['common']['content']['baseurl'] = $this->{$this->fieldContentBaseurl}; } if ($this->{$this->fieldTemplateBaseurl} != '') { $themeDir = $this->{$this->fieldTemplateBaseurl}; if ($themeDir != '' && $themeDir[0] !== '/') { realpath(PATH_site . $themeDir); } $conf['client']['html']['common']['template']['baseurl'] = $this->{$this->fieldTemplateBaseurl}; } Scheduler\Base::initFrontend($this->{$this->fieldPageDetail}); Scheduler\Base::execute($conf, (array) $this->{$this->fieldController}, $this->{$this->fieldSite}); return true; }
/** * Sets the locale item in the given context * * @param \Aimeos\MShop\Context\Item\Iface $context Context object * @param string $sitecode Unique site code * @param string $lang ISO language code, e.g. "en" or "en_GB" * @return \Aimeos\MShop\Context\Item\Iface Modified context object */ protected function getContext($sitecode, $lang) { if (!isset($this->context)) { $config = $this->getConfig($this->settings); $context = Base::getContext($config); $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); try { $localeItem = $localeManager->bootstrap($sitecode, '', '', false); $localeItem->setLanguageId(null); $localeItem->setCurrencyId(null); } catch (\Aimeos\MShop\Locale\Exception $e) { $localeItem = $localeManager->createItem(); } $context->setLocale($localeItem); $context->setI18n(Base::getI18n(array($lang))); $context->setEditor($GLOBALS['BE_USER']->user['username']); $this->context = $context; } return $this->context; }
/** * Adds the "translate" helper to the view object * * @param \Aimeos\MW\View\Iface $view View object * @param string|null $langid ISO language code, e.g. "de" or "de_CH" * @param array $local Local translations * @return \Aimeos\MW\View\Iface Modified view object */ protected static function addTranslate(\Aimeos\MW\View\Iface $view, $langid, array $local) { if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_view_translate']) && is_callable($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_view_translate'])) { return $fcn($view, $langid, $local); } if ($langid) { $i18n = \Aimeos\Aimeos\Base::getI18n(array($langid), $local); $translation = $i18n[$langid]; } else { $translation = new \Aimeos\MW\Translation\None('en'); } $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); $view->addHelper('translate', $helper); return $view; }
/** * Returns the locale object for the context * * @param \Aimeos\MShop\Context\Item\Iface $context Context object * @return \Aimeos\MShop\Locale\Item\Iface Locale item object * @deprecated Use \Aimeos\Aimeos\Base::getLocale() directly */ protected function getLocale(\Aimeos\MShop\Context\Item\Iface $context) { return Base::getLocale($context, $this->request); }
/** * Returns the HTML code for the controller control. * * @param array $selected List of site codes that were previously selected by the user * @param string|null $filter String that must be part of the controller name * @return string HTML code with <option> tags for the select box */ protected function getControllerOptions(array $selected, $filter = null) { $html = ''; $aimeos = Base::getAimeos(); $context = Scheduler\Base::getContext(); $cntlPaths = $aimeos->getCustomPaths('controller/jobs'); $langid = 'en'; if (isset($GLOBALS['BE_USER']->uc['lang']) && $GLOBALS['BE_USER']->uc['lang'] != '') { $langid = $GLOBALS['BE_USER']->uc['lang']; } $localeItem = \MShop_Factory::createManager($context, 'locale')->createItem(); $localeItem->setLanguageId($langid); $context->setLocale($localeItem); $controllers = \Controller_Jobs_Factory::getControllers($context, $aimeos, $cntlPaths); foreach ($controllers as $name => $controller) { if ($filter !== null && strstr($name, $filter) === false) { continue; } $active = in_array($name, $selected) ? 'selected="selected"' : ''; $title = htmlspecialchars($controller->getDescription(), ENT_QUOTES, 'UTF-8'); $cntl = htmlspecialchars($controller->getName(), ENT_QUOTES, 'UTF-8'); $name = htmlspecialchars($name, ENT_QUOTES, 'UTF-8'); $html .= sprintf('<option value="%1$s" title="%2$s" %3$s>%4$s</option>', $name, $title, $active, $cntl); } return $html; }
/** * Returns the current context. * * @param array Multi-dimensional associative list of key/value pairs * @return MShop_Context_Item_Interface Context object */ public static function getContext(array $conf = array()) { $aimeos = Aimeos\Base::getAimeos(); $tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates'); $tmplPaths = array_merge($tmplPaths, $aimeos->getCustomPaths('client/html')); $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); $uriBuilder = $objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder'); $uriBuilder->setArgumentPrefix('ai'); $config = Aimeos\Base::getConfig($conf); $context = Aimeos\Base::getContext($config); $langManager = \Aimeos\MShop\Factory::createManager($context, 'locale/language'); $search = $langManager->createSearch(true); $expr = array(); $expr[] = $search->getConditions(); $expr[] = $search->compare('==', 'locale.language.id', 'en'); // default language if (isset($GLOBALS['BE_USER']->uc['lang']) && $GLOBALS['BE_USER']->uc['lang'] != '') { // BE language $expr[] = $search->compare('==', 'locale.language.id', $GLOBALS['BE_USER']->uc['lang']); } $search->setConditions($search->combine('||', $expr)); $langids = array_keys($langManager->searchItems($search)); $i18n = Aimeos\Base::getI18n($langids, isset($conf['i18n']) ? (array) $conf['i18n'] : array()); $context->setI18n($i18n); $view = Aimeos\Base::getView($config, $uriBuilder, $tmplPaths); $context->setView($view); $context->setEditor('scheduler'); return $context; }
/** * Executes the configured tasks. * * @return boolean True if success, false if not * @throws Exception If an error occurs */ public function execute() { $sitecodes = (array) $this->{$this->fieldSite}; $controllers = (array) $this->{$this->fieldController}; $tsconfig = $this->{$this->fieldTSconfig}; $conf = Base::parseTS($tsconfig); Scheduler\Base::execute($conf, $controllers, $sitecodes); return true; }
/** * Returns a new context object. * * @return MShop_Context_Item_Interface Context object */ protected static function getContext() { $ctx = new \Aimeos\MShop\Context\Item\Standard(); $conf = \Aimeos\Aimeos\Base::getConfig(); $ctx->setConfig($conf); $dbm = new \Aimeos\MW\DB\Manager\DBAL($conf); $ctx->setDatabaseManager($dbm); $logger = new \Aimeos\MW\Logger\Errorlog(\Aimeos\MW\Logger\Base::INFO); $ctx->setLogger($logger); $session = new \Aimeos\MW\Session\None(); $ctx->setSession($session); $cache = new \Aimeos\MW\Cache\None(); $ctx->setCache($cache); return $ctx; }
public function setUp() { \Aimeos\Aimeos\Base::getAimeos(); // initialize autoloader $this->object = $this->getAccessibleMock('Aimeos\\Aimeos\\Controller\\JqadmController', array('dummy')); $this->request = $this->getMockBuilder('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request')->setMethods(array('hasArgument', 'getArgument'))->disableOriginalConstructor()->getMock(); $this->response = $this->getMockBuilder('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Response')->setMethods(array('setHeader'))->disableOriginalConstructor()->getMock(); $this->view = $this->getMockBuilder('TYPO3\\CMS\\Extbase\\Mvc\\View\\EmptyView')->setMethods(array('assign'))->disableOriginalConstructor()->getMock(); $uriBuilder = $this->getMockBuilder('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder')->setMethods(array('buildBackendUri'))->disableOriginalConstructor()->getMock(); $uriBuilder->expects($this->any())->method('buildBackendUri'); $this->object->_set('uriBuilder', $uriBuilder); $this->object->_set('response', $this->response); $this->object->_set('request', $this->request); $this->object->_set('view', $this->view); $this->object->_call('initializeAction'); }
public function setUp() { \Aimeos\Aimeos\Base::getAimeos(); // initialize autoloader $this->object = $this->getAccessibleMock('Aimeos\\Aimeos\\Controller\\JsonadmController', array('dummy')); $this->request = $this->getMockBuilder('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request')->setMethods(array('hasArgument', 'getArgument', 'getMethod', 'getBaseUri'))->disableOriginalConstructor()->getMock(); $this->response = $this->getMockBuilder('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Response')->setMethods(array('setStatus'))->disableOriginalConstructor()->getMock(); $objManager = new \TYPO3\CMS\Extbase\Object\ObjectManager(); $uriBuilder = $objManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder'); $uriBuilder->setRequest($this->request); if (method_exists($response, 'setRequest')) { $response->setRequest($this->request); } $this->object->_set('uriBuilder', $uriBuilder); $this->object->_set('response', $this->response); $this->object->_set('request', $this->request); $this->object->_call('initializeAction'); }
public function setUp() { \Aimeos\Aimeos\Base::getAimeos(); // initialize autoloader $this->object = $this->getAccessibleMock('Aimeos\\Aimeos\\Controller\\AccountController', array('dummy')); $objManager = new \TYPO3\CMS\Extbase\Object\ObjectManager(); $uriBuilder = $objManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder'); $response = $objManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Response'); $request = $objManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request'); $uriBuilder->setRequest($request); if (method_exists($response, 'setRequest')) { $response->setRequest($request); } $this->object->_set('uriBuilder', $uriBuilder); $this->object->_set('response', $response); $this->object->_set('request', $request); $this->object->_call('initializeAction'); }
/** * Adds the cache object to the context * * @param \Aimeos\MShop\Context\Item\Iface $context Context object including config * @return \Aimeos\MShop\Context\Item\Iface Modified context object */ protected static function addCache(\Aimeos\MShop\Context\Item\Iface $context) { if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_cache']) && is_callable($fcn = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_context_cache'])) { return $fcn($context); } switch (\Aimeos\Aimeos\Base::getExtConfig('cacheName', 'Typo3')) { case 'None': $context->getConfig()->set('client/html/basket/cache/enable', false); $cache = \Aimeos\MW\Cache\Factory::createManager('None', array(), null); break; case 'Typo3': $manager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager'); $cache = new \Aimeos\MAdmin\Cache\Proxy\Typo3($context, $manager->getCache('aimeos')); break; default: $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context); } return $context->setCache($cache); }
/** * Processes update requests from payment service providers. */ public function updateAction() { try { $context = $this->getContext(); $templatePaths = Base::getAimeos()->getCustomPaths('client/html'); $client = \Aimeos\Client\Html\Checkout\Update\Factory::createClient($context, $templatePaths); $view = $context->getView(); $param = array_merge(\TYPO3\CMS\Core\Utility\GeneralUtility::_GET(), \TYPO3\CMS\Core\Utility\GeneralUtility::_POST()); $helper = new \Aimeos\MW\View\Helper\Parameter\Standard($view, $param); $view->addHelper('param', $helper); $client->setView($view); $client->process(); $this->response->addAdditionalHeaderData($client->getHeader()); return $client->getBody(); } catch (\Exception $e) { @header('HTTP/1.1 500 Internal server error', true, 500); return 'Error: ' . $e->getMessage(); } }
/** * Creates new translation objects. * * @param array $i18nPaths Paths to the translation directories * @param array $langIds List of two letter ISO language IDs * @param array $local List of local translation entries overwriting the standard ones * @return array List of translation objects implementing MW_Translation_Interface */ public static function get(array $i18nPaths, array $languageIds, array $local = array()) { $i18nList = array(); foreach ($languageIds as $langid) { if (!isset(self::$i18n[$langid])) { $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $langid); if (function_exists('apc_store') === true && (bool) \Aimeos\Aimeos\Base::getExtConfig('useAPC', false) === true) { $i18n = new \Aimeos\MW\Translation\Decorator\APC($i18n, \Aimeos\Aimeos\Base::getExtConfig('apcPrefix', 't3:')); } self::$i18n[$langid] = $i18n; } $i18nList[$langid] = self::$i18n[$langid]; if (isset($local[$langid])) { $translations = self::parseTranslations((array) $local[$langid]); $i18nList[$langid] = new \Aimeos\MW\Translation\Decorator\Memory($i18nList[$langid], $translations); } } return $i18nList; }
/** * Executes the Aimeos e-mail jobs * * The Aimeos shop system needs some maintenance tasks that must be * regularly executed. Each of these maintenance tasks must be executed for * all shop instances if you have more than one site in your installation. * * @param string $jobs List of job names separated by a space character like "customer/email/watch order/email/payment" * @param string $sites List of sites separated by a space character the jobs should be executed for, e.g. "default unittest" * @param string $tsconfig TypoScript string for individual configuration * @param string $senderFrom Name of the sender in the e-mail * @param string $senderEmail Sender e-mail address * @param string $replyEmail E-Mail address customers can reply to * @param string $detailPid Page ID of the catalog detail page for generating product URLs * @param string $baseUrl URL of the Aimeos uploads directory, e.g. https://yourdomain.tld/uploads/tx_aimeos * @param string $themeDir Absolute path or relative path from to TYPO3 root to the CSS files of the theme directory * @return boolean True on succes */ public function emailCommand($jobs = 'customer/email/watch order/email/delivery order/email/payment', $sites = 'default', $tsconfig = '', $senderFrom = 'Aimeos shop', $senderEmail = '', $replyEmail = '', $detailPid = '', $baseUrl = '', $themeDir = 'typo3conf/ext/aimeos/Resources/Public/Themes/elegance') { Scheduler\Base::initFrontend($detailPid); if ($themeDir != '' && $themeDir[0] !== '/') { $themeDir = realpath(PATH_site . $themeDir); } $conf = Base::parseTS($tsconfig); if (!isset($conf['client']['html']['catalog']['detail']['url']['config'])) { $conf['client']['html']['catalog']['detail']['url']['config'] = array('plugin' => 'catalog-detail', 'extension' => 'aimeos', 'absoluteUri' => 1); } $conf['client']['html']['email']['from-name'] = $senderFrom; $conf['client']['html']['email']['from-email'] = $senderEmail; $conf['client']['html']['email']['reply-email'] = $replyEmail; $conf['client']['html']['common']['content']['baseurl'] = $baseUrl; $conf['client']['html']['common']['template']['baseurl'] = $themeDir; $conf['client']['html']['catalog']['detail']['url']['target'] = $detailPid; Scheduler\Base::execute($conf, explode(' ', $jobs), $sites); return true; }
/** * Returns the context item * * @return \MShop_Context_Item_Interface Context item */ protected function getContext() { if (!isset($this->context)) { $templatePaths = Base::getAimeos()->getCustomPaths('client/html'); $config = $this->getConfig($this->settings); $context = Base::getContext($config); $localI18n = isset($this->settings['i18n']) ? $this->settings['i18n'] : array(); $locale = $this->getLocale($context); $langid = $locale->getLanguageId(); $context->setLocale($locale); $context->setI18n(Base::getI18n(array($langid), $localI18n)); $context->setView(Base::getView($config, $this->uriBuilder, $templatePaths, $this->request, $langid)); if (TYPO3_MODE === 'FE' && $GLOBALS['TSFE']->loginUser == 1) { $context->setEditor($GLOBALS['TSFE']->fe_user->user['username']); $context->setUserId($GLOBALS['TSFE']->fe_user->user[$GLOBALS['TSFE']->fe_user->userid_column]); } $this->context = $context; } return $this->context; }
/** * Returns the list of categories with their ID. * * @param array $config Associative array of existing configurations * @param \TYPO3\CMS\Backend\Form\FormEngine|\TYPO3\CMS\Backend\Form\DataPreprocessor $tceForms TCE forms object * @param string $sitecode Unique code of the site to retrieve the categories for * @return array Associative array with existing and new entries */ public function getCategories(array $config, $tceForms = null, $sitecode = 'default') { if (isset($config['row']) && isset($config['row']['pid'])) { $pageTSConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($config['row']['pid'], 'tx_aimeos'); if (isset($pageTSConfig['properties']['mshop.']['locale.']['site'])) { $sitecode = $pageTSConfig['properties']['mshop.']['locale.']['site']; } } try { $context = Base::getContext(Base::getConfig()); $context->setEditor('flexform'); $localeManager = \MShop_Locale_Manager_Factory::createManager($context); $context->setLocale($localeManager->bootstrap($sitecode, '', '', false)); $manager = \MShop_Catalog_Manager_Factory::createManager($context); $item = $manager->getTree(null, array(), \MW_Tree_Manager_Abstract::LEVEL_TREE); $config['items'] = array_merge($config['items'], $this->getCategoryList($item, 0)); } catch (Exception $e) { error_log($e->getMessage() . PHP_EOL . $e->getTraceAsString()); } return $config; }
/** * Creates a new configuration object. * * @param array $paths Paths to the configuration directories * @param array $local Multi-dimensional associative list with local configuration * @return \Aimeos\MW\Config\Iface Configuration object */ public static function get(array $paths, array $local = array()) { if (self::$config === null) { // Using extension config directories if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['confDirs'])) { ksort($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['confDirs']); foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['confDirs'] as $dir) { if (($absPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($dir)) !== '') { $paths[] = $absPath; } } } $conf = new \Aimeos\MW\Config\PHPArray(array(), $paths); if (function_exists('apc_store') === true && (bool) \Aimeos\Aimeos\Base::getExtConfig('useAPC', false) === true) { $conf = new \Aimeos\MW\Config\Decorator\APC($conf, \Aimeos\Aimeos\Base::getExtConfig('apcPrefix', 't3:')); } self::$config = $conf; } if (isset($local['typo3']['tsconfig'])) { $tsconfig = \Aimeos\Aimeos\Base::parseTS($local['typo3']['tsconfig']); $local = \TYPO3\CMS\Extbase\Utility\ArrayUtility::arrayMergeRecursiveOverrule($local, $tsconfig); } return new \Aimeos\MW\Config\Decorator\Memory(self::$config, $local); }
/** * Processes requests and renders the locale selector. */ public function selectAction() { $templatePaths = Base::getAimeos()->getCustomPaths('client/html'); $client = \Client_Html_Locale_Select_Factory::createClient($this->getContext(), $templatePaths); return $this->getClientOutput($client); }
/** * Returns the JSON encoded translations for the ExtJS client. * * @param string $lang ISO language code like "en" or "en_GB" * @return string JSON encoded translation object */ protected function getJsonClientI18n($lang) { $i18nPaths = Base::getAimeos()->getI18nPaths(); $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $lang); $content = array('admin' => $i18n->getAll('admin'), 'admin/ext' => $i18n->getAll('admin/ext')); return json_encode($content, JSON_FORCE_OBJECT); }
/** * Renders the account watch list. */ public function watchAction() { $templatePaths = Base::getAimeos()->getCustomPaths('client/html'); $client = \Aimeos\Client\Html\Account\Watch\Factory::createClient($this->getContext(), $templatePaths); return $this->getClientOutput($client); }
/** * Returns a new context object. * * @return MShop_Context_Item_Interface Context object */ protected static function getContext() { $ctx = new \MShop_Context_Item_Default(); $conf = \Aimeos\Aimeos\Base::getConfig(); $ctx->setConfig($conf); $dbm = new \MW_DB_Manager_PDO($conf); $ctx->setDatabaseManager($dbm); $logger = new \MW_Logger_Errorlog(\MW_Logger_ABSTRACT::INFO); $ctx->setLogger($logger); $session = new \MW_Session_None(); $ctx->setSession($session); $cache = new \MW_Cache_None(); $ctx->setCache($cache); return $ctx; }
/** * Returns the resource client * * @param string Resource location, e.g. "product/stock/wareshouse" * @return \Aimeos\Admin\JsonAdm\Iface Jsonadm client */ protected function createClient($resource) { $templatePaths = Base::getAimeos()->getCustomPaths('admin/jsonadm/templates'); $context = $this->getContextBackend($templatePaths); return \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, $resource); }
/** * Renders the user session related catalog section. */ public function sessionAction() { $templatePaths = Base::getAimeos()->getCustomPaths('client/html'); $client = \Aimeos\Client\Html\Catalog\Session\Factory::createClient($this->getContext(), $templatePaths); return $this->getClientOutput($client); }
/** * Adds the generated HTML code to the view * * @param string $content Content from admin client */ protected function setHtml($content) { $content = str_replace(['{type}', '{version}'], ['TYPO3', Base::getVersion()], $content); $this->view->assign('formparam', 'tx_aimeos_web_aimeostxaimeosadmin'); $this->view->assign('content', $content); }
/** * Returns the JSON encoded translations for the ExtJS client. * * @param string $lang ISO language code like "en" or "en_GB" * @return string JSON encoded translation object */ protected function getJsonClientI18n($lang) { $i18nPaths = Base::getAimeos()->getI18nPaths(); $i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $lang, array('disableNotices' => true)); $content = array('client/extjs' => $i18n->getAll('client/extjs'), 'client/extjs/ext' => $i18n->getAll('client/extjs/ext')); return json_encode($content, JSON_FORCE_OBJECT); }
/** * Renders the related basket. */ public function relatedAction() { $templatePaths = Base::getAimeos()->getCustomPaths('client/html'); $client = \Client_Html_Basket_Related_Factory::createClient($this->getContext(), $templatePaths); return $this->getClientOutput($client); }
/** * Returns the list of categories with their ID. * * @param array $config Associative array of existing configurations * @param \TYPO3\CMS\Backend\Form\FormEngine|\TYPO3\CMS\Backend\Form\DataPreprocessor $tceForms TCE forms object * @param string $sitecode Unique code of the site to retrieve the categories for * @return array Associative array with existing and new entries */ public function getCategories(array $config, $tceForms = null, $sitecode = 'default') { if (isset($config['flexParentDatabaseRow']['pid'])) { // TYPO3 7+ $pid = $config['flexParentDatabaseRow']['pid']; } elseif (isset($config['row']['pid'])) { // TYPO3 6.2 $pid = $config['row']['pid']; } $pageTSConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($pid, 'tx_aimeos'); if (isset($pageTSConfig['properties']['mshop.']['locale.']['site'])) { $sitecode = $pageTSConfig['properties']['mshop.']['locale.']['site']; } try { $context = Base::getContext(Base::getConfig()); $context->setEditor('flexform'); $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); $context->setLocale($localeManager->bootstrap($sitecode, '', '', false)); $manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($context); $item = $manager->getTree(null, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE); $config['items'] = array_merge($config['items'], $this->getCategoryList($item, $item->getName())); } catch (\Exception $e) { error_log($e->getMessage() . PHP_EOL . $e->getTraceAsString()); } return $config; }