View Issue Details

IDProjectCategoryView StatusLast Update
0003115OXID eShop (all versions)1.01. Products (product, categories, manufacturer, promotions etc.)public2012-12-07 14:23
Reporterstefan2 Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.5.0 revision 34568 
Fixed in Version4.5.9 revision 43186 
Summary0003115: After deleting a review "OXRATING" and "OXRATINGCNT" in "oxarticles" are untouched
DescriptionOk, 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.
TagsRatings, Reviews
ThemeBoth
BrowserAll
PHP Versionany
Database Versionany

Relationships

related to 0002070 resolvedLinas Kukulskis OXRATINGCNT will not updated 

Activities

stefan2

2011-08-08 11:23

reporter   ~0004940

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]

Linas Kukulskis

2012-03-20 12:30

reporter   ~0006040

allready fixed with 0002070 bug fix