/** * Main function called by insert plugin * * @param string $content Content * @param array $conf Configuration * * @return string HTML-Content */ public function main($content = '', array $conf = array()) { $this->init($conf); $hookObjectsArr = array(); if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/pi2/class.tx_commerce_pi2.php']['main'])) { GeneralUtility::deprecationLog(' hook $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'commerce/pi2/class.tx_commerce_pi2.php\'][\'main\'] is deprecated since commerce 1.0.0, it will be removed in commerce 1.4.0, please use instead $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'commerce/Classes/Controller/BasketController.php\'][\'main\'] '); foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/pi2/class.tx_commerce_pi2.php']['main'] as $classRef) { $hookObjectsArr[] = GeneralUtility::getUserObj($classRef); } } if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/Classes/Controller/BasketController.php']['main'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/Classes/Controller/BasketController.php']['main'] as $classRef) { $hookObjectsArr[] = GeneralUtility::getUserObj($classRef); } } foreach ($hookObjectsArr as $hookObj) { if (method_exists($hookObj, 'postInit')) { $result = $hookObj->postInit($this); if ($result === FALSE) { return $this->pi_wrapInBaseClass($this->getContent()); } } } $regularArticleCount = $this->basket->getArticleTypeCountFromList(explode(',', $this->conf['regularArticleTypes'])); if (!$this->basket->getItemsCount() && !$regularArticleCount) { // If basket is empty, it should be rewritable, release locks, if there are any $this->basket->releaseReadOnly(); $this->basket->storeData(); } if ($this->basket->getItemsCount() && $regularArticleCount) { // Get template switch ($this->handle) { case 'HANDLING': $this->handleBasket(); break; case 'QUICKVIEW': $this->getQuickView(); break; default: $this->generateBasket(); } } else { if ($this->handle == 'QUICKVIEW') { $templateMarker = '###PRODUCT_BASKET_QUICKVIEW_EMPTY###'; } else { $templateMarker = '###PRODUCT_BASKET_EMPTY###'; } $template = $this->cObj->getSubpart($this->getTemplateCode(), $templateMarker); $markerArray = $this->languageMarker; $markerArray['###EMPTY_BASKET###'] = $this->cObj->cObjGetSingle($this->conf['emptyContent'], $this->conf['emptyContent.']); $markerArray['###NO_STOCK MESSAGE###'] = $this->noStock; $this->pi_linkTP('', array(), 0, $this->conf['basketPid']); $basketArray['###BASKETURL###'] = $this->cObj->lastTypoLinkUrl; $this->pi_linkTP('', array(), 0, $this->conf['checkoutPid']); $basketArray['###URL_CHECKOUT###'] = $this->cObj->lastTypoLinkUrl; // Hook for additional markers in empty quick view basket template foreach ($hookObjectsArr as $hookObj) { if (method_exists($hookObj, 'additionalMarker')) { $markerArray = $hookObj->additionalMarker($markerArray, $this); } } $this->setContent($this->cObj->substituteMarkerArray($template, $markerArray)); } $this->setContent($this->cObj->substituteMarkerArray($this->getContent(), $this->languageMarker)); return $this->pi_wrapInBaseClass($content . $this->getContent()); }