/** * 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); $hooks = HookFactory::getHooks('Controller/BasketController', 'main'); foreach ($hooks 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 ($hooks 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()); }