View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0004563 | OXID eShop (all versions) | 1.02. Price calculations (discounts, coupons, additional costs etc.) | public | 2012-09-27 17:57 | 2012-12-07 15:20 |
| Reporter | WBL_BjoernLange | Assigned To | |||
| Priority | urgent | Severity | major | Reproducibility | always |
| Status | resolved | Resolution | fixed | ||
| Product Version | Past development | ||||
| Fixed in Version | 4.6.6 revision 54646 | ||||
| Summary | 0004563: Broken article price "calculation" after template change | ||||
| Description | oxArticle::getBasePrice depends on oxArticle::_getAmountPrice. And oxArticle::_getAmountPrice uses the class property oxArticle::_oAmountPriceList. oxArticle::_oAmountPriceList is also used for displaying the amount price info with oxArticle::loadAmountPriceInfo: if ( $this->_oAmountPriceInfo === null ) { $this->_oAmountPriceInfo = array(); if ( count( ( $oAmPriceList = $this->_getAmountPriceList() ) ) ) { $this->_oAmountPriceInfo = $this->_fillAmountPriceList( $oAmPriceList ); } } But there is a flaw hidden in oxArticle::_fillAmountPriceList(). You change the the numeric value of oxprice2article__oxaddabs in the formatted currency and save it in an object which is referenced in oxArticle::_oAmountPriceList: $oAmPriceList[$sId]->oxprice2article__oxaddabs = new oxField( $oLang->formatCurrency( $myUtils->fRound( $oItemPrice->getBruttoPrice(), $oCur ) ) ); $oAmPriceList[$sId]->fnetprice = $oLang->formatCurrency( $myUtils->fRound($oItemPrice->getNettoPrice(), $oCur ) ); $oAmPriceList[$sId]->fbrutprice = $oLang->formatCurrency( $myUtils->fRound($oItemPrice->getBruttoPrice(), $oCur ) ) If you call oxArticle::getPrice(1), after a previous call of oxArticle::loadAmountPriceInfo with an saved amount price for the amount 1, the base price calculation fails, because oxprice2article__oxaddabs for the amount 1 contains a string: public function getPrice( $dAmount = 1 ) { $myConfig = $this->getConfig(); // Performance if ( !$myConfig->getConfigParam( 'bl_perfLoadPrice' ) || !$this->_blLoadPrice ) { return; } // return cached result, since oPrice is created ONLY in this function [or function of EQUAL level] if ( $dAmount != 1 || $this->_oPrice === null ) { $oPrice = oxNew( 'oxPrice' ); // get base $oPrice->setPrice( $this->getBasePrice( $dAmount ) ); // <--- This returns the formatted currency // price handling if ( !$this->_blCalcPrice && $dAmount == 1 ) { return $this->_oPrice = $oPrice; } $this->_calculatePrice( $oPrice ); | ||||
| Tags | Scale Price | ||||
| Theme | Both | ||||
| Browser | All | ||||
| PHP Version | any | ||||
| Database Version | any | ||||
| related to | 0004210 | resolved | Linas Kukulskis | oxArticle::getPrice( $iAmount ) doesn't calculate scale prices after the method oxArticle::loadAmountPriceInfo() is called |