Example #1
0
 /**
  * Renders the Article Marker and all additional informations needed for
  * a basket form. This Method will not replace the Subpart, you have to
  * replace your subpart in your template by you own.
  *
  * @param Article $article Article the marker based on
  * @param bool $priceid If set true (default) the price-id will be rendered
  *     into the hiddenfields, otherwhise not
  *
  * @return array $markerArray needed for the article and the basket form
  */
 public function getArticleMarker(Article $article, $priceid = false)
 {
     if ($this->handle && is_array($this->conf[$this->handle . '.']) && is_array($this->conf[$this->handle . '.']['articles.'])) {
         $tsconf = $this->conf[$this->handle . '.']['articles.'];
     } else {
         // Set default
         $tsconf = $this->conf['singleView.']['articles.'];
     }
     $markerArray = $this->generateMarkerArray($article->returnAssocArray(), $tsconf, 'article_', 'tx_commerce_article');
     if ($article->getSupplierUid()) {
         $markerArray['ARTICLE_SUPPLIERNAME'] = $article->getSupplierName();
     } else {
         $markerArray['ARTICLE_SUPPLIERNAME'] = '';
     }
     /*
      * STARTFRM and HIDDENFIELDS are old marker, used bevor Version 0.9.3
      * Still existing for compatibility reasons
      * Please use ARTICLE_HIDDENFIEDLS, ARTICLE_FORMACTION
      * and ARTICLE_FORMNAME, ARTICLE_HIDDENCATUID
      */
     $markerArray['STARTFRM'] = '<form name="basket_' . $article->getUid() . '" action="' . $this->pi_getPageLink($this->conf['basketPid']) . '" method="post">';
     $markerArray['HIDDENFIELDS'] = '<input type="hidden" name="' . $this->prefixId . '[catUid]" value="' . $this->category->getUid() . '" />';
     $markerArray['ARTICLE_FORMACTION'] = $this->pi_getPageLink($this->conf['basketPid']);
     $markerArray['ARTICLE_FORMNAME'] = 'basket_' . $article->getUid();
     $markerArray['ARTICLE_HIDDENCATUID'] = '<input type="hidden" name="' . $this->prefixId . '[catUid]" value="' . $this->category->getUid() . '" />';
     $markerArray['ARTICLE_HIDDENFIELDS'] = '';
     /*
      * Build Link to put one of this article in basket
      */
     if ($tsconf['addToBasketLink.']) {
         $typoLinkConf = $tsconf['addToBasketLink.'];
     }
     $typoLinkConf['parameter'] = $this->conf['basketPid'];
     $typoLinkConf['useCacheHash'] = 1;
     $typoLinkConf['additionalParams'] .= $this->argSeparator . $this->prefixId . '[catUid]=' . $this->category->getUid();
     if ($priceid == true) {
         $markerArray['ARTICLE_HIDDENFIELDS'] .= '<input type="hidden" name="' . $this->prefixId . '[artAddUid][' . $article->getUid() . '][price_id]" value="' . $article->getPriceUid() . '" />';
         $markerArray['HIDDENFIELDS'] .= '<input type="hidden" name="' . $this->prefixId . '[artAddUid][' . $article->getUid() . '][price_id]" value="' . $article->getPriceUid() . '" />';
         $typoLinkConf['additionalParams'] .= $this->argSeparator . $this->prefixId . '[artAddUid][' . $article->getUid() . '][price_id]=' . $article->getPriceUid();
     } else {
         $markerArray['ARTICLE_HIDDENFIELDS'] .= '<input type="hidden" name="' . $this->prefixId . '[artAddUid][' . $article->getUid() . '][price_id]" value="" />';
         $markerArray['HIDDENFIELDS'] .= '<input type="hidden" name="' . $this->prefixId . '[artAddUid][' . $article->getUid() . '][price_id]" value="" />';
         $typoLinkConf['additionalParams'] .= $this->argSeparator . $this->prefixId . '[artAddUid][' . $article->getUid() . '][price_id]=';
     }
     $typoLinkConf['additionalParams'] .= $this->argSeparator . $this->prefixId . '[artAddUid][' . $article->getUid() . '][count]=1';
     $markerArray['LINKTOPUTINBASKET'] = $this->cObj->typoLink($this->pi_getLL('lang_addtobasketlink'), $typoLinkConf);
     $markerArray['QTY_INPUT_VALUE'] = $this->getArticleAmount($article->getUid(), $tsconf);
     $markerArray['QTY_INPUT_NAME'] = $this->prefixId . '[artAddUid][' . $article->getUid() . '][count]';
     $markerArray['ARTICLE_NUMBER'] = $article->getOrdernumber();
     $markerArray['ARTICLE_ORDERNUMBER'] = $article->getOrdernumber();
     $markerArray['ARTICLE_PRICE_NET'] = Money::format($article->getPriceNet(), $this->currency);
     $markerArray['ARTICLE_PRICE_GROSS'] = Money::format($article->getPriceGross(), $this->currency);
     $markerArray['DELIVERY_PRICE_NET'] = Money::format($article->getDeliveryCostNet(), $this->currency);
     $markerArray['DELIVERY_PRICE_GROSS'] = Money::format($article->getDeliveryCostGross(), $this->currency);
     $hooks = HookFactory::getHooks('Controller/BaseController', 'getArticleMarker');
     foreach ($hooks as $hook) {
         if (method_exists($hook, 'additionalMarkerArticle')) {
             $markerArray = $hook->additionalMarkerArticle($markerArray, $article, $this);
         }
     }
     return $markerArray;
 }
Example #2
0
 /**
  * Ordernumber of item.
  *
  * @return string Ordernumber of Articles
  */
 public function getOrderNumber()
 {
     return $this->article->getOrdernumber();
 }