/** * Initializing. * * @param array $conf Configuration * * @return void */ protected function init(array $conf = array()) { if ($this->getFrontendController()->beUserLogin) { $this->workspace = $this->getBackendUser()->workspace; } // enable typoscript objects for overridePid if (!empty($conf['overridePid.'])) { $conf['overridePid'] = $this->cObj->cObjGetSingle($conf['overridePid'], $conf['overridePid.']); unset($conf['overridePid.']); } $this->conf = $conf; $this->pi_setPiVarDefaults(); $this->pi_loadLL(); $this->pi_initPIflexForm(); \CommerceTeam\Commerce\Utility\GeneralUtility::initializeFeUserBasket(); $this->pid = $this->getFrontendController()->id; $this->basketHashValue = $this->getBasket()->getBasketHashValue(); $this->piVars['basketHashValue'] = $this->basketHashValue; $this->argSeparator = ini_get('arg_separator.output'); $this->addAdditionalLocallang(); $this->generateLanguageMarker(); if (empty($this->conf['templateFile'])) { $this->error('init', __LINE__, 'Template File not defined in TS: '); } $this->templateCode = (string) $this->cObj->fileResource($this->conf['templateFile']); if ($this->conf['useRootlineInformationToUrl']) { $this->useRootlineInformationToUrl = $this->conf['useRootlineInformationToUrl']; } }
/** * Method for generating the rootlineMenu to use in TS. * * @param string $content Passed to method * @param array $conf TS Array * * @return array for the menurendering of TYPO3 */ public function renderRootline($content, array $conf) { $this->mConf = $this->processConf($conf); $this->pid = (int) ($this->mConf['overridePid'] ? $this->mConf['overridePid'] : $this->getFrontendController()->id); $this->entryLevel = (int) $this->mConf['entryLevel']; $this->gpVars = GeneralUtility::_GPmerged($this->prefixId); \CommerceTeam\Commerce\Utility\GeneralUtility::initializeFeUserBasket(); $this->gpVars['basketHashValue'] = $this->getBasket()->getBasketHashValue(); if (!is_object($this->category)) { $this->category = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Domain\\Model\\Category', $this->mConf['category'], $this->getFrontendController()->sys_language_uid); $this->category->loadData(); } $returnArray = array(); $returnArray = $this->getCategoryRootlineforTypoScript((int) $this->gpVars['catUid'], $returnArray); /* * Add product to rootline, if a product is displayed and showProducts * is set via TS */ if ($this->mConf['showProducts'] == 1 && $this->gpVars['showUid'] > 0) { /** * Product. * * @var \CommerceTeam\Commerce\Domain\Model\Product $product */ $product = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Domain\\Model\\Product', $this->gpVars['showUid'], $this->getFrontendController()->sys_language_uid); $product->loadData(); /** * Category. * * @var \CommerceTeam\Commerce\Domain\Model\Category $category */ $category = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Domain\\Model\\Category', $this->gpVars['catUid'], $this->getFrontendController()->sys_language_uid); $category->loadData(); $addGetvars = $this->separator . $this->prefixId . '[showUid]=' . $product->getUid() . $this->separator . $this->prefixId . '[catUid]=' . $category->getUid(); if (is_string($this->gpVars['basketHashValue'])) { $addGetvars .= $this->separator . $this->prefixId . '[basketHashValue]=' . $this->gpVars['basketHashValue']; } $cHash = $this->generateChash($addGetvars . $this->getFrontendController()->linkVars); /* * Currently no Navtitle in tx_commerce_products * 'nav_title' => $ProductObject->get_navtitle(), */ if ($product->getUid() == $this->gpVars['showUid']) { $itemState = 'CUR'; $itemStateList = 'CUR,NO'; } else { $itemState = 'NO'; $itemStateList = 'NO'; } $returnArray[] = array('uid' => $this->pid, '_ADD_GETVARS' => $addGetvars . $this->separator . 'cHash=' . $cHash, 'ITEM_STATE' => $itemState, 'ITEM_STATES_LIST' => $itemStateList, 'title' => $product->getTitle(), '_PAGES_OVERLAY' => $product->getTitle()); } if ($this->entryLevel) { for ($i = 0; $i < $this->entryLevel; $i++) { array_shift($returnArray); } } return $returnArray; }