/** * 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 Tx_Commerce_Domain_Model_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 markers needed for the article and the basket form */ public function getArticleMarker(Tx_Commerce_Domain_Model_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['HIDDENFIELDS'] .= '<input type="hidden" name="' . $this->prefixId . '[artAddUid][' . $article->getUid() . '][price_id]" value="" />'; $markerArray['ARTICLE_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'] = Tx_Commerce_ViewHelpers_Money::format($article->getPriceNet(), $this->currency); $markerArray['ARTICLE_PRICE_GROSS'] = Tx_Commerce_ViewHelpers_Money::format($article->getPriceGross(), $this->currency); $markerArray['DELIVERY_PRICE_NET'] = Tx_Commerce_ViewHelpers_Money::format($article->getDeliveryCostNet(), $this->currency); $markerArray['DELIVERY_PRICE_GROSS'] = Tx_Commerce_ViewHelpers_Money::format($article->getDeliveryCostGross(), $this->currency); if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_pibase.php']['articleMarker'])) { GeneralUtility::deprecationLog(' hook $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'commerce/lib/class.tx_commerce_pibase.php\'][\'articleMarker\'] 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\'][\'articleMarker\'] '); foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_pibase.php']['articleMarker'] as $classRef) { $hookObj =& GeneralUtility::getUserObj($classRef); if (method_exists($hookObj, 'additionalMarkerArticle')) { $markerArray = $hookObj->additionalMarkerArticle($markerArray, $article, $this); } } } if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/Classes/Controller/BaseController.php']['articleMarker'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/Classes/Controller/BaseController.php']['articleMarker'] as $classRef) { $hookObj =& GeneralUtility::getUserObj($classRef); if (method_exists($hookObj, 'additionalMarkerArticle')) { $markerArray = $hookObj->additionalMarkerArticle($markerArray, $article, $this); } } } return $markerArray; }
/** * Net price without the scale calculation * * @return float */ public function getNoScalePriceNet() { return $this->article->getPriceNet(); }