示例#1
0
 /**
  * Renders from the given Basket the Sum Information to HTML-Code
  * This Method will not replace the Subpart, you have to replace your
  * subpart in your template by you own.
  *
  * @param Basket $basket Basket
  * @param string $subpartTemplate Subpart Template Subpart
  *
  * @return string $content HTML-Ccontent from the given Subpart
  * @abstract
  * Renders the following MARKER
  * ###LABEL_SUM_ARTICLE_NET### ###SUM_ARTICLE_NET###
  * ###LABEL_SUM_ARTICLE_GROSS### ###SUM_ARTICLE_GROSS###
  * ###LABEL_SUM_SHIPPING_NET### ###SUM_SHIPPING_NET###
  * ###LABEL_SUM_SHIPPING_GROSS### ###SUM_SHIPPING_GROSS###
  * ###LABEL_SUM_NET###
  * ###SUM_NET###
  * ###LABEL_SUM_TAX###
  * ###SUM_TAX###
  * ###LABEL_SUM_GROSS### ###SUM_GROSS###
  */
 public function makeBasketInformation(Basket $basket, $subpartTemplate)
 {
     $template = $this->cObj->getSubpart($this->templateCode, $subpartTemplate);
     $basket->recalculateSums();
     $markerArray['###SUM_NET###'] = Money::format($basket->getSumNet(), $this->currency, $this->showCurrency);
     $markerArray['###SUM_GROSS###'] = Money::format($basket->getSumGross(), $this->currency, $this->showCurrency);
     $sumArticleNet = 0;
     $sumArticleGross = 0;
     $regularArticleTypes = GeneralUtility::intExplode(',', $this->conf['regularArticleTypes']);
     foreach ($regularArticleTypes as $regularArticleType) {
         $sumArticleNet += $basket->getArticleTypeSumNet($regularArticleType);
         $sumArticleGross += $basket->getArticleTypeSumGross($regularArticleType);
     }
     $markerArray['###SUM_ARTICLE_NET###'] = Money::format($sumArticleNet, $this->currency, $this->showCurrency);
     $markerArray['###SUM_ARTICLE_GROSS###'] = Money::format($sumArticleGross, $this->currency, $this->showCurrency);
     $markerArray['###SUM_SHIPPING_NET###'] = Money::format($basket->getArticleTypeSumNet(DELIVERYARTICLETYPE), $this->currency, $this->showCurrency);
     $markerArray['###SUM_SHIPPING_GROSS###'] = Money::format($basket->getArticleTypeSumGross(DELIVERYARTICLETYPE), $this->currency, $this->showCurrency);
     $markerArray['###SHIPPING_TITLE###'] = $basket->getFirstArticleTypeTitle(DELIVERYARTICLETYPE);
     $markerArray['###SUM_PAYMENT_NET###'] = Money::format($basket->getArticleTypeSumNet(PAYMENTARTICLETYPE), $this->currency, $this->showCurrency);
     $markerArray['###SUM_PAYMENT_GROSS###'] = Money::format($basket->getArticleTypeSumGross(PAYMENTARTICLETYPE), $this->currency, $this->showCurrency);
     $markerArray['###PAYMENT_TITLE###'] = $basket->getFirstArticleTypeTitle(PAYMENTARTICLETYPE);
     $markerArray['###PAYMENT_DESCRIPTION###'] = $basket->getFirstArticleTypeDescription(PAYMENTARTICLETYPE);
     $markerArray['###SUM_TAX###'] = Money::format($basket->getTaxSum(), $this->currency, $this->showCurrency);
     $taxRateTemplate = $this->cObj->getSubpart($template, '###TAX_RATE_SUMS###');
     $taxRates = $basket->getTaxRateSums();
     $taxRateRows = '';
     foreach ($taxRates as $taxRate => $taxRateSum) {
         $taxRowArray = array();
         $taxRowArray['###TAX_RATE###'] = $taxRate;
         $taxRowArray['###TAX_RATE_SUM###'] = Money::format($taxRateSum, $this->currency, $this->showCurrency);
         $taxRateRows .= $this->cObj->substituteMarkerArray($taxRateTemplate, $taxRowArray);
     }
     /*
      * Hook for processing Taxes
      */
     $hooks = HookFactory::getHooks('Controller/BaseController', 'makeBasketInformation');
     foreach ($hooks as $hook) {
         if (method_exists($hook, 'processMarkerTaxInformation')) {
             $taxRateRows = $hook->processMarkerTaxInformation($taxRateTemplate, $basket, $this);
         }
     }
     $template = $this->cObj->substituteSubpart($template, '###TAX_RATE_SUMS###', $taxRateRows);
     /*
      * Hook for processing Marker Array
      */
     foreach ($hooks as $hook) {
         if (method_exists($hook, 'processMarkerBasketInformation')) {
             $markerArray = $hook->processMarkerBasketInformation($markerArray, $basket, $this);
         }
     }
     $content = $this->cObj->substituteMarkerArray($template, $markerArray);
     $content = $this->cObj->substituteMarkerArray($content, $this->languageMarker);
     return $content;
 }