Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #781 from gburton/1.0.2.0
Browse files Browse the repository at this point in the history
1.0.2.0
  • Loading branch information
gburton authored Aug 15, 2019
2 parents 393d96f + 6f6d42a commit cc15d76
Show file tree
Hide file tree
Showing 25 changed files with 273 additions and 563 deletions.
34 changes: 10 additions & 24 deletions advanced_search_result.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@
'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,
'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);
'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW,
'PRODUCT_LIST_ID' => PRODUCT_LIST_ID,
'PRODUCT_LIST_ORDERED' => PRODUCT_LIST_ORDERED);

asort($define_list);

Expand All @@ -125,29 +127,7 @@
if ($value > 0) $column_list[] = $key;
}

$select_column_list = '';

for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
switch ($column_list[$i]) {
case 'PRODUCT_LIST_MODEL':
$select_column_list .= 'p.products_model, ';
break;
case 'PRODUCT_LIST_MANUFACTURER':
$select_column_list .= 'm.manufacturers_name, ';
break;
case 'PRODUCT_LIST_QUANTITY':
$select_column_list .= 'p.products_quantity, ';
break;
case 'PRODUCT_LIST_IMAGE':
$select_column_list .= 'p.products_image, ';
break;
case 'PRODUCT_LIST_WEIGHT':
$select_column_list .= 'p.products_weight, ';
break;
}
}

$select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_description, pd.products_name, p.products_price, p.products_tax_class_id, p.products_quantity as in_stock, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price, if(s.status, 1, 0) as is_special ";
$select_str = "select distinct p.products_id, m.*, p.*, pd.*, p.products_quantity as in_stock, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price, if(s.status, 1, 0) as is_special ";

if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
$select_str .= ", SUM(tr.tax_rate) as tax_rate ";
Expand Down Expand Up @@ -273,6 +253,12 @@
case 'PRODUCT_LIST_PRICE':
$order_str = " order by final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_ID':
$order_str = " order by p.products_id " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_ORDERED':
$order_str = " order by p.products_ordered " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
}
}

Expand Down
2 changes: 1 addition & 1 deletion custom.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion includes/functions/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ function tep_create_sort_heading($sortby, $colnum, $heading) {

if ($sortby) {
$sort_prefix = '<a href="' . tep_href_link($PHP_SELF, tep_get_all_get_params(array('info', 'sort', 'page')) . 'sort=' . $colnum . ($sortby == $colnum . 'a' ? 'd' : 'a')) . '" title="' . tep_output_string(TEXT_SORT_PRODUCTS . ($sortby == $colnum . 'd' || substr($sortby, 0, 1) != $colnum ? TEXT_ASCENDINGLY : TEXT_DESCENDINGLY) . TEXT_BY . $heading) . '" class="dropdown-item">' ;
$sort_suffix = (substr($sortby, 0, 1) == $colnum ? (substr($sortby, 1, 1) == 'a' ? '+' : '-') : '') . '</a>';
$sort_suffix = (substr($sortby, 0, 1) == $colnum ? (substr($sortby, 1, 1) == 'a' ? LISTING_SORT_DOWN : LISTING_SORT_UP) : LISTING_SORT_UNSELECTED) . '</a>';
}

return $sort_prefix . $heading . $sort_suffix;
Expand Down
10 changes: 8 additions & 2 deletions includes/languages/english.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,12 @@ function tep_date_raw($date, $reverse = false) {
define('TABLE_HEADING_MODEL', 'Model');
define('TABLE_HEADING_PRODUCTS', 'Product Name');
define('TABLE_HEADING_MANUFACTURER', 'Manufacturer');
define('TABLE_HEADING_QUANTITY', 'Quantity');
define('TABLE_HEADING_QUANTITY', 'Stock');
define('TABLE_HEADING_PRICE', 'Price');
define('TABLE_HEADING_WEIGHT', 'Weight');
define('TABLE_HEADING_BUY_NOW', 'Buy Now');
define('TABLE_HEADING_LATEST_ADDED', 'Latest Products');
define('TABLE_HEADING_LATEST_ADDED', 'Date Added');
define('TABLE_HEADING_ORDERED', 'Most Popular');

// product notifications
define('PRODUCT_SUBSCRIBED', '%s has been added to your Notification List');
Expand All @@ -233,3 +234,8 @@ function tep_date_raw($date, $reverse = false) {
define('IS_PRODUCT_SHOW_PRICE_SPECIAL', '<del>%s</del> <span class="text-danger">now %s</span>');
define('IS_PRODUCT_BUTTON_BUY', '<i class="fas fa-shopping-cart"></i>');
define('IS_PRODUCT_BUTTON_VIEW', '<i class="fas fa-eye"></i> View');

// sitewide product listing
define('LISTING_SORT_DOWN', '<i class="fas fa-level-down-alt text-primary"></i>');
define('LISTING_SORT_UP', '<i class="fas fa-level-up-alt text-primary"></i>');
define('LISTING_SORT_UNSELECTED', '<i class="fas fa-level-up-alt text-black-50"></i>');
3 changes: 2 additions & 1 deletion includes/languages/english/modules/boxes/bm_reviews.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

define('MODULE_BOXES_REVIEWS_TITLE', 'Reviews');
define('MODULE_BOXES_REVIEWS_DESCRIPTION', 'Show product reviews');
define('MODULE_BOXES_REVIEWS_BOX_TITLE', 'Reviews');

define('MODULE_BOXES_REVIEWS_BOX_TITLE', '<a href="%s">Reviews</a>');
define('MODULE_BOXES_REVIEWS_BOX_WRITE_REVIEW', 'Write a review on this product!');
define('MODULE_BOXES_REVIEWS_BOX_NO_REVIEWS', 'There are currently no product reviews');
define('MODULE_BOXES_REVIEWS_BOX_TEXT_OF_5_STARS', '%s of 5 Stars!');
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,4 @@
const MODULE_CONTENT_CARD_PRODUCTS_DESCRIPTION = 'Shows the "New Products" module on your Index page.';

const MODULE_CONTENT_CARD_PRODUCTS_HEADING = 'New Products For %s';

const MODULE_CONTENT_CARD_PRODUCTS_BUTTON_VIEW = '<i class="fas fa-eye"></i> View';
const MODULE_CONTENT_CARD_PRODUCTS_BUTTON_BUY = '<i class="fas fa-shopping-cart"></i> Buy';


Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
Copyright (c) 2018, G Burton
Copyright (c) 2019, G Burton
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand All @@ -18,7 +18,4 @@
const MODULE_CONTENT_IN_CARD_PRODUCTS_DESCRIPTION = 'Shows the "New Products" module on your Index page.';

const MODULE_CONTENT_IN_CARD_PRODUCTS_HEADING = 'New Products For %s';

const MODULE_CONTENT_IN_CARD_PRODUCTS_BUTTON_VIEW = '<i class="fas fa-eye"></i> View';
const MODULE_CONTENT_IN_CARD_PRODUCTS_BUTTON_BUY = '<i class="fas fa-shopping-cart"></i> Buy';

This file was deleted.

39 changes: 24 additions & 15 deletions includes/modules/boxes/bm_reviews.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,38 @@ function __construct() {
function execute() {
global $languages_id, $currencies, $oscTemplate;

$random_select = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name from reviews r, reviews_description rd, products p, 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";
$random_select = "select r.*, p.*, pd.*, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price, p.products_quantity as in_stock, if(s.status, 1, 0) as is_special, substring(reviews_text, 1, 60) as reviews_text from reviews r, reviews_description rd, products p left join specials s on p.products_id = s.products_id, 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($_GET['products_id'])) {
$random_select .= " and p.products_id = '" . (int)$_GET['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 = '';

$box_attr = $box_title = $box_image = $box_price = $box_review_text = '';
$data = array();

if ($random_product) {
// display random review box
$rand_review_query = tep_db_query("select substring(reviews_text, 1, 60) as reviews_text from 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('product_reviews.php', 'products_id=' . $random_product['products_id']) . '">' . tep_image('images/' . $random_product['products_image'], htmlspecialchars($random_product['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></div><div><a href="' . tep_href_link('product_reviews.php', '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>';
$data['data-is-special'] = (int)$random_product['is_special'];
$data['data-product-price'] = $currencies->display_raw($random_product['final_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
$data['data-product-manufacturer'] = max(0, (int)$random_product['manufacturers_id']);

foreach ( $data as $key => $value ) {
$box_attr .= ' ' . tep_output_string_protected($key) . '="' . tep_output_string_protected($value) . '"';
}

$box_title = '<a href="' . tep_href_link('product_reviews.php', 'products_id=' . (int)$random_product['products_id']) . '">' . $random_product['products_name'] . '</a>';
$box_image = '<a href="' . tep_href_link('product_reviews.php', 'products_id=' . $random_product['products_id']) . '">' . tep_image('images/' . $random_product['products_image'], htmlspecialchars($random_product['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, '', true, 'card-img-top') . '</a>';
if ($random_product['is_special'] == 1) {
$box_price = sprintf(IS_PRODUCT_SHOW_PRICE_SPECIAL, $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])), $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])));
} else {
$box_price = sprintf(IS_PRODUCT_SHOW_PRICE, $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])));
}
$box_review_text .= tep_draw_stars($random_product['reviews_rating']) . '<br>';
$box_review_text .= tep_output_string_protected($random_product['reviews_text']) . '...';
} elseif (isset($_GET['products_id'])) {
// display 'write a review' box
$reviews_box_contents .= '<i class="fas fa-thumbs-up"></i> <a href="' . tep_href_link('product_reviews_write.php', 'products_id=' . $_GET['products_id']) . '">' . MODULE_BOXES_REVIEWS_BOX_WRITE_REVIEW .'</a>';
$box_review_text .= '<i class="fas fa-thumbs-up"></i> <a href="' . tep_href_link('product_reviews_write.php', 'products_id=' . $_GET['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>';
$box_review_text .= '<p>' . MODULE_BOXES_REVIEWS_BOX_NO_REVIEWS . '</p>';
}

ob_start();
Expand Down Expand Up @@ -87,4 +96,4 @@ function keys() {
return array('MODULE_BOXES_REVIEWS_STATUS', 'MODULE_BOXES_REVIEWS_CONTENT_PLACEMENT', 'MODULE_BOXES_REVIEWS_SORT_ORDER');
}
}
?>
2 changes: 1 addition & 1 deletion includes/modules/boxes/bm_specials.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function __construct() {
function execute() {
global $languages_id, $currencies, $oscTemplate;

if ($random_product = tep_random_select("select p.*, pd.*, s.*, m.*, p.products_quantity as in_stock, s.specials_new_products_price as final_price from products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_description pd, specials s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
if ($random_product = tep_random_select("select p.*, pd.*, s.*, p.products_quantity as in_stock, s.specials_new_products_price as final_price from products p, products_description pd, specials s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
$data['data-is-special'] = 1;
$data['data-product-price'] = $currencies->display_raw($random_product['final_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
$data['data-product-manufacturer'] = max(0, (int)$random_product['manufacturers_id']);
Expand Down
2 changes: 1 addition & 1 deletion includes/modules/boxes/bm_whats_new.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function execute() {

$data = array();

if ($random_product = tep_random_select("select p.*, pd.*, m.*, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price, p.products_quantity as in_stock, if(s.status, 1, 0) as is_special from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
if ($random_product = tep_random_select("select p.*, pd.*, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price, p.products_quantity as in_stock, if(s.status, 1, 0) as is_special from products_description pd, products p left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
$data['data-is-special'] = (int)$random_product['is_special'];
$data['data-product-price'] = $currencies->display_raw($random_product['final_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
$data['data-product-manufacturer'] = max(0, (int)$random_product['manufacturers_id']);
Expand Down
11 changes: 7 additions & 4 deletions includes/modules/boxes/templates/tpl_bm_reviews.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<div class="card bm-reviews">
<div class="card is-product"<?php echo $box_attr; ?>>
<div class="card-header">
<a href="<?php echo tep_href_link('reviews.php'); ?>"><?php echo MODULE_BOXES_REVIEWS_BOX_TITLE; ?></a>
<?php echo sprintf(MODULE_BOXES_REVIEWS_BOX_TITLE, tep_href_link('reviews.php')); ?>
</div>
<?php echo $box_image; ?>
<div class="card-body">
<?php echo $reviews_box_contents; ?>
<h5 class="card-title"><?php echo $box_title; ?></h5>
<h6 class="card-subtitle mb-2 text-muted"><?php echo $box_price; ?></h6>
<?php echo $box_review_text; ?>
</div>
</div>

<?php
/*
Copyright (c) 2018, G Burton
Copyright (c) 2019, G Burton
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
Loading

0 comments on commit cc15d76

Please sign in to comment.