Пример #1
0
    public function getallrate()
    {
        $obj = new helpers();
        $resultsPerPage = 3;
        $paged = Input::get('page');
        $product_id = Input::get('product_id');
        if ($paged > 0) {
            $page_limit = $resultsPerPage * $paged;
            $next_check_page = $page_limit + 3;
        } else {
            $page_limit = 0;
            $next_check_page = 1;
        }
        $rating = DB::table('product_rating')->leftJoin('brandmembers', 'brandmembers.id', '=', 'product_rating.user_id')->select('product_rating.*', 'brandmembers.username as buser')->where('product_rating.status', 1)->where('product_rating.product_id', $product_id)->orderBy('product_rating.created_on', 'DESC')->skip($page_limit)->take($resultsPerPage)->get();
        // For Next load more
        $rating_count_arr = DB::table('product_rating')->leftJoin('brandmembers', 'brandmembers.id', '=', 'product_rating.user_id')->select('product_rating.*')->where('product_rating.status', 1)->where('product_rating.product_id', $product_id)->skip($next_check_page)->take($resultsPerPage)->get();
        foreach ($rating as $prate) {
            ?>
        <div class="rating_block clearfix">
          <h5 class="text-capitalize"><?php 
            echo $prate->rating_title;
            ?>
</h5>
              <div class="total_rev"><p> &ldquo; <?php 
            echo $prate->comment;
            ?>
  &rdquo;</p>
                <div class="ratn_box">
                  <div id="rate<?php 
            echo $prate->rating_id;
            ?>
"></div>
                </div>
              </div>
              <div class="bot_rev">
                <p class="author pull-left">Authored by <a href=""><?php 
            echo !empty($prate->username) ? $prate->username : $prate->buser;
            ?>
</a> </p>
                <p class="date pull-left"><?php 
            echo $obj->time_elapsed_string(strtotime($prate->created_on));
            ?>
</p>
              </div>
         </div>
          <script>
            $(document).ready(function(){
              $('#rate<?php 
            echo $prate->rating_id;
            ?>
').raty({
              readOnly: true,
              score: <?php 
            echo $prate->rating_value;
            ?>
,
              starHalf    : '<?php 
            echo url();
            ?>
/public/frontend/css/images/star-half.png',
              starOff     : '<?php 
            echo url();
            ?>
/public/frontend/css/images/star-off.png',
              starOn      : '<?php 
            echo url();
            ?>
/public/frontend/css/images/star-on.png'  , 
              });
            });
          </script>
        <?php 
        }
        // if(count($rating) == $resultsPerPage){
        if (count($rating_count_arr) > 0) {
            ?>

		 	<!-- <button class="loadmore" data-page="<?php 
            echo $paged + 1;
            ?>
">Load More</button> -->
            <div class="wrap_load">
		 	<a href="javascript:void(0);" class="btn btn-special loadmore" data-page="<?php 
            echo $paged + 1;
            ?>
">View More Reviews</a><span class="disable_click"></span>
            </div>
		 <?php 
        }
        //        else{
        //  	echo "<h3>No More Rating</h3>";
        // }
    }