View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update | 
|---|---|---|---|---|---|
| 0003115 | OXID eShop (all versions) | 1.01. Products (product, categories, manufacturer, promotions etc.) | public | 2011-08-08 09:59 | 2012-12-07 14:23 | 
| Reporter | stefan2 | Assigned To | |||
| Priority | normal | Severity | minor | Reproducibility | always | 
| Status | resolved | Resolution | fixed | ||
| Product Version | 4.5.0 revision 34568 | ||||
| Fixed in Version | 4.5.9 revision 43186 | ||||
| Summary | 0003115: After deleting a review "OXRATING" and "OXRATINGCNT" in "oxarticles" are untouched | ||||
| Description | Ok, there is something like a different between a review(comment) and the pure rating but if a admin will delete a review its expected that the rating will also deleted. At the moment, the rating value and the rating count in oxarticle are not affected when deleting a review. | ||||
| Tags | Ratings, Reviews | ||||
| Theme | Both | ||||
| Browser | All | ||||
| PHP Version | any | ||||
| Database Version | any | ||||
| related to | 0002070 | resolved | Linas Kukulskis | OXRATINGCNT will not updated | 
|  | A solution, if wanted, could be (first try): admin/article_review.php [code] /** * Deletes selected article review information. * * @return null */ public function delete() { $sRevoxId = oxConfig::getParameter( "rev_oxid" ); $oReview = oxNew( "oxreview" ); $oReview->load( $sRevoxId); if ( $oReview->delete() ) { $this->updateArticle( $oReview->oxreviews__oxobjectid->value ); } } /** * Update Article */ protected function updateArticle( $sArticleId ) { $_oReview = oxNew('oxreview'); $oReviews = $_oReview->loadList('oxarticle', $sArticleId); $oArticle= oxNew('oxarticle'); $oArticle->load( $sArticleId ); $_rating_count = 0; $_rating_sum = 0; foreach ( $oReviews as $oReview ) { $_rating_count++; $_rating_sum += (int)$oReview->oxreviews__oxrating->value; } if ( $_rating_sum > 0 ) { $oArticle->oxarticles__oxrating->setValue( ( $_rating_sum / $_rating_count ) ); } else { $oArticle->oxarticles__oxrating->setValue( 0 ); } $oArticle->oxarticles__oxratingcnt->setValue( $_rating_count ); $oArticle->save(); } [/code] | 
|  | allready fixed with 0002070 bug fix | 
