Exemple #1
0
 /**
  * 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'] : $GLOBALS['TSFE']->id);
     $this->gpVars = GeneralUtility::_GPmerged($this->prefixId);
     Tx_Commerce_Utility_GeneralUtility::initializeFeUserBasket();
     $this->gpVars['basketHashValue'] = $GLOBALS['TSFE']->fe_user->tx_commerce_basket->getBasketHashValue();
     if (!is_object($this->category)) {
         $this->category = GeneralUtility::makeInstance('Tx_Commerce_Domain_Model_Category', $this->mConf['category'], $this->getFrontendController()->sys_language_uid);
         $this->category->loadData();
     }
     $returnArray = array();
     $returnArray = $this->getCategoryRootlineforTypoScript($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 Tx_Commerce_Domain_Model_Product $productObject
          */
         $productObject = GeneralUtility::makeInstance('Tx_Commerce_Domain_Model_Product', $this->gpVars['showUid'], $this->getFrontendController()->sys_language_uid);
         $productObject->loadData();
         /**
          * Category
          *
          * @var Tx_Commerce_Domain_Model_Category $categoryObject
          */
         $categoryObject = GeneralUtility::makeInstance('Tx_Commerce_Domain_Model_Category', $this->gpVars['catUid'], $this->getFrontendController()->sys_language_uid);
         $categoryObject->loadData();
         $addGetvars = $this->separator . $this->prefixId . '[showUid]=' . $productObject->getUid() . $this->separator . $this->prefixId . '[catUid]=' . $categoryObject->getUid();
         if (is_string($this->gpVars['basketHashValue'])) {
             $addGetvars .= $this->separator . $this->prefixId . '[basketHashValue]=' . $this->gpVars['basketHashValue'];
         }
         $cHash = $this->generateChash($addGetvars . $GLOBALS['TSFE']->linkVars);
         /**
          * Currentyl no Navtitle in tx_commerce_products
          * 'nav_title' => $ProductObject->get_navtitle(),
          */
         if ($productObject->getUid() == $this->gpVars['showUid']) {
             $itemState = 'CUR';
             $itemStateList = 'CUR,NO';
         } else {
             $itemState = 'NO';
             $itemStateList = 'NO';
         }
         $returnArray[] = array('title' => $productObject->getTitle(), 'uid' => $this->pid, '_ADD_GETVARS' => $addGetvars . $this->separator . 'cHash=' . $cHash, 'ITEM_STATE' => $itemState, 'ITEM_STATES_LIST' => $itemStateList, '_PAGES_OVERLAY' => $productObject->getTitle());
     }
     return $returnArray;
 }
Exemple #2
0
 /**
  * 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();
     Tx_Commerce_Utility_GeneralUtility::initializeFeUserBasket();
     $this->pid = $this->getFrontendController()->id;
     $this->basketHashValue = $this->getFrontendController()->fe_user->tx_commerce_basket->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'];
     }
 }