VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: ryo_linkin_park on July 04, 2012, 00:34:36 AM

Title: Failed at Sending Review and Rating v2.0.8a
Post by: ryo_linkin_park on July 04, 2012, 00:34:36 AM
i try to send a review; write comment, determined with stars my rating than click to submit review button than following error appears
also take with sucess message

vmError: VirtueMartModelRatings::Error store votes TableRating_votes::store failed - Duplicate entry '3-0' for key 2 SQL=INSERT INTO `jos_virtuemart_rating_votes` ( `virtuemart_rating_vote_id`,`virtuemart_product_id`,`vote`,`lastip`,`created_on`,`created_by`,`modified_on`,`modified_by` ) VALUES ( '0','3','5','88.236.91.215','','0','2012-07-03 22:18:29','62' )
vmError: VirtueMartModelRatings::Error store review TableRating_reviews::store failed - Duplicate entry '3-0' for key 2 SQL=INSERT INTO `jos_virtuemart_rating_reviews` ( `virtuemart_rating_review_id`,`virtuemart_product_id`,`comment`,`review_ok`,`review_rates`,`review_ratingcount`,`review_rating`,`review_editable`,`lastip`,`published`,`created_on`,`created_by`,`modified_on`,`modified_by` ) VALUES ( '0','3','3 Farklı Şekilde Kullanılabilir. Yanyana Sanatsal bir görüntü Oluşturur 100x60cm','0','5','1','5','0','88.236.91.215','0','','0','2012-07-03 22:18:29','62' )




i go to back-end there is a new review and i publishing but stars doesn't see in the column and in to front-end doesn't have to comments but its have to rating results

its seems to like system works fine with ratings, but doesn't works with comments review.
after i checked the .gif path than see vm system auto add double "//"

example :
sitename.com//components/com_virtuemart/assets/images/stars/5.gif

also there is no "images/stars" directory and necessary gifs in default Vm 2.0.8a version

my site with demo product that is ready for review and comment:
http://www.lpturkiye.com/index.php/magaza/kanvaslar/lp-maestro-oezel-tasarm-3-parca-detail

Mod edit:   bump message removed.  http://forum.virtuemart.net/index.php?board=114.0
Title: Re: Failed at Sending Review and Rating v2.0.8a
Post by: alatak on July 04, 2012, 17:28:28 PM
Hello,

Txs, we have fixed this issue.
The fix will be in the 2.0.8c.

Quoteits seems to like system works fine with ratings, but doesn't works with comments review.
after i checked the .gif path than see vm system auto add double "//"

example :
sitename.com//components/com_virtuemart/assets/images/stars/5.gif

also there is no "images/stars" directory and necessary gifs in default Vm 2.0.8a version
where do you have that code?
because the folder stars has been removed a long time ago. On the back end, the stars are in the file vm-sprite. On the front end , they come from color-stars.
Title: Re: Failed at Sending Review and Rating v2.0.8a
Post by: maxxer on July 30, 2012, 17:46:04 PM
it's not a problem of gif images, but of duplicate ID!
When you add a review for a product which already has one (same goes for rating) it fails with duplicate key error.
Even worse, after the sql error you get a green message sayng "Review accepted" or something like that!

the problem is the virtuemart_rating_id. when it's a new rating the value is 0, but instead of triggering an auto-increment it is inserted as a '0', so the sql fails because of duplicate entry.
Title: Re: Failed at Sending Review and Rating v2.0.8a
Post by: maxxer on July 30, 2012, 18:16:01 PM
this code ran twice triggers the error. it will create duplicate entry for key 0-1

        $data = array (
            'vote'=>3,
            'virtuemart_product_id'=>1,
            'virtuemart_rating_vote_id'=>0,
            'created_by'=>1,
        ); 
        $model = VmModel::getModel ('ratings');
        $votesTable = $model->getTable('rating_votes');
        $votesTable->bindChecknStore($data,true);
        $errors = $votesTable->getErrors();