function execute()
 {
     global $languages_id, $HTTP_GET_VARS, $currencies, $oscTemplate;
     $random_select = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int) $languages_id . "' and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "' and r.reviews_status = 1";
     if (isset($HTTP_GET_VARS['products_id'])) {
         $random_select .= " and p.products_id = '" . (int) $HTTP_GET_VARS['products_id'] . "'";
     }
     $random_select .= " order by r.reviews_id desc limit " . MAX_RANDOM_SELECT_REVIEWS;
     $random_product = tep_random_select($random_select);
     $reviews_box_contents = '';
     if ($random_product) {
         // display random review box
         $rand_review_query = tep_db_query("select substring(reviews_text, 1, 60) as reviews_text from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . (int) $random_product['reviews_id'] . "' and languages_id = '" . (int) $languages_id . "'");
         $rand_review = tep_db_fetch_array($rand_review_query);
         $rand_review_text = tep_break_string(tep_output_string_protected($rand_review['reviews_text']), 15, '-<br />');
         $reviews_box_contents .= '<div class="text-center"><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></div><div><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, 'products_id=' . $random_product['products_id']) . '">' . $rand_review_text . '</a>...</div><div class="text-center" title="' . sprintf(MODULE_BOXES_REVIEWS_BOX_TEXT_OF_5_STARS, $random_product['reviews_rating']) . '">' . tep_draw_stars($random_product['reviews_rating']) . '</div>';
     } elseif (isset($HTTP_GET_VARS['products_id'])) {
         // display 'write a review' box
         $reviews_box_contents .= '<span class="fa fa-thumbs-up"></span> <a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $HTTP_GET_VARS['products_id']) . '">' . MODULE_BOXES_REVIEWS_BOX_WRITE_REVIEW . '</a>';
     } else {
         // display 'no reviews' box
         $reviews_box_contents .= '<p>' . MODULE_BOXES_REVIEWS_BOX_NO_REVIEWS . '</p>';
     }
     ob_start();
     include DIR_WS_MODULES . 'boxes/templates/reviews.php';
     $data = ob_get_clean();
     $oscTemplate->addBlock($data, $this->group);
 }
Exemplo n.º 2
0
 function execute()
 {
     global $languages_id, $HTTP_GET_VARS, $currencies, $oscTemplate;
     $random_select = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int) $languages_id . "' and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "' and r.reviews_status = 1";
     if (isset($HTTP_GET_VARS['products_id'])) {
         $random_select .= " and p.products_id = '" . (int) $HTTP_GET_VARS['products_id'] . "'";
     }
     $random_select .= " order by r.reviews_id desc limit " . MAX_RANDOM_SELECT_REVIEWS;
     $random_product = tep_random_select($random_select);
     $reviews_box_contents = '';
     if ($random_product) {
         // display random review box
         $rand_review_query = tep_db_query("select substring(reviews_text, 1, 60) as reviews_text from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . (int) $random_product['reviews_id'] . "' and languages_id = '" . (int) $languages_id . "'");
         $rand_review = tep_db_fetch_array($rand_review_query);
         $rand_review_text = tep_break_string(tep_output_string_protected($rand_review['reviews_text']), 15, '-<br />');
         $reviews_box_contents .= '<div class="text-center"><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></div><div><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, 'products_id=' . $random_product['products_id']) . '">' . $rand_review_text . '</a>...</div><div class="text-center" title="' . sprintf(MODULE_BOXES_REVIEWS_BOX_TEXT_OF_5_STARS, $random_product['reviews_rating']) . '">' . tep_draw_stars($random_product['reviews_rating']) . '</div>';
     } elseif (isset($HTTP_GET_VARS['products_id'])) {
         // display 'write a review' box
         $reviews_box_contents .= '<span class="glyphicon glyphicon-thumbs-up"></span> <a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $HTTP_GET_VARS['products_id']) . '">' . MODULE_BOXES_REVIEWS_BOX_WRITE_REVIEW . '</a>';
     } else {
         // display 'no reviews' box
         $reviews_box_contents .= '<p>' . MODULE_BOXES_REVIEWS_BOX_NO_REVIEWS . '</p>';
     }
     $data = '<div class="panel panel-default">' . '  <div class="panel-heading"><a href="' . tep_href_link(FILENAME_REVIEWS) . '">' . MODULE_BOXES_REVIEWS_BOX_TITLE . '</a></div>' . '  <div class="panel-body">' . $reviews_box_contents . '</div>' . '</div>';
     if ($this->group == 'boxes_product_page' && isset($HTTP_GET_VARS['products_id'])) {
         $review_query = tep_db_query("select SUBSTRING_INDEX(rd.reviews_text, ' ', 20) as reviews_text, r.reviews_rating, r.reviews_id, r.customers_name, r.date_added, r.reviews_read, p.products_id, p.products_price, p.products_tax_class_id, p.products_image, p.products_model, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where r.products_id = '" . (int) $HTTP_GET_VARS['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int) $languages_id . "' and r.products_id = p.products_id and p.products_status = '1' and r.reviews_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "' order by r.reviews_rating DESC limit " . (int) MODULE_BOXES_REVIEWS_LISTING_LIMIT);
         $data = NULL;
         if (tep_db_num_rows($review_query) > 0) {
             $data .= '<div class="reviews col-xs-12">';
             $data .= '<h2>' . REVIEWS_TEXT_TITLE . '</h2><hr>';
             while ($review = tep_db_fetch_array($review_query)) {
                 $data .= '<blockquote class="col-sm-6">';
                 $data .= '  <p>' . tep_output_string_protected($review['reviews_text']) . ' ... </p>';
                 $review_name = tep_output_string_protected($review['customers_name']);
                 $data .= '  <footer>' . sprintf(REVIEWS_TEXT_RATED, tep_draw_stars($review['reviews_rating']), $review_name, $review_name) . '</footer>';
                 $data .= '</blockquote>';
             }
             $data .= '</div>';
             $data .= '<div class="clearfix"></div>';
         }
     }
     $oscTemplate->addBlock($data, $this->group);
 }
 function execute()
 {
     global $oscTemplate, $_GET, $languages_id;
     $content_width = (int) MODULE_CONTENT_PRODUCT_INFO_REVIEWS_CONTENT_WIDTH;
     $review_query = tep_db_query("select SUBSTRING_INDEX(rd.reviews_text, ' ', 20) as reviews_text, r.reviews_rating, r.reviews_id, r.customers_name, r.date_added, r.reviews_read, p.products_id, p.products_price, p.products_tax_class_id, p.products_image, p.products_model, pd.products_name from reviews r, reviews_description rd, products p, products_description pd where r.products_id = '" . (int) $_GET['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int) $languages_id . "' and r.products_id = p.products_id and p.products_status = '1' and r.reviews_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "' order by r.reviews_rating DESC limit " . (int) MODULE_CONTENT_PRODUCT_INFO_REVIEWS_CONTENT_LIMIT);
     $review_data = NULL;
     if (tep_db_num_rows($review_query) > 0) {
         while ($review = tep_db_fetch_array($review_query)) {
             $review_data .= '<blockquote class="col-sm-6">';
             $review_data .= '  <p>' . tep_output_string_protected($review['reviews_text']) . ' ... </p>';
             $review_name = tep_output_string_protected($review['customers_name']);
             $review_data .= '  <footer>' . sprintf(MODULE_CONTENT_PRODUCT_INFO_REVIEWS_TEXT_RATED, tep_draw_stars($review['reviews_rating']), $review_name, $review_name) . '</footer>';
             $review_data .= '</blockquote>';
         }
         ob_start();
         include DIR_WS_MODULES . 'content/' . $this->group . '/templates/reviews.php';
         $template = ob_get_clean();
         $oscTemplate->addContent($template, $this->group);
     }
 }
        echo tep_output_string_protected($reviews['reviews_text']);
        ?>
</p>
        <div class="hidden" itemprop="dtreviewed" datetime="<?php 
        echo $reviews['date_added'];
        ?>
"><?php 
        echo $reviews['date_added'];
        ?>
</div>
        <div class="hidden" itemprop="itemreviewed"><?php 
        echo $product_info['products_name'];
        ?>
</div>
        <footer><?php 
        echo sprintf(REVIEWS_TEXT_RATED, tep_draw_stars($reviews['reviews_rating'], true), $review_name, $review_name);
        ?>
</footer>
      </blockquote>
<?php 
    }
    ?>
	</div>
    <div class="clearfix"></div>
<?php 
} else {
    ?>

  <div class="alert alert-info">
    <?php 
    echo TEXT_NO_REVIEWS;
        ?>
</span>
  </div>
</div>
<?php 
    }
    ?>
    <div class="contentText">
      <div class="reviews">
<?php 
    $reviews_query = tep_db_query($reviews_split->sql_query);
    while ($reviews = tep_db_fetch_array($reviews_query)) {
        echo '<blockquote class="col-sm-6">';
        echo '  <p><span class="pull-left">' . tep_image('images/' . tep_output_string_protected($reviews['products_image']), tep_output_string_protected($reviews['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</span>' . tep_output_string_protected($reviews['reviews_text']) . ' ... </p><div class="clearfix"></div>';
        $reviews_name = tep_output_string_protected($reviews['customers_name']);
        echo '  <footer>' . sprintf(REVIEWS_TEXT_RATED, tep_draw_stars($reviews['reviews_rating']), $reviews_name, $reviews_name) . ' <a href="' . tep_href_link('product_reviews.php', 'products_id=' . (int) $reviews['products_id']) . '"><span class="pull-right label label-info">' . REVIEWS_TEXT_READ_MORE . '</span></a></footer>';
        echo '</blockquote>';
    }
    ?>
      </div>
      <div class="clearfix"></div>
    </div>
<?php 
} else {
    ?>

  <div class="alert alert-info">
    <?php 
    echo TEXT_NO_REVIEWS;
    ?>
  </div>
            <?php 
echo tep_draw_radio_field('rating', '3') . tep_draw_stars(3, false);
?>
          </label>
        </div>
        <div class="radio">
          <label>
            <?php 
echo tep_draw_radio_field('rating', '2') . tep_draw_stars(2, false);
?>
          </label>
        </div>
        <div class="radio">
          <label>
            <?php 
echo tep_draw_radio_field('rating', '1', null, 'required aria-required="true"') . tep_draw_stars(1, false) . ' ' . TEXT_BAD;
?>
          </label>
        </div>
      </div>
    </div>


  </div>

  <div class="clearfix"></div>

  <div class="row">
    <div class="col-sm-6 text-right pull-right"><?php 
echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'glyphicon glyphicon-chevron-right', null, 'primary', null, 'btn-success');
?>
Exemplo n.º 7
0
        echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, 'products_id=' . $reviews['products_id'] . '&reviews_id=' . $reviews['reviews_id']) . '">' . $reviews['products_name'] . '</a>';
        ?>
</h4>
    <blockquote>
      <p><span class="pull-left"><?php 
        echo tep_image(DIR_WS_IMAGES . tep_output_string_protected($reviews['products_image']), tep_output_string_protected($reviews['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
        ?>
</span><?php 
        echo tep_output_string_protected($reviews['reviews_text']) . ' ... ';
        ?>
</p>
      <div class="clearfix"></div>
      <footer>
        <?php 
        $review_name = tep_output_string_protected($reviews['customers_name']);
        echo sprintf(REVIEWS_TEXT_RATED, tep_draw_stars($reviews['reviews_rating']), $review_name, $review_name) . '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, 'products_id=' . (int) $reviews['products_id']) . '"><span class="pull-right label label-info">' . REVIEWS_TEXT_READ_MORE . '</span></a>';
        ?>
      </footer>
    </blockquote>
  </div>

<?php 
    }
    ?>
</div>
<?php 
} else {
    ?>

  <div class="contentText">
    <div class="alert alert-info">