VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: jiapei100 on July 12, 2012, 23:42:14 PM

Title: Customer Reviews in specified paragraph,instead of on the product details page?
Post by: jiapei100 on July 12, 2012, 23:42:14 PM
Hi, all:

I'm just wondering how to enable Customer Reviews in my specified paragraph, instead of just showing on the bottom of product details?

I tried to put the customer Review in one of my tab, for example, http://visionmisc.com/index.php/products/ip-cameras/fi8907w-black-detail (http://visionmisc.com/index.php/products/ip-cameras/fi8907w-black-detail)
I can show the Review division, however, none is functioning well. No rating, no characters written counted during my typing the reviews.

Any suggestions please?

Best Regards
Pei
Title: Re: Customer Reviews in specified paragraph,instead of on the product details page?
Post by: ivus on July 18, 2012, 09:19:50 AM
Hi jiapei100,

at a quick glance, from what I can see it looks like you've moved the entire comments block into a tab, which is fine, I did the same thing an it looks great. However checking Firebug/Inspector it shows that a javascript error occurred specifically "refrech_counter". I also checked for "check_reviewform()". Both these JS functions are missing from your page.

To fix this, chech that you have the following code in your page:


         $reviewJavascript = "
            function check_reviewform() {
               var form = document.getElementById('reviewform');
   
               var ausgewaehlt = false;
   
               if (form.comment.value.length < ". VmConfig::get('reviews_minimum_comment_length', 100).") {
                  alert('". addslashes( JText::sprintf('COM_VIRTUEMART_REVIEW_ERR_COMMENT1_JS', VmConfig::get('reviews_minimum_comment_length', 100)) )."');
                  return false;
               }
               else if (form.comment.value.length > ". VmConfig::get('reviews_maximum_comment_length', 2000).") {
                  alert('". addslashes( JText::sprintf('COM_VIRTUEMART_REVIEW_ERR_COMMENT2_JS', VmConfig::get('reviews_maximum_comment_length', 2000)) )."');
                  return false;
               }
               else {
                  return true;
               }
            }
            function refresh_counter() {
               var form = document.getElementById('reviewform');
               form.counter.value= form.comment.value.length;
            }
            jQuery(function($) {
               var steps = ".$maxrating.";
               var parentPos= $('.write-reviews .ratingbox').position();
               //var boxWidth = $('.write-reviews .ratingbox').width();// nbr of total pixels
               var boxWidth = 90;// nbr of total pixels
               var starSize = 18;
               var ratingboxPos= $('.write-reviews .ratingbox').offset();

               $('.write-reviews .ratingbox').mousemove( function(e){
                  var span = $(this).children();
                  var dif = e.pageX-ratingboxPos.left; // nbr of pixels
                  difRatio = Math.floor(dif/boxWidth* steps )+1; //step
                  span.width(difRatio*starSize);
                  $('#vote').val(difRatio);
                  //console.log('note = ', difRatio);
               });
            });
            ";
         $document = JFactory::getDocument();
         $document->addScriptDeclaration($reviewJavascript);

I hope you are using layout overrides to style your pages. Hacking the core gives you no point of reference in case something breaks.

I hope this helps.

Title: Re: Customer Reviews in specified paragraph,instead of on the product details page?
Post by: DaggaTora on October 24, 2012, 10:10:54 AM
Magic Ivus... I have a problem:

Reviews are only available for customers who bought that product, but mine are child products set only by color... do you know who to write the review in the parent and show it in parent and its childs?

Because customers keep saying to me that they try to write the review in the parent and i keep telling them "Please, write it in the color you bought" and is a little silly to have a review on yellow and not in the parent, in blue or red  ;D

Thank you!