We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16886
    • 40 Posts
    Wow! Amazing fast answer and best of all it works perfectly for me.
    Thanks a lot
    Greetings LeftHanded
      I love ModX!
      • 10076
      • 1,024 Posts
      huh

      would this be correct call from a documents content:

      [!star_rating? &docID=`77` &cssFile=`assets/css/snippets/star-rating.css` !]

      followed instr step by step. doc 77 is doc where call resides and container that holds docs to be rated.

      The whole lot is displayed vertically,check http://www.linguamici.it/index.php?id=77 .

      What am I doing wrong?
        • 11975
        • 2,542 Posts
        Hi folks,

        Here is a method to allow ditto to sort documents using star rating values

        We are going to create a new widget to manage the output value.

        Open the file /manager/actions/mutate_tmplvars.dynamic.php

        add line 114:

        widgetParams['star_rating']		= '&mode=Mode;list;most_rated,most_voted';
        


        and line 353

        <option value="star_rating" <?php echo ($content['display']=='star_rating')? "selected='selected'":""; ?>>Star Rating</option>
        


        Now open the file /manager/includes/tmplvars.format.inc.php

        add around line 305

        
        			case 'star_rating':
        			$a = explode(":",$value);			
        			$operation = $params['mode'];
        			switch($operation){
        			
        				case 'most_rated':
        				$calcul = ($a[1] > 0) ? $a[0] / $a[1] : $value;
        				$result = round($calcul,1);
        				break;
        				
        				case 'most_voted':
        				$result = (isset($a[1])) ? $a[1] : $value;
        				break;
        			
        			}
        			
        			$o = $result;
        			
        			break;
        
        



        Now you will have a new widget which will allow you to use the star rating value to sort with ditto
        You even have the choice beetwen most rated and most voted.

        Hope that helps

        :-)
          Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
          • 9053
          • 18 Posts
          heliotrope,

          I didn’t get it.. what should i do next after creating widget? I’m kinda newbie in MODx :]

          P.S. I use CSS Star Rating 1.0
            "Sorry for my english"
            • 11975
            • 2,542 Posts
            Hi,

            First of all my apologises for my basic english.

            Once you’ve made the required changes to add the new widget, you have to edit the TV used to store the rating values.
            Select the star_rating widget and the way you want the values (xx:yyy) be translated.
            most voted will return the number of votes 5 if star rating TV is (20:5) for instance.
            most rated the rate once calulated 4.0 if star rating TV is (20:5) for instance.

            Hope that helps

            :-)



              Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
              • 9053
              • 18 Posts
              Thanks for you answer! I’ve assigned widget to star_rating TV, and it works nicely (values changing as you described). But then I’ve added "&sortBy=`tvstar_rating`" into Ditto call, nothing got changed. What am I doing wrong? Maybe I’ll try the latest Ditto RC a bit later..
                "Sorry for my english"
                • 11975
                • 2,542 Posts
                You should update your ditto snippet.
                the last version is much more powerful.

                :-)
                  Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                  • 9053
                  • 18 Posts
                  Yep, it works perfectly with Ditto2.0 RC3! Thanx!
                    "Sorry for my english"
                  • Hi,
                    i use MODx ver0.9.5 and css star rating 2beta.
                    i have problems with showing "currently" rating, i used the MODx rating image even for good resualt but....
                    you can watch the resualts in IE7 and FireFox2 for understanding the problem.

                    IE7


                    FireFox2

                    i must put mouse pointer under stars for rating in FireFox2, you can watch it in second firefox picture.

                    you may watch it live at: http://Boplo.ir


                    Regards
                    AHHP
                      God loves me. 【ツ】


                      MODX.ir (Persian Support)

                      Boplo.ir/modx/ (Persian)
                    • Excuse me!
                      my problem hasn’t solved and i can’t use this snippet yet.


                      can’t anyone help me?
                        God loves me. 【ツ】


                        MODX.ir (Persian Support)

                        Boplo.ir/modx/ (Persian)