/** * Renders the given Basket to the Template * This Method will not replace the Subpart, you have to replace your subpart * in your template by you own * * @param Tx_Commerce_Domain_Model_Basket $basketObj Basket * @param string $subpartMarker Subpart Template Subpart * @param array|bool $articletypes Articletypes * @param string $lineTemplate Line templates * * @return string $content HTML-Ccontent from the given Subpart */ public function makeBasketView(Tx_Commerce_Domain_Model_Basket $basketObj, $subpartMarker, array $articletypes = array(), $lineTemplate = '###LISTING_ARTICLE###') { $template = $this->cObj->getSubpart($this->templateCode, $subpartMarker); if (!is_array($lineTemplate)) { $temp = $lineTemplate; $lineTemplate = array(); $lineTemplate[] = $temp; } else { /** * Check if the subpart is existing, and if not, remove from array */ $tmpArray = array(); foreach ($lineTemplate as $subpartMarker) { $subpartContent = $this->cObj->getSubpart($template, $subpartMarker); if (!empty($subpartContent)) { $tmpArray[] = $subpartMarker; } } $lineTemplate = $tmpArray; unset($tmpArray); } $templateElements = count($lineTemplate); if ($templateElements) { /** * Get All Articles in this basket and genarte HTMl-Content per row */ $articleLines = ''; $count = 0; /** * Item * * @var $itemObj Tx_Commerce_Domain_Model_BasketItem */ foreach ($basketObj->getBasketItems() as $itemObj) { $part = $count % $templateElements; if (is_array($articletypes) && count($articletypes)) { if (in_array($itemObj->getArticleTypeUid(), $articletypes)) { $articleLines .= $this->makeLineView($itemObj, $lineTemplate[$part]); } } else { $articleLines .= $this->makeLineView($itemObj, $lineTemplate[$part]); } ++$count; } $content = $this->cObj->substituteSubpart($template, '###LISTING_ARTICLE###', $articleLines); // Unset Subparts, if not used foreach ($lineTemplate as $subpartMarker) { $content = $this->cObj->substituteSubpart($content, $subpartMarker, ''); } } else { $content = $this->cObj->substituteSubpart($template, '###LISTING_ARTICLE###', ''); } if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_pibase.php']['makeBasketView'])) { GeneralUtility::deprecationLog(' hook $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'commerce/lib/class.tx_commerce_pibase.php\'][\'makeBasketView\'] 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/BaseController.php\'][\'makeBasketView\'] '); foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_pibase.php']['makeBasketView'] as $classRef) { $hookObj =& GeneralUtility::getUserObj($classRef); if (method_exists($hookObj, 'postBasketView')) { $content = $hookObj->postBasketView($content, $articletypes, $lineTemplate, $template, $basketObj, $this); } } } if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/Classes/Controller/BaseController.php']['makeBasketView'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/Classes/Controller/BaseController.php']['makeBasketView'] as $classRef) { $hookObj = GeneralUtility::getUserObj($classRef); if (method_exists($hookObj, 'postBasketView')) { $content = $hookObj->postBasketView($content, $articletypes, $lineTemplate, $template, $basketObj, $this); } } } $content = $this->cObj->substituteSubpart($content, '###LISTING_BASKET_WEB###', $this->makeBasketInformation($basketObj, '###LISTING_BASKET_WEB###')); return $content; }