1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* osCommerce Online Merchant |
4
|
|
|
* |
5
|
|
|
* @copyright (c) 2016 osCommerce; https://www.oscommerce.com |
6
|
|
|
* @license MIT; https://www.oscommerce.com/license/mit.txt |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
use OSC\OM\HTML; |
10
|
|
|
use OSC\OM\OSCOM; |
11
|
|
|
|
12
|
|
|
require('includes/application_top.php'); |
13
|
|
|
|
14
|
|
|
$OSCOM_Language->loadDefinitions('reviews'); |
15
|
|
|
|
16
|
|
|
$breadcrumb->add(OSCOM::getDef('navbar_title'), OSCOM::link('reviews.php')); |
17
|
|
|
|
18
|
|
|
require($oscTemplate->getFile('template_top.php')); |
19
|
|
|
?> |
20
|
|
|
|
21
|
|
|
<div class="page-header"> |
22
|
|
|
<h1><?php echo OSCOM::getDef('heading_title'); ?></h1> |
23
|
|
|
</div> |
24
|
|
|
|
25
|
|
|
<div class="contentContainer"> |
26
|
|
|
|
27
|
|
|
<?php |
28
|
|
|
$Qreviews = $OSCOM_Db->prepare('select SQL_CALC_FOUND_ROWS r.reviews_id, left(rd.reviews_text, 100) as reviews_text, r.reviews_rating, r.date_added, p.products_id, pd.products_name, p.products_image, r.customers_name from :table_reviews r, :table_reviews_description rd, :table_products p, :table_products_description pd where p.products_id = r.products_id and p.products_status = 1 and r.reviews_status = 1 and r.reviews_id = rd.reviews_id and p.products_id = pd.products_id and pd.language_id = :language_id and pd.language_id = rd.languages_id order by r.reviews_id desc limit :page_set_offset, :page_set_max_results'); |
29
|
|
|
$Qreviews->bindInt(':language_id', $OSCOM_Language->getId()); |
30
|
|
|
$Qreviews->setPageSet(MAX_DISPLAY_NEW_REVIEWS); |
31
|
|
|
$Qreviews->execute(); |
32
|
|
|
|
33
|
|
|
if ($Qreviews->getPageSetTotalRows() > 0) { |
34
|
|
View Code Duplication |
if ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3')) { |
|
|
|
|
35
|
|
|
?> |
36
|
|
|
|
37
|
|
|
<div class="row"> |
38
|
|
|
<div class="col-sm-6 pagenumber hidden-xs"> |
39
|
|
|
<?php echo $Qreviews->getPageSetLabel(OSCOM::getDef('text_display_number_of_reviews')); ?> |
40
|
|
|
</div> |
41
|
|
|
<div class="col-sm-6"> |
42
|
|
|
<span class="pull-right pagenav"><?php echo $Qreviews->getPageSetLinks(tep_get_all_get_params(array('page', 'info'))); ?></span> |
|
|
|
|
43
|
|
|
<span class="pull-right"><?php echo OSCOM::getDef('text_result_page'); ?></span> |
44
|
|
|
</div> |
45
|
|
|
</div> |
46
|
|
|
<?php |
47
|
|
|
} |
48
|
|
|
?> |
49
|
|
|
<div class="contentText"> |
50
|
|
|
<div class="reviews"> |
51
|
|
|
<?php |
52
|
|
|
while ($Qreviews->fetch()) { |
53
|
|
|
echo '<blockquote class="col-sm-6">'; |
54
|
|
|
echo ' <p><span class="pull-left">' . HTML::image(OSCOM::linkImage($Qreviews->value('products_image')), $Qreviews->value('products_name'), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</span>' . $Qreviews->valueProtected('reviews_text') . ' ... </p><div class="clearfix"></div>'; |
55
|
|
|
|
56
|
|
|
$review_name = $Qreviews->valueProtected('customers_name'); |
57
|
|
|
|
58
|
|
|
echo '<footer>'; |
59
|
|
|
$review_name = $Qreviews->valueProtected('customers_name'); |
60
|
|
|
echo OSCOM::getDef('reviews_text_rated', [ |
61
|
|
|
'reviews_rating' => HTML::stars($Qreviews->value('reviews_rating')), |
62
|
|
|
'review_name' => $review_name |
63
|
|
|
]); |
64
|
|
|
|
65
|
|
|
echo '<a href="' . OSCOM::link('product_reviews.php', 'products_id=' . $Qreviews->valueInt('products_id')) . '">'; |
66
|
|
|
echo '<span class="pull-right label label-info">' . OSCOM::getDef('reviews_text_read_more') . '</span>'; |
67
|
|
|
echo '</a>'; |
68
|
|
|
echo '</footer>'; |
69
|
|
|
echo '</blockquote>'; |
70
|
|
|
} |
71
|
|
|
?> |
72
|
|
|
</div> |
73
|
|
|
<div class="clearfix"></div> |
74
|
|
|
</div> |
75
|
|
|
<?php |
76
|
|
|
} else { |
77
|
|
|
?> |
78
|
|
|
|
79
|
|
|
<div class="alert alert-info"> |
80
|
|
|
<?php echo OSCOM::getDef('text_no_reviews'); ?> |
81
|
|
|
</div> |
82
|
|
|
|
83
|
|
|
<?php |
84
|
|
|
} |
85
|
|
|
|
86
|
|
View Code Duplication |
if (($Qreviews->getPageSetTotalRows() > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) { |
|
|
|
|
87
|
|
|
?> |
88
|
|
|
<div class="row"> |
89
|
|
|
<div class="col-sm-6 pagenumber hidden-xs"> |
90
|
|
|
<?php echo $Qreviews->getPageSetLabel(OSCOM::getDef('text_display_number_of_reviews')); ?> |
91
|
|
|
</div> |
92
|
|
|
<div class="col-sm-6"> |
93
|
|
|
<span class="pull-right pagenav"><?php echo $Qreviews->getPageSetLinks(tep_get_all_get_params(array('page', 'info'))); ?></span> |
|
|
|
|
94
|
|
|
<span class="pull-right"><?php echo OSCOM::getDef('text_result_page'); ?></span> |
95
|
|
|
</div> |
96
|
|
|
</div> |
97
|
|
|
<?php |
98
|
|
|
} |
99
|
|
|
?> |
100
|
|
|
|
101
|
|
|
</div> |
102
|
|
|
|
103
|
|
|
<?php |
104
|
|
|
require($oscTemplate->getFile('template_bottom.php')); |
105
|
|
|
require('includes/application_bottom.php'); |
106
|
|
|
?> |
107
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.