From 53601a92868c42dd13a35fea8fcfbc6b06b183ab Mon Sep 17 00:00:00 2001 From: gburton Date: Thu, 8 Aug 2019 17:30:27 +0100 Subject: [PATCH 01/15] Introduce Revamped Product Listing --- advanced_search_result.php | 34 ++-- custom.css | 2 +- includes/languages/english.php | 5 +- .../index_products/cm_ip_product_listing.php | 21 ++- includes/modules/product_listing.php | 156 ++++++------------ install/oscommerce.sql | 35 ++-- products_new.php | 42 ++--- specials.php | 37 ++--- 8 files changed, 116 insertions(+), 216 deletions(-) diff --git a/advanced_search_result.php b/advanced_search_result.php index 284168bae..82a0bf68a 100644 --- a/advanced_search_result.php +++ b/advanced_search_result.php @@ -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); @@ -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 "; @@ -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; } } diff --git a/custom.css b/custom.css index 6d96e1367..4d05b12b1 100644 --- a/custom.css +++ b/custom.css @@ -1,4 +1,4 @@ /* DO NOT CHANGE THIS FILE -------------------------------------------------- */ /* TO OVER-RIDE ANY ASPECT OF THIS CSS, AMEND THE user.css FILE ------------- */ -#bodyWrapper {padding-top: 10px;}.productHolder {border: 1px solid #eee;padding: 10px;border-radius: 4px;-webkit-transition: border .5s ease-in-out;-o-transition: border .5s ease-in-out;transition: border .5s ease-in-out;}.productHolder:hover {border: 1px solid #428bca;}.productHolder h2 {font-size: 1em;}.item.l-g-i {float: none; width: 100% !important; background-color: white;border: none;}.item.l-g-i img {float: left !important; margin-right: 10px !important;}.g-g-i {text-align: center;}.g-g-i, .l-g-i {margin-bottom: 15px;}.g-g-i .list-group-item-text {display: none;}.stepwizard {margin-top: 20px;}.footer {padding-top: 10px;}.footer-extra {background: #111; color: silver; line-height: 2; padding-top: 10px;}.footer-extra A {color: silver;}.card {margin-bottom: 10px !important;}.form-control-feedback { position: absolute; width: auto; top: 7px; right: 45px; margin-top: 0; }blockquote.blockquote p {font-size: 0.8em !important;}.list-tap-target {line-height: 2;}.buttonSet p {margin-top: 10px;}.alert-filters {outline: 1px solid #eee;}.alert-filters A {color: #575757;}.alert-filters A:hover {color: #000;}@media (max-width: 575.98px) {.display-1 {font-size: 3rem;font-weight: 300;line-height: 1.0;}.display-2 {font-size: 2.75rem;font-weight: 300;line-height: 1.0;}.display-3 {font-size: 2.25rem;font-weight: 300;line-height: 1.0;}.display-4 {font-size: 1.75rem;font-weight: 300;line-height: 1.0;}h4 {font-size: 1rem;}}@media (max-width: 991.01px) {#columnLeft, #columnRight {padding-top: 20px;}} +#bodyWrapper {padding-top: 10px;}.stepwizard {margin-top: 20px;}.footer {padding-top: 10px;}.footer-extra {background: #111; color: silver; line-height: 2; padding-top: 10px;}.footer-extra A {color: silver;}.card {margin-bottom: 10px !important;}.form-control-feedback { position: absolute; width: auto; top: 7px; right: 45px; margin-top: 0; }blockquote.blockquote p {font-size: 0.8em !important;}.list-tap-target {line-height: 2;}.buttonSet p {margin-top: 10px;}.alert-filters {outline: 1px solid #eee;}.alert-filters A {color: #575757;}.alert-filters A:hover {color: #000;}@media (max-width: 575.98px) {.display-1 {font-size: 3rem;font-weight: 300;line-height: 1.0;}.display-2 {font-size: 2.75rem;font-weight: 300;line-height: 1.0;}.display-3 {font-size: 2.25rem;font-weight: 300;line-height: 1.0;}.display-4 {font-size: 1.75rem;font-weight: 300;line-height: 1.0;}h4 {font-size: 1rem;}}@media (max-width: 991.01px) {#columnLeft, #columnRight {padding-top: 20px;}} diff --git a/includes/languages/english.php b/includes/languages/english.php index cadb03b24..17f105765 100755 --- a/includes/languages/english.php +++ b/includes/languages/english.php @@ -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'); diff --git a/includes/modules/content/index_products/cm_ip_product_listing.php b/includes/modules/content/index_products/cm_ip_product_listing.php index 084ef8d00..0d4a7a279 100644 --- a/includes/modules/content/index_products/cm_ip_product_listing.php +++ b/includes/modules/content/index_products/cm_ip_product_listing.php @@ -46,7 +46,9 @@ function execute() { '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); @@ -59,19 +61,19 @@ function execute() { if (isset($_GET['manufacturers_id']) && !empty($_GET['manufacturers_id'])) { if (isset($_GET['filter_id']) && tep_not_null($_GET['filter_id'])) { // We are asked to show only a specific category - $listing_sql = "select p.products_model, pd.products_name, m.manufacturers_name, p.products_quantity, p.products_image, p.products_weight, p.products_id, pd.products_description, p.manufacturers_id, p.products_price, p.products_tax_class_id, 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 p left join specials s on p.products_id = s.products_id, products_description pd, manufacturers m, products_to_categories p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$_GET['filter_id'] . "'"; + $listing_sql = "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 p left join specials s on p.products_id = s.products_id, products_description pd, manufacturers m, products_to_categories p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$_GET['filter_id'] . "'"; } else { // We show them all - $listing_sql = "select p.products_model, pd.products_name, m.manufacturers_name, p.products_quantity, p.products_image, p.products_weight, p.products_id, pd.products_description, p.manufacturers_id, p.products_price, p.products_tax_class_id, 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 p left join specials s on p.products_id = s.products_id, products_description pd, manufacturers m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "'"; + $listing_sql = "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 p left join specials s on p.products_id = s.products_id, products_description pd, manufacturers m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "'"; } } else { // show the products in a given categorie if (isset($_GET['filter_id']) && tep_not_null($_GET['filter_id'])) { // We are asked to show only specific catgeory - $listing_sql = "select p.products_model, pd.products_name, m.manufacturers_name, p.products_quantity, p.products_image, p.products_weight, p.products_id, pd.products_description, p.manufacturers_id, p.products_price, p.products_tax_class_id, 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 p left join specials s on p.products_id = s.products_id, products_description pd, manufacturers m, products_to_categories p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; + $listing_sql = "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 p left join specials s on p.products_id = s.products_id, products_description pd, manufacturers m, products_to_categories p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // We show them all - $listing_sql = "select p.products_model, pd.products_name, m.manufacturers_name, p.products_quantity, p.products_image, p.products_weight, p.products_id, pd.products_description, p.manufacturers_id, p.products_price, p.products_tax_class_id, 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, products_to_categories p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; + $listing_sql = "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, products_to_categories p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } } @@ -109,6 +111,12 @@ function execute() { case 'PRODUCT_LIST_PRICE': $listing_sql .= " order by final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; + case 'PRODUCT_LIST_ID': + $listing_sql .= " order by p.products_id " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; + break; + case 'PRODUCT_LIST_ORDERED': + $listing_sql .= " order by p.products_ordered " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; + break; } } @@ -168,7 +176,6 @@ function check() { function install() { tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Product Listing Module', 'MODULE_CONTENT_IP_PRODUCT_LISTING_STATUS', 'True', 'Should this module be enabled?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_IP_PRODUCT_LISTING_CONTENT_WIDTH', '12', 'What width container should the content be shown in?', '6', '2', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())"); - tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Item Width', 'MODULE_CONTENT_IP_PRODUCT_LISTING_CONTENT_WIDTH_EACH', '4', 'What width container should each Item be shown in?', '6', '3', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_IP_PRODUCT_LISTING_SORT_ORDER', '200', 'Sort order of display. Lowest is displayed first.', '6', '4', now())"); } @@ -177,7 +184,7 @@ function remove() { } function keys() { - return array('MODULE_CONTENT_IP_PRODUCT_LISTING_STATUS', 'MODULE_CONTENT_IP_PRODUCT_LISTING_CONTENT_WIDTH', 'MODULE_CONTENT_IP_PRODUCT_LISTING_CONTENT_WIDTH_EACH', 'MODULE_CONTENT_IP_PRODUCT_LISTING_SORT_ORDER'); + return array('MODULE_CONTENT_IP_PRODUCT_LISTING_STATUS', 'MODULE_CONTENT_IP_PRODUCT_LISTING_CONTENT_WIDTH', 'MODULE_CONTENT_IP_PRODUCT_LISTING_SORT_ORDER'); } } \ No newline at end of file diff --git a/includes/modules/product_listing.php b/includes/modules/product_listing.php index 68cc9d2f8..44db2a6aa 100644 --- a/includes/modules/product_listing.php +++ b/includes/modules/product_listing.php @@ -10,7 +10,7 @@ Released under the GNU General Public License */ - $num_list = (isset($_GET['view']) && ($_GET['view'] == 'all') ) ? 999999 : MAX_DISPLAY_SEARCH_RESULTS; + $num_list = (isset($_GET['view']) && ($_GET['view'] == 'all') ) ? 999999 : MAX_DISPLAY_SEARCH_RESULTS; $listing_split = new splitPageResults($listing_sql, $num_list, 'p.products_id'); ?> @@ -35,7 +35,7 @@ number_of_rows > 0) { ?> - - - - - - - + + sql_query); $prod_list_contents = NULL; - - // php 5 - $list_group_item = (isset($item_width) ? $item_width : 4); - // php 7 - // $list_group_item = $item_width ?? 4; - + + $item = 1; while ($listing = tep_db_fetch_array($listing_query)) { - $prod_list_contents .= '
'; - $prod_list_contents .= '
'; - - if (PRODUCT_LIST_IMAGE > 0) { + $prod_list_contents .= '
' . PHP_EOL; if (isset($_GET['manufacturers_id']) && tep_not_null($_GET['manufacturers_id'])) { - $prod_list_contents .= ' ' . tep_image('images/' . $listing['products_image'], htmlspecialchars($listing['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'itemprop="image"', true, 'group list-group-image') . ''; - } else { - $prod_list_contents .= ' ' . tep_image('images/' . $listing['products_image'], htmlspecialchars($listing['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'itemprop="image"', true, 'group list-group-image') . ''; - } - } - - $prod_list_contents .= '
'; - - if (PRODUCT_LIST_NAME > 0) { - $prod_list_contents .= '

'; - if (isset($_GET['manufacturers_id']) && tep_not_null($_GET['manufacturers_id'])) { - $prod_list_contents .= ' '; + $prod_list_contents .= '' . tep_image('images/' . $listing['products_image'], htmlspecialchars($listing['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, '', true, 'card-img-top') . '' . PHP_EOL; } else { - $prod_list_contents .= ' '; + $prod_list_contents .= '' . tep_image('images/' . $listing['products_image'], htmlspecialchars($listing['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, '', true, 'card-img-top') . '' . PHP_EOL; } - $prod_list_contents .= '

'; - } - - $prod_list_contents .= '

' . strip_tags($listing['products_description'], '
') . '

'; - - $extra_list_contents = NULL; - if ( (PRODUCT_LIST_MANUFACTURER > 0) && tep_not_null($listing['manufacturers_id']) ) { - $extra_list_contents .= '
' . TABLE_HEADING_MANUFACTURER . '
'; - $extra_list_contents .= '
' . $listing['manufacturers_name'] . '
'; - } - if ( (PRODUCT_LIST_MODEL > 0) && tep_not_null($listing['products_model']) ) { - $extra_list_contents .= '
' . TABLE_HEADING_MODEL . '
'; - $extra_list_contents .= '
' . $listing['products_model'] . '
'; - } - if ( (PRODUCT_LIST_QUANTITY > 0) && (tep_get_products_stock($listing['products_id']) > 0) ) { - $extra_list_contents .= '
' . TABLE_HEADING_QUANTITY . '
'; - $extra_list_contents .= '
' . tep_get_products_stock($listing['products_id']) . '
'; - } - if (PRODUCT_LIST_WEIGHT > 0) { - $extra_list_contents .= '
' . TABLE_HEADING_WEIGHT . '
'; - $extra_list_contents .= '
' . $listing['products_weight'] . '
'; - } - - if (tep_not_null($extra_list_contents)) { - $prod_list_contents .= '
'; - $prod_list_contents .= $extra_list_contents; - $prod_list_contents .= '
'; - } - - if ( (PRODUCT_LIST_PRICE > 0) || (PRODUCT_LIST_BUY_NOW > 0) ) { - $prod_list_contents .= '
'; - - if (PRODUCT_LIST_PRICE > 0) { - if (tep_not_null($listing['specials_new_products_price'])) { - $prod_list_contents .= '
' . PHP_EOL; - $prod_list_contents .= '' . PHP_EOL; - $prod_list_contents .= '

' . PHP_EOL; - $prod_list_contents .= '' . PHP_EOL; - $prod_list_contents .= '' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '' . PHP_EOL; - $prod_list_contents .= '' . PHP_EOL; - $prod_list_contents .= '

' . PHP_EOL; - $prod_list_contents .= '
' . PHP_EOL; + + $prod_list_contents .= '
' . PHP_EOL; + $prod_list_contents .= '
'; + if (isset($_GET['manufacturers_id']) && tep_not_null($_GET['manufacturers_id'])) { + $prod_list_contents .= '' . $listing['products_name'] . ''; } else { - $prod_list_contents .= '
' . PHP_EOL; - $prod_list_contents .= '' . PHP_EOL; - $prod_list_contents .= '

' . PHP_EOL; - $prod_list_contents .= '' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '' . PHP_EOL; - $prod_list_contents .= '

' . PHP_EOL; - $prod_list_contents .= '
' . PHP_EOL; + $prod_list_contents .= '' . $listing['products_name'] . ''; } - } - - if (PRODUCT_LIST_BUY_NOW > 0) { - $prod_list_contents .= '
' . PHP_EOL; - $prod_list_contents .= '
' . PHP_EOL; - $prod_list_contents .= '' . SMALL_IMAGE_BUTTON_VIEW . '' . PHP_EOL; - $prod_list_contents .= tep_draw_button(SMALL_IMAGE_BUTTON_BUY, 'fas fa-shopping-cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . (int)$listing['products_id']), NULL, array('params' => 'data-has-attributes="' . ((tep_has_product_attributes((int)$listing['products_id']) === true) ? '1' : '0') . '" data-in-stock="' . (int)$listing['in_stock'] . '" data-product-id="' . (int)$listing['products_id'] . '"'), 'btn-success btn-sm btn-product-listing btn-buy') . PHP_EOL; + $prod_list_contents .= '
' . PHP_EOL; + $prod_list_contents .= '
'; + if ($listing['is_special'] == 1) { + $prod_list_contents .= sprintf(IS_PRODUCT_SHOW_PRICE_SPECIAL, $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])), $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id']))); + } + else { + $prod_list_contents .= sprintf(IS_PRODUCT_SHOW_PRICE, $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id']))); + } + $prod_list_contents .= '
' . PHP_EOL; + if (tep_not_null($listing['products_seo_description'])) { + $prod_list_contents .= '
'; + $prod_list_contents .= $listing['products_seo_description']; $prod_list_contents .= '
' . PHP_EOL; + } + $prod_list_contents .= '
' . PHP_EOL; + + $prod_list_contents .= '' . PHP_EOL; - } - $prod_list_contents .= '
' . PHP_EOL; - $prod_list_contents .= '
' . PHP_EOL; - $prod_list_contents .= '
' . PHP_EOL; + $prod_list_contents .= '
' . PHP_EOL; + if ( $item%IS_PRODUCT_PRODUCTS_DISPLAY_ROW_SM == 0 ) $prod_list_contents .= '
' . PHP_EOL; + if ( $item%IS_PRODUCT_PRODUCTS_DISPLAY_ROW_MD == 0 ) $prod_list_contents .= '
' . PHP_EOL; + if ( $item%IS_PRODUCT_PRODUCTS_DISPLAY_ROW_LG == 0 ) $prod_list_contents .= '
' . PHP_EOL; + if ( $item%IS_PRODUCT_PRODUCTS_DISPLAY_ROW_XL == 0 ) $prod_list_contents .= '
' . PHP_EOL; + $item++; } - echo '
' . PHP_EOL; - echo ' ' . PHP_EOL; - echo $prod_list_contents; + echo '
' . PHP_EOL; + echo $prod_list_contents; echo '
' . PHP_EOL; + } else { -?> - - - -' . TEXT_NO_PRODUCTS . '
'; } if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) { diff --git a/install/oscommerce.sql b/install/oscommerce.sql index 32721d6fe..2475f2630 100755 --- a/install/oscommerce.sql +++ b/install/oscommerce.sql @@ -773,16 +773,24 @@ INSERT INTO configuration (configuration_title, configuration_key, configuration INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Larger packages - percentage increase.', 'SHIPPING_BOX_PADDING', '10', 'For 10% enter 10', '7', '5', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Allow Orders Not Matching Defined Shipping Zones ', 'SHIPPING_ALLOW_UNDEFINED_ZONES', 'False', 'Should orders be allowed to shipping addresses not matching defined shipping module shipping zones?', '7', '5', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now()); -INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Display Product Image (0=disable; 1=enable)', 'PRODUCT_LIST_IMAGE', '1', 'Do you want to display the Product Image?', '8', '1', now()); -INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Display Product Manufacturer Name (0=disable; 1=enable)','PRODUCT_LIST_MANUFACTURER', '0', 'Do you want to display the Product Manufacturer Name?', '8', '2', now()); -INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Display Product Model (0=disable; 1=enable)', 'PRODUCT_LIST_MODEL', '0', 'Do you want to display the Product Model?', '8', '3', now()); -INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Display Product Name (0=disable; 1=enable)', 'PRODUCT_LIST_NAME', '1', 'Do you want to display the Product Name?', '8', '4', now()); -INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Display Product Price (0=disable; 1=enable)', 'PRODUCT_LIST_PRICE', '1', 'Do you want to display the Product Price', '8', '5', now()); -INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Display Product Quantity (0=disable; 1=enable)', 'PRODUCT_LIST_QUANTITY', '0', 'Do you want to display the Product Quantity?', '8', '6', now()); -INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Display Product Weight (0=disable; 1=enable)', 'PRODUCT_LIST_WEIGHT', '0', 'Do you want to display the Product Weight?', '8', '7', now()); -INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Display Buy Now column (0=disable; 1=enable)', 'PRODUCT_LIST_BUY_NOW', '1', 'Do you want to display the Buy Now column?', '8', '8', now()); -INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Display Category/Manufacturer Filter (0=disable; 1=enable)', 'PRODUCT_LIST_FILTER', '1', 'Do you want to display the Category/Manufacturer Filter?', '8', '9', now()); -INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Location of Prev/Next Navigation Bar (1-top, 2-bottom, 3-both)', 'PREV_NEXT_BAR_LOCATION', '2', 'Sets the location of the Prev/Next Navigation Bar (1-top, 2-bottom, 3-both)', '8', '10', now()); +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Product Card Layout', 'IS_PRODUCT_PRODUCTS_LAYOUT', 'card-deck', 'What Layout suits your shop? See https://getbootstrap.com/docs/4.3/components/card/#card-layout', '8', '100', 'tep_cfg_select_option(array(\'card-group\', \'card-deck\', \'card-columns\'), ', now()); +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Products In Each Row (SM)', 'IS_PRODUCT_PRODUCTS_DISPLAY_ROW_SM', '2', 'How many products should display per Row in SM (Small) viewport?', '8', '110', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now()); +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Products In Each Row (MD)', 'IS_PRODUCT_PRODUCTS_DISPLAY_ROW_MD', '3', 'How many products should display per Row in MD (Medium) viewport?', '8', '120', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now()); +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Products In Each Row (LG)', 'IS_PRODUCT_PRODUCTS_DISPLAY_ROW_LG', '4', 'How many products should display per Row in LG (Large) viewport?', '8', '130', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now()); +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Products In Each Row (XL)', 'IS_PRODUCT_PRODUCTS_DISPLAY_ROW_XL', '4', 'How many products should display per Row in XL (Large) viewport?', '8', '140', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now()); + +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Option: Manufacturer Name (0=disable; 1=enable)','PRODUCT_LIST_MANUFACTURER', '0', 'Allow sorting by Manufacturer Name?', '8', '200', now()); +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Option: Model (0=disable; 1=enable)', 'PRODUCT_LIST_MODEL', '0', 'Allow sorting by Product Model?', '8', '210', now()); +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Option: Name (0=disable; 1=enable)', 'PRODUCT_LIST_NAME', '1', 'Allow sorting by Product Name?', '8', '220', now()); +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Option: Price (0=disable; 1=enable)', 'PRODUCT_LIST_PRICE', '1', 'Allow sorting by roduct Price', '8', '230', now()); +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Option: Stock (0=disable; 1=enable)', 'PRODUCT_LIST_QUANTITY', '0', 'Allow sorting by Product Quantity (Stock)?', '8', '240', now()); +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Option: Weight (0=disable; 1=enable)', 'PRODUCT_LIST_WEIGHT', '0', 'Allow sorting by Product Weight?', '8', '250', now()); +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Option: Latest Added (0=disable; 1=enable)', 'PRODUCT_LIST_ID', '1', 'Allow sorting by Latest Added?', '8', '260', now()); +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Option: Sales (0=disable; 1=enable)', 'PRODUCT_LIST_ORDERED', '1', 'Allow sorting by Number of Sales?', '8', '270', now()); +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Product Image (defunct)', 'PRODUCT_LIST_IMAGE', '0', 'This is a defunct setting.', '8', '280', now()); +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Buy Now column (defunct)', 'PRODUCT_LIST_BUY_NOW', '0', 'This is a defunct setting.', '8', '290', now()); +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Display Category/Manufacturer Filter (0=disable; 1=enable)', 'PRODUCT_LIST_FILTER', '1', 'Do you want to display the Category/Manufacturer Filter?', '8', '300', now()); +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Location of Prev/Next Navigation Bar (1-top, 2-bottom, 3-both)', 'PREV_NEXT_BAR_LOCATION', '2', 'Sets the location of the Prev/Next Navigation Bar (1-top, 2-bottom, 3-both)', '8', '310', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Check stock level', 'STOCK_CHECK', 'true', 'Check to see if sufficent stock is available', '9', '1', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Subtract stock', 'STOCK_LIMITED', 'true', 'Subtract product in stock by product orders', '9', '2', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now()); @@ -835,7 +843,7 @@ INSERT INTO configuration_group VALUES ('4', 'Images', 'Image parameters', '4', INSERT INTO configuration_group VALUES ('5', 'Customer Details', 'Customer account configuration', '5', '1'); INSERT INTO configuration_group VALUES ('6', 'Module Options', 'Hidden from configuration', '6', '0'); INSERT INTO configuration_group VALUES ('7', 'Shipping/Packaging', 'Shipping options available at my store', '7', '1'); -INSERT INTO configuration_group VALUES ('8', 'Product Listing', 'Product Listing configuration options', '8', '1'); +INSERT INTO configuration_group VALUES ('8', 'Product Listing', 'Product Listing configuration options', '8', '1'); INSERT INTO configuration_group VALUES ('9', 'Stock', 'Stock configuration options', '9', '1'); INSERT INTO configuration_group VALUES ('10', 'Logging', 'Logging configuration options', '10', '1'); INSERT INTO configuration_group VALUES ('11', 'Cache', 'Caching configuration options', '11', '1'); @@ -1309,7 +1317,7 @@ INSERT INTO zones (zone_country_id, zone_code, zone_name) VALUES (195,'Zamora',' INSERT INTO zones (zone_country_id, zone_code, zone_name) VALUES (195,'Zaragoza','Zaragoza'); # Header Tags -INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Installed Modules', 'MODULE_HEADER_TAGS_INSTALLED', 'ht_manufacturer_title.php;ht_category_title.php;ht_product_title.php;ht_robot_noindex.php;ht_datepicker_jquery.php;ht_grid_list_view.php;ht_table_click_jquery.php;ht_breadcrumb_schema.php;ht_product_colorbox.php', 'List of header tag module filenames separated by a semi-colon. This is automatically updated. No need to edit.', '6', '0', now()); +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Installed Modules', 'MODULE_HEADER_TAGS_INSTALLED', 'ht_manufacturer_title.php;ht_category_title.php;ht_product_title.php;ht_robot_noindex.php;ht_datepicker_jquery.php;ht_table_click_jquery.php;ht_breadcrumb_schema.php;ht_product_colorbox.php', 'List of header tag module filenames separated by a semi-colon. This is automatically updated. No need to edit.', '6', '0', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Category Title Module', 'MODULE_HEADER_TAGS_CATEGORY_TITLE_STATUS', 'True', 'Do you want to allow category titles to be added to the page title?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_HEADER_TAGS_CATEGORY_TITLE_SORT_ORDER', '200', 'Sort order of display. Lowest is displayed first.', '6', '0', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('SEO Title Override?', 'MODULE_HEADER_TAGS_CATEGORY_TITLE_SEO_TITLE_OVERRIDE', 'True', 'Do you want to allow category titles to be over-ridden by your SEO Titles (if set)?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now()); @@ -1328,9 +1336,6 @@ INSERT INTO configuration (configuration_title, configuration_key, configuration INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Datepicker jQuery Module', 'MODULE_HEADER_TAGS_DATEPICKER_JQUERY_STATUS', 'True', 'Do you want to enable the Datepicker module?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Pages', 'MODULE_HEADER_TAGS_DATEPICKER_JQUERY_PAGES', 'advanced_search.php;account_edit.php;create_account.php', 'The pages to add the Datepicker jQuery Scripts to.', '6', '0', 'ht_datepicker_jquery_show_pages', 'ht_datepicker_jquery_edit_pages(', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_HEADER_TAGS_DATEPICKER_JQUERY_SORT_ORDER', '600', 'Sort order of display. Lowest is displayed first.', '6', '0', now()); -INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Grid List javascript', 'MODULE_HEADER_TAGS_GRID_LIST_VIEW_STATUS', 'True', 'Do you want to enable the Grid/List Javascript module?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now()); -INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Pages', 'MODULE_HEADER_TAGS_GRID_LIST_VIEW_PAGES', 'advanced_search_result.php;index.php;products_new.php;specials.php', 'The pages to add the Grid List JS Scripts to.', '6', '0', 'ht_grid_list_view_show_pages', 'ht_grid_list_view_edit_pages(', now()); -INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_HEADER_TAGS_GRID_LIST_VIEW_SORT_ORDER', '700', 'Sort order of display. Lowest is displayed first.', '6', '0', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Clickable Table Rows Module', 'MODULE_HEADER_TAGS_TABLE_CLICK_JQUERY_STATUS', 'True', 'Do you want to enable the Clickable Table Rows module?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Pages', 'MODULE_HEADER_TAGS_TABLE_CLICK_JQUERY_PAGES', 'checkout_payment.php;checkout_shipping.php', 'The pages to add the jQuery Scripts to.', '6', '0', 'ht_table_click_jquery_show_pages', 'ht_table_click_jquery_edit_pages(', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_HEADER_TAGS_TABLE_CLICK_JQUERY_SORT_ORDER', '800', 'Sort order of display. Lowest is displayed first.', '6', '0', now()); diff --git a/products_new.php b/products_new.php index 608e0c118..f4bd9ec9c 100644 --- a/products_new.php +++ b/products_new.php @@ -30,7 +30,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); @@ -39,40 +41,13 @@ if ($value > 0) $column_list[] = $key; } - $column_list[] = 'PRODUCT_LIST_ID'; - - $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_NAME': - $select_column_list .= 'pd.products_name, '; - 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; - } - } - - $listing_sql = "select " . $select_column_list . " p.products_id, pd.products_description, p.manufacturers_id, p.products_price, p.products_tax_class_id, 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 . "'"; + $listing_sql = "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 . "'"; if ( (!isset($_GET['sort'])) || (!preg_match('/^[1-8][ad]$/', $_GET['sort'])) || (substr($_GET['sort'], 0, 1) > sizeof($column_list)) ) { for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { - if ($column_list[$i] == 'PRODUCT_LIST_ID') { - $_GET['sort'] = $i+1 . 'd'; - $listing_sql .= " order by p.products_id DESC"; + if ($column_list[$i] == 'PRODUCT_LIST_NAME') { + $_GET['sort'] = $i+1 . 'a'; + $listing_sql .= " order by pd.products_name"; break; } } @@ -105,6 +80,9 @@ case 'PRODUCT_LIST_ID': $listing_sql .= " order by p.products_id " . ($sort_order == 'd' ? 'desc' : ''); break; + case 'PRODUCT_LIST_ORDERED': + $listing_sql .= " order by p.products_ordered " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; + break; } } diff --git a/specials.php b/specials.php index ac0ccf2e5..ff94f78d9 100644 --- a/specials.php +++ b/specials.php @@ -30,7 +30,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); @@ -39,32 +41,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_NAME': - $select_column_list .= 'pd.products_name, '; - 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; - } - } - - $listing_sql = "select " . $select_column_list . " p.products_id, pd.products_description, p.manufacturers_id, p.products_price, p.products_tax_class_id, 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 . "' and s.status = '1'"; + $listing_sql = "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 . "' and s.status = '1'"; if ( (!isset($_GET['sort'])) || (!preg_match('/^[1-8][ad]$/', $_GET['sort'])) || (substr($_GET['sort'], 0, 1) > sizeof($column_list)) ) { for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { @@ -100,6 +77,12 @@ case 'PRODUCT_LIST_PRICE': $listing_sql .= " order by final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; + case 'PRODUCT_LIST_ID': + $listing_sql .= " order by p.products_id " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; + break; + case 'PRODUCT_LIST_ORDERED': + $listing_sql .= " order by p.products_ordered " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; + break; } } From a88429d87ec7538c40085b1c30841cbe6c3161a4 Mon Sep 17 00:00:00 2001 From: gburton Date: Thu, 8 Aug 2019 17:30:52 +0100 Subject: [PATCH 02/15] Remove Grid/List JS --- .../modules/header_tags/ht_grid_list_view.php | 15 -- .../modules/header_tags/ht_grid_list_view.php | 169 ------------------ 2 files changed, 184 deletions(-) delete mode 100644 includes/languages/english/modules/header_tags/ht_grid_list_view.php delete mode 100644 includes/modules/header_tags/ht_grid_list_view.php diff --git a/includes/languages/english/modules/header_tags/ht_grid_list_view.php b/includes/languages/english/modules/header_tags/ht_grid_list_view.php deleted file mode 100644 index 7dd610d98..000000000 --- a/includes/languages/english/modules/header_tags/ht_grid_list_view.php +++ /dev/null @@ -1,15 +0,0 @@ -title = MODULE_HEADER_TAGS_GRID_LIST_VIEW_TITLE; - $this->description = MODULE_HEADER_TAGS_GRID_LIST_VIEW_DESCRIPTION; - - if ( defined('MODULE_HEADER_TAGS_GRID_LIST_VIEW_STATUS') ) { - $this->sort_order = MODULE_HEADER_TAGS_GRID_LIST_VIEW_SORT_ORDER; - $this->enabled = (MODULE_HEADER_TAGS_GRID_LIST_VIEW_STATUS == 'True'); - } - } - - function execute() { - global $PHP_SELF, $oscTemplate, $item_width; - - if (tep_not_null(MODULE_HEADER_TAGS_GRID_LIST_VIEW_PAGES)) { - $pages_array = array(); - - foreach (explode(';', MODULE_HEADER_TAGS_GRID_LIST_VIEW_PAGES) as $page) { - $page = trim($page); - - if (!empty($page)) { - $pages_array[] = $page; - } - } - - if (in_array(basename($PHP_SELF), $pages_array)) { - $grid_list_js = << -var cc = sessionStorage.list_grid; - -if (cc == 'list') { - $('#products .item').removeClass('g-g-i').addClass('l-g-i').addClass('col-sm-12'); -}else { - $('#products .item').removeClass('l-g-i').addClass('g-g-i').removeClass('col-sm-12'); -} - -$(document).ready(function() { - $('#list').click(function(event){ - event.preventDefault(); - $('#products .item').addClass('l-g-i').removeClass('g-g-i').addClass('col-sm-12'); - sessionStorage.setItem('list_grid', 'list'); - }); - $('#grid').click(function(event){ - event.preventDefault(); - $('#products .item').removeClass('l-g-i').addClass('g-g-i').removeClass('col-sm-12'); - sessionStorage.setItem('list_grid', 'grid'); - }); -}); - -EOD; - $oscTemplate->addBlock($grid_list_js . PHP_EOL, $this->group); - } - } - } - - function isEnabled() { - return $this->enabled; - } - - function check() { - return defined('MODULE_HEADER_TAGS_GRID_LIST_VIEW_STATUS'); - } - - function install() { - tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Grid List javascript', 'MODULE_HEADER_TAGS_GRID_LIST_VIEW_STATUS', 'True', 'Do you want to enable the Grid/List Javascript module?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); - tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Pages', 'MODULE_HEADER_TAGS_GRID_LIST_VIEW_PAGES', '" . implode(';', $this->get_default_pages()) . "', 'The pages to add the Grid List JS Scripts to.', '6', '4', 'ht_grid_list_view_show_pages', 'ht_grid_list_view_edit_pages(', now())"); - tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_HEADER_TAGS_GRID_LIST_VIEW_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '5', now())"); - } - - function remove() { - tep_db_query("delete from configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')"); - } - - function keys() { - return array('MODULE_HEADER_TAGS_GRID_LIST_VIEW_STATUS', 'MODULE_HEADER_TAGS_GRID_LIST_VIEW_PAGES', 'MODULE_HEADER_TAGS_GRID_LIST_VIEW_SORT_ORDER'); - } - - function get_default_pages() { - return array('advanced_search_result.php', - 'index.php', - 'products_new.php', - 'specials.php'); - } - } - - function ht_grid_list_view_show_pages($text) { - return nl2br(implode("\n", explode(';', $text))); - } - - function ht_grid_list_view_edit_pages($values, $key) { - global $PHP_SELF; - - $file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.')); - $files_array = array(); - if ($dir = @dir(DIR_FS_CATALOG)) { - while ($file = $dir->read()) { - if (!is_dir(DIR_FS_CATALOG . $file)) { - if (substr($file, strrpos($file, '.')) == $file_extension) { - $files_array[] = $file; - } - } - } - sort($files_array); - $dir->close(); - } - - $values_array = explode(';', $values); - - $output = ''; - foreach ($files_array as $file) { - $output .= tep_draw_checkbox_field('ht_grid_list_view_file[]', $file, in_array($file, $values_array)) . ' ' . tep_output_string($file) . '
'; - } - - if (!empty($output)) { - $output = '
' . substr($output, 0, -6); - } - - $output .= tep_draw_hidden_field('configuration[' . $key . ']', '', 'id="htrn_files"'); - - $output .= ''; - - return $output; - } - From 597bc33a09973d0e271b827bd7fd53ba473ac75b Mon Sep 17 00:00:00 2001 From: gburton Date: Thu, 8 Aug 2019 17:37:18 +0100 Subject: [PATCH 03/15] Prettify Sort By --- includes/functions/general.php | 2 +- includes/languages/english.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/functions/general.php b/includes/functions/general.php index 426f2f0dc..5a5fb0ada 100755 --- a/includes/functions/general.php +++ b/includes/functions/general.php @@ -889,7 +889,7 @@ function tep_create_sort_heading($sortby, $colnum, $heading) { if ($sortby) { $sort_prefix = '' ; - $sort_suffix = (substr($sortby, 0, 1) == $colnum ? (substr($sortby, 1, 1) == 'a' ? '+' : '-') : '') . ''; + $sort_suffix = (substr($sortby, 0, 1) == $colnum ? (substr($sortby, 1, 1) == 'a' ? LISTING_SORT_DOWN : LISTING_SORT_UP) : LISTING_SORT_UP) . ''; } return $sort_prefix . $heading . $sort_suffix; diff --git a/includes/languages/english.php b/includes/languages/english.php index 17f105765..bac3bbc2c 100755 --- a/includes/languages/english.php +++ b/includes/languages/english.php @@ -234,3 +234,7 @@ function tep_date_raw($date, $reverse = false) { define('IS_PRODUCT_SHOW_PRICE_SPECIAL', '%s now %s'); define('IS_PRODUCT_BUTTON_BUY', ''); define('IS_PRODUCT_BUTTON_VIEW', ' View'); + +// sitewide product listing +define('LISTING_SORT_DOWN', ''); +define('LISTING_SORT_UP', ''); From 2fdfa9361ba3ddad05ffca4255d3759f3afa8955 Mon Sep 17 00:00:00 2001 From: gburton Date: Thu, 8 Aug 2019 18:10:42 +0100 Subject: [PATCH 04/15] Update index Product List to match sitewide Style --- .../content/index/cm_i_card_products.php | 5 +- .../content/index/cm_i_card_products.php | 14 ++-- .../templates/tpl_cm_i_card_products.php | 66 +++++++++---------- install/oscommerce.sql | 5 -- 4 files changed, 37 insertions(+), 53 deletions(-) diff --git a/includes/languages/english/modules/content/index/cm_i_card_products.php b/includes/languages/english/modules/content/index/cm_i_card_products.php index d456f4028..a8e360724 100644 --- a/includes/languages/english/modules/content/index/cm_i_card_products.php +++ b/includes/languages/english/modules/content/index/cm_i_card_products.php @@ -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 = ' View'; - const MODULE_CONTENT_CARD_PRODUCTS_BUTTON_BUY = ' Buy'; - \ No newline at end of file + \ No newline at end of file diff --git a/includes/modules/content/index/cm_i_card_products.php b/includes/modules/content/index/cm_i_card_products.php index f343c3bcc..268129dd2 100644 --- a/includes/modules/content/index/cm_i_card_products.php +++ b/includes/modules/content/index/cm_i_card_products.php @@ -1,6 +1,6 @@ cm-i-card-products">

-
- +
-
-
-
- -
+
+ +
+
+ +
+
+ display_price($card_products['products_price'], tep_get_tax_rate($card_products['products_tax_class_id'])), $currencies->display_price($card_products['specials_new_products_price'], tep_get_tax_rate($card_products['products_tax_class_id']))); + } + else { + echo sprintf(IS_PRODUCT_SHOW_PRICE, $currencies->display_price($card_products['products_price'], tep_get_tax_rate($card_products['products_tax_class_id']))); + } + ?> +
-
- + - -
+
' . PHP_EOL; - if ( $item%MODULE_CONTENT_CARD_PRODUCTS_DISPLAY_ROW_MD == 0 ) echo '
' . PHP_EOL; - if ( $item%MODULE_CONTENT_CARD_PRODUCTS_DISPLAY_ROW_LG == 0 ) echo '
' . PHP_EOL; - if ( $item%MODULE_CONTENT_CARD_PRODUCTS_DISPLAY_ROW_XL == 0 ) echo '
' . PHP_EOL; + if ( $item%IS_PRODUCT_PRODUCTS_DISPLAY_ROW_SM == 0 ) echo '
' . PHP_EOL; + if ( $item%IS_PRODUCT_PRODUCTS_DISPLAY_ROW_MD == 0 ) echo '
' . PHP_EOL; + if ( $item%IS_PRODUCT_PRODUCTS_DISPLAY_ROW_LG == 0 ) echo '
' . PHP_EOL; + if ( $item%IS_PRODUCT_PRODUCTS_DISPLAY_ROW_XL == 0 ) echo '
' . PHP_EOL; $item++; } ?> @@ -50,7 +46,7 @@ Date: Thu, 8 Aug 2019 18:16:18 +0100 Subject: [PATCH 05/15] Update index_nested Product List to match sitewide Style --- .../index_nested/cm_in_card_products.php | 5 +- .../index_nested/cm_in_card_products.php | 15 ++--- .../templates/tpl_cm_in_card_products.php | 66 +++++++++---------- install/oscommerce.sql | 5 -- 4 files changed, 38 insertions(+), 53 deletions(-) diff --git a/includes/languages/english/modules/content/index_nested/cm_in_card_products.php b/includes/languages/english/modules/content/index_nested/cm_in_card_products.php index 85bcdd297..7f8e90c0a 100644 --- a/includes/languages/english/modules/content/index_nested/cm_in_card_products.php +++ b/includes/languages/english/modules/content/index_nested/cm_in_card_products.php @@ -1,6 +1,6 @@ View'; - const MODULE_CONTENT_IN_CARD_PRODUCTS_BUTTON_BUY = ' Buy'; \ No newline at end of file diff --git a/includes/modules/content/index_nested/cm_in_card_products.php b/includes/modules/content/index_nested/cm_in_card_products.php index 18cec184e..5f41e269b 100644 --- a/includes/modules/content/index_nested/cm_in_card_products.php +++ b/includes/modules/content/index_nested/cm_in_card_products.php @@ -1,6 +1,6 @@ 0) { @@ -65,11 +67,6 @@ function install() { tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable New Products Module', 'MODULE_CONTENT_IN_CARD_PRODUCTS_STATUS', 'True', 'Do you want to enable this module?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_IN_CARD_PRODUCTS_CONTENT_WIDTH', '12', 'What width container should the content be shown in? (12 = full width, 6 = half width).', '6', '2', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Maximum Display', 'MODULE_CONTENT_IN_CARD_PRODUCTS_MAX_DISPLAY', '6', 'Maximum Number of products that should show in this module?', '6', '3', now())"); - tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Products In Each Row (SM)', 'MODULE_CONTENT_IN_CARD_PRODUCTS_DISPLAY_ROW_SM', '2', 'How many products should display per Row in SM (Small) viewport?', '6', '4', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())"); - tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Products In Each Row (MD)', 'MODULE_CONTENT_IN_CARD_PRODUCTS_DISPLAY_ROW_MD', '3', 'How many products should display per Row in MD (Medium) viewport?', '6', '4', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())"); - tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Products In Each Row (LG)', 'MODULE_CONTENT_IN_CARD_PRODUCTS_DISPLAY_ROW_LG', '4', 'How many products should display per Row in LG (Large) viewport?', '6', '4', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())"); - tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Products In Each Row (XL)', 'MODULE_CONTENT_IN_CARD_PRODUCTS_DISPLAY_ROW_XL', '4', 'How many products should display per Row in XL (Extra Large) viewport?', '6', '4', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())"); - tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Button', 'MODULE_CONTENT_IN_CARD_PRODUCTS_BUTTON', 'View', 'Which button should display (View, Buy).', '6', '1', 'tep_cfg_select_option(array(\'View\', \'Buy\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_IN_CARD_PRODUCTS_SORT_ORDER', '300', 'Sort order of display. Lowest is displayed first.', '6', '5', now())"); } @@ -78,6 +75,6 @@ function remove() { } function keys() { - return array('MODULE_CONTENT_IN_CARD_PRODUCTS_STATUS', 'MODULE_CONTENT_IN_CARD_PRODUCTS_CONTENT_WIDTH', 'MODULE_CONTENT_IN_CARD_PRODUCTS_MAX_DISPLAY', 'MODULE_CONTENT_IN_CARD_PRODUCTS_DISPLAY_ROW_SM', 'MODULE_CONTENT_IN_CARD_PRODUCTS_DISPLAY_ROW_MD', 'MODULE_CONTENT_IN_CARD_PRODUCTS_DISPLAY_ROW_LG', 'MODULE_CONTENT_IN_CARD_PRODUCTS_DISPLAY_ROW_XL', 'MODULE_CONTENT_IN_CARD_PRODUCTS_BUTTON', 'MODULE_CONTENT_IN_CARD_PRODUCTS_SORT_ORDER'); + return array('MODULE_CONTENT_IN_CARD_PRODUCTS_STATUS', 'MODULE_CONTENT_IN_CARD_PRODUCTS_CONTENT_WIDTH', 'MODULE_CONTENT_IN_CARD_PRODUCTS_MAX_DISPLAY', 'MODULE_CONTENT_IN_CARD_PRODUCTS_SORT_ORDER'); } } diff --git a/includes/modules/content/index_nested/templates/tpl_cm_in_card_products.php b/includes/modules/content/index_nested/templates/tpl_cm_in_card_products.php index f322f168e..189e51ef6 100644 --- a/includes/modules/content/index_nested/templates/tpl_cm_in_card_products.php +++ b/includes/modules/content/index_nested/templates/tpl_cm_in_card_products.php @@ -1,47 +1,43 @@

-
- +
-
-
-
- -
+
+ +
+
+ +
+
+ display_price($card_products['products_price'], tep_get_tax_rate($card_products['products_tax_class_id'])), $currencies->display_price($card_products['specials_new_products_price'], tep_get_tax_rate($card_products['products_tax_class_id']))); + } + else { + echo sprintf(IS_PRODUCT_SHOW_PRICE, $currencies->display_price($card_products['products_price'], tep_get_tax_rate($card_products['products_tax_class_id']))); + } + ?> +
-
- + - -
+
' . PHP_EOL; - if ( $item%MODULE_CONTENT_IN_CARD_PRODUCTS_DISPLAY_ROW_MD == 0 ) echo '
' . PHP_EOL; - if ( $item%MODULE_CONTENT_IN_CARD_PRODUCTS_DISPLAY_ROW_LG == 0 ) echo '
' . PHP_EOL; - if ( $item%MODULE_CONTENT_IN_CARD_PRODUCTS_DISPLAY_ROW_XL == 0 ) echo '
' . PHP_EOL; + if ( $item%IS_PRODUCT_PRODUCTS_DISPLAY_ROW_SM == 0 ) echo '
' . PHP_EOL; + if ( $item%IS_PRODUCT_PRODUCTS_DISPLAY_ROW_MD == 0 ) echo '
' . PHP_EOL; + if ( $item%IS_PRODUCT_PRODUCTS_DISPLAY_ROW_LG == 0 ) echo '
' . PHP_EOL; + if ( $item%IS_PRODUCT_PRODUCTS_DISPLAY_ROW_XL == 0 ) echo '
' . PHP_EOL; $item++; } ?> @@ -50,7 +46,7 @@ Date: Fri, 9 Aug 2019 11:44:13 +0100 Subject: [PATCH 06/15] Update SQL Typo + card-columns warning --- install/oscommerce.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/oscommerce.sql b/install/oscommerce.sql index 0370b3b95..53a36aab9 100755 --- a/install/oscommerce.sql +++ b/install/oscommerce.sql @@ -773,7 +773,7 @@ INSERT INTO configuration (configuration_title, configuration_key, configuration INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Larger packages - percentage increase.', 'SHIPPING_BOX_PADDING', '10', 'For 10% enter 10', '7', '5', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Allow Orders Not Matching Defined Shipping Zones ', 'SHIPPING_ALLOW_UNDEFINED_ZONES', 'False', 'Should orders be allowed to shipping addresses not matching defined shipping module shipping zones?', '7', '5', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now()); -INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Product Card Layout', 'IS_PRODUCT_PRODUCTS_LAYOUT', 'card-deck', 'What Layout suits your shop? See https://getbootstrap.com/docs/4.3/components/card/#card-layout', '8', '100', 'tep_cfg_select_option(array(\'card-group\', \'card-deck\', \'card-columns\'), ', now()); +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Product Card Layout', 'IS_PRODUCT_PRODUCTS_LAYOUT', 'card-deck', 'What Layout suits your shop? See https://getbootstrap.com/docs/4.3/components/card/#card-layout
card-columns is a special use case that will not suit most shops as card-columns is very difficult to layout and sort by...
', '8', '100', 'tep_cfg_select_option(array(\'card-group\', \'card-deck\', \'card-columns\'), ', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Products In Each Row (SM)', 'IS_PRODUCT_PRODUCTS_DISPLAY_ROW_SM', '2', 'How many products should display per Row in SM (Small) viewport?', '8', '110', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Products In Each Row (MD)', 'IS_PRODUCT_PRODUCTS_DISPLAY_ROW_MD', '3', 'How many products should display per Row in MD (Medium) viewport?', '8', '120', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Products In Each Row (LG)', 'IS_PRODUCT_PRODUCTS_DISPLAY_ROW_LG', '4', 'How many products should display per Row in LG (Large) viewport?', '8', '130', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now()); @@ -782,7 +782,7 @@ INSERT INTO configuration (configuration_title, configuration_key, configuration INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Option: Manufacturer Name (0=disable; 1=enable)','PRODUCT_LIST_MANUFACTURER', '0', 'Allow sorting by Manufacturer Name?', '8', '200', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Option: Model (0=disable; 1=enable)', 'PRODUCT_LIST_MODEL', '0', 'Allow sorting by Product Model?', '8', '210', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Option: Name (0=disable; 1=enable)', 'PRODUCT_LIST_NAME', '1', 'Allow sorting by Product Name?', '8', '220', now()); -INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Option: Price (0=disable; 1=enable)', 'PRODUCT_LIST_PRICE', '1', 'Allow sorting by roduct Price', '8', '230', now()); +INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Option: Price (0=disable; 1=enable)', 'PRODUCT_LIST_PRICE', '1', 'Allow sorting by Product Price', '8', '230', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Option: Stock (0=disable; 1=enable)', 'PRODUCT_LIST_QUANTITY', '0', 'Allow sorting by Product Quantity (Stock)?', '8', '240', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Option: Weight (0=disable; 1=enable)', 'PRODUCT_LIST_WEIGHT', '0', 'Allow sorting by Product Weight?', '8', '250', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Option: Latest Added (0=disable; 1=enable)', 'PRODUCT_LIST_ID', '1', 'Allow sorting by Latest Added?', '8', '260', now()); From 629f80d00d5da9f5ae239b5c2135ffa5e46165cf Mon Sep 17 00:00:00 2001 From: gburton Date: Sat, 10 Aug 2019 11:13:37 +0100 Subject: [PATCH 07/15] Solve Bootstrap Bug in IE11 when using card-img-top --- custom.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom.css b/custom.css index 4d05b12b1..25a1d0c13 100644 --- a/custom.css +++ b/custom.css @@ -1,4 +1,4 @@ /* DO NOT CHANGE THIS FILE -------------------------------------------------- */ /* TO OVER-RIDE ANY ASPECT OF THIS CSS, AMEND THE user.css FILE ------------- */ -#bodyWrapper {padding-top: 10px;}.stepwizard {margin-top: 20px;}.footer {padding-top: 10px;}.footer-extra {background: #111; color: silver; line-height: 2; padding-top: 10px;}.footer-extra A {color: silver;}.card {margin-bottom: 10px !important;}.form-control-feedback { position: absolute; width: auto; top: 7px; right: 45px; margin-top: 0; }blockquote.blockquote p {font-size: 0.8em !important;}.list-tap-target {line-height: 2;}.buttonSet p {margin-top: 10px;}.alert-filters {outline: 1px solid #eee;}.alert-filters A {color: #575757;}.alert-filters A:hover {color: #000;}@media (max-width: 575.98px) {.display-1 {font-size: 3rem;font-weight: 300;line-height: 1.0;}.display-2 {font-size: 2.75rem;font-weight: 300;line-height: 1.0;}.display-3 {font-size: 2.25rem;font-weight: 300;line-height: 1.0;}.display-4 {font-size: 1.75rem;font-weight: 300;line-height: 1.0;}h4 {font-size: 1rem;}}@media (max-width: 991.01px) {#columnLeft, #columnRight {padding-top: 20px;}} +* {min-height: 0.01px;}#bodyWrapper {padding-top: 10px;}.stepwizard {margin-top: 20px;}.footer {padding-top: 10px;}.footer-extra {background: #111; color: silver; line-height: 2; padding-top: 10px;}.footer-extra A {color: silver;}.card {margin-bottom: 10px !important;}.form-control-feedback { position: absolute; width: auto; top: 7px; right: 45px; margin-top: 0; }blockquote.blockquote p {font-size: 0.8em !important;}.list-tap-target {line-height: 2;}.buttonSet p {margin-top: 10px;}.alert-filters {outline: 1px solid #eee;}.alert-filters A {color: #575757;}.alert-filters A:hover {color: #000;}@media (max-width: 575.98px) {.display-1 {font-size: 3rem;font-weight: 300;line-height: 1.0;}.display-2 {font-size: 2.75rem;font-weight: 300;line-height: 1.0;}.display-3 {font-size: 2.25rem;font-weight: 300;line-height: 1.0;}.display-4 {font-size: 1.75rem;font-weight: 300;line-height: 1.0;}h4 {font-size: 1rem;}}@media (max-width: 991.01px) {#columnLeft, #columnRight {padding-top: 20px;}} From 2a220a9e1f2f124c2599510cdd6ed6a808efcc1d Mon Sep 17 00:00:00 2001 From: gburton Date: Sat, 10 Aug 2019 11:25:01 +0100 Subject: [PATCH 08/15] Remove Keywords from _GET params on Buttons --- includes/modules/product_listing.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/modules/product_listing.php b/includes/modules/product_listing.php index 44db2a6aa..3a6e37f6d 100644 --- a/includes/modules/product_listing.php +++ b/includes/modules/product_listing.php @@ -131,9 +131,9 @@ $prod_list_contents .= '' . PHP_EOL; From 096e1aaac6a1e46bc8f8ce8da138b8326cb17a3b Mon Sep 17 00:00:00 2001 From: gburton Date: Sat, 10 Aug 2019 12:05:16 +0100 Subject: [PATCH 09/15] Update Reviews Box to match sitewide Style --- .../english/modules/boxes/bm_reviews.php | 3 +- includes/modules/boxes/bm_reviews.php | 39 ++++++++++++------- .../boxes/templates/tpl_bm_reviews.php | 11 ++++-- 3 files changed, 33 insertions(+), 20 deletions(-) diff --git a/includes/languages/english/modules/boxes/bm_reviews.php b/includes/languages/english/modules/boxes/bm_reviews.php index e81f72a9f..bc43f71e3 100755 --- a/includes/languages/english/modules/boxes/bm_reviews.php +++ b/includes/languages/english/modules/boxes/bm_reviews.php @@ -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', 'Reviews'); 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!'); diff --git a/includes/modules/boxes/bm_reviews.php b/includes/modules/boxes/bm_reviews.php index 9c717f84a..2fec3adf3 100644 --- a/includes/modules/boxes/bm_reviews.php +++ b/includes/modules/boxes/bm_reviews.php @@ -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, '-
'); - - $reviews_box_contents .= '
' . tep_draw_stars($random_product['reviews_rating']) . '
'; + $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 = '' . $random_product['products_name'] . ''; + $box_image = '' . tep_image('images/' . $random_product['products_image'], htmlspecialchars($random_product['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, '', true, 'card-img-top') . ''; + 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']) . '
'; + $box_review_text .= tep_output_string_protected($random_product['reviews_text']) . '...'; } elseif (isset($_GET['products_id'])) { -// display 'write a review' box - $reviews_box_contents .= ' ' . MODULE_BOXES_REVIEWS_BOX_WRITE_REVIEW .''; + $box_review_text .= ' ' . MODULE_BOXES_REVIEWS_BOX_WRITE_REVIEW .''; } else { -// display 'no reviews' box - $reviews_box_contents .= '

' . MODULE_BOXES_REVIEWS_BOX_NO_REVIEWS . '

'; + $box_review_text .= '

' . MODULE_BOXES_REVIEWS_BOX_NO_REVIEWS . '

'; } ob_start(); @@ -87,4 +96,4 @@ function keys() { return array('MODULE_BOXES_REVIEWS_STATUS', 'MODULE_BOXES_REVIEWS_CONTENT_PLACEMENT', 'MODULE_BOXES_REVIEWS_SORT_ORDER'); } } -?> + \ No newline at end of file diff --git a/includes/modules/boxes/templates/tpl_bm_reviews.php b/includes/modules/boxes/templates/tpl_bm_reviews.php index 05bffcc7d..d47fe42be 100644 --- a/includes/modules/boxes/templates/tpl_bm_reviews.php +++ b/includes/modules/boxes/templates/tpl_bm_reviews.php @@ -1,15 +1,18 @@ -
+
>
- +
+
- +
+
+
Date: Sat, 10 Aug 2019 15:36:15 +0100 Subject: [PATCH 10/15] Prettify Sort By --- includes/functions/general.php | 2 +- includes/languages/english.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/includes/functions/general.php b/includes/functions/general.php index 5a5fb0ada..1c56c8df8 100755 --- a/includes/functions/general.php +++ b/includes/functions/general.php @@ -889,7 +889,7 @@ function tep_create_sort_heading($sortby, $colnum, $heading) { if ($sortby) { $sort_prefix = '' ; - $sort_suffix = (substr($sortby, 0, 1) == $colnum ? (substr($sortby, 1, 1) == 'a' ? LISTING_SORT_DOWN : LISTING_SORT_UP) : LISTING_SORT_UP) . ''; + $sort_suffix = (substr($sortby, 0, 1) == $colnum ? (substr($sortby, 1, 1) == 'a' ? LISTING_SORT_DOWN : LISTING_SORT_UP) : LISTING_SORT_UNSELECTED) . ''; } return $sort_prefix . $heading . $sort_suffix; diff --git a/includes/languages/english.php b/includes/languages/english.php index bac3bbc2c..4e63890e9 100755 --- a/includes/languages/english.php +++ b/includes/languages/english.php @@ -236,5 +236,6 @@ function tep_date_raw($date, $reverse = false) { define('IS_PRODUCT_BUTTON_VIEW', ' View'); // sitewide product listing -define('LISTING_SORT_DOWN', ''); -define('LISTING_SORT_UP', ''); +define('LISTING_SORT_DOWN', ''); +define('LISTING_SORT_UP', ''); +define('LISTING_SORT_UNSELECTED', ''); From 64afe72767d2356e96663b8ed0c44494e008e3ef Mon Sep 17 00:00:00 2001 From: gburton Date: Sun, 11 Aug 2019 11:27:29 +0100 Subject: [PATCH 11/15] Remove call to :table manufacturers Data required is already in the products table --- includes/modules/boxes/bm_specials.php | 2 +- includes/modules/boxes/bm_whats_new.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/modules/boxes/bm_specials.php b/includes/modules/boxes/bm_specials.php index cf7451bed..605e330ff 100644 --- a/includes/modules/boxes/bm_specials.php +++ b/includes/modules/boxes/bm_specials.php @@ -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']); diff --git a/includes/modules/boxes/bm_whats_new.php b/includes/modules/boxes/bm_whats_new.php index 3636d435b..d5caa592f 100644 --- a/includes/modules/boxes/bm_whats_new.php +++ b/includes/modules/boxes/bm_whats_new.php @@ -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']); From af96f72c8f3fe4b0d37d89dfc585cb5909b24a7a Mon Sep 17 00:00:00 2001 From: gburton Date: Sun, 11 Aug 2019 11:30:56 +0100 Subject: [PATCH 12/15] Clean Up SQL ROW settings are now on a sitewide basis --- install/oscommerce.sql | 4 ---- 1 file changed, 4 deletions(-) diff --git a/install/oscommerce.sql b/install/oscommerce.sql index 53a36aab9..297f6a13a 100755 --- a/install/oscommerce.sql +++ b/install/oscommerce.sql @@ -1524,10 +1524,6 @@ insert into configuration (configuration_title, configuration_key, configuration insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Category Listing Module', 'MODULE_CONTENT_IN_CATEGORY_LISTING_STATUS', 'True', 'Should this module be enabled?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now()); insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_IN_CATEGORY_LISTING_CONTENT_WIDTH', '12', 'What width container should the content be shown in?', '6', '2', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now()); -insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Items In Each Row (SM)', 'MODULE_CONTENT_IN_CATEGORY_LISTING_DISPLAY_ROW_SM', '2', 'How many products should display per Row in SM (Small) viewport?', '6', '4', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now()); -insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Items In Each Row (MD)', 'MODULE_CONTENT_IN_CATEGORY_LISTING_DISPLAY_ROW_MD', '3', 'How many products should display per Row in MD (Medium) viewport?', '6', '4', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now()); -insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Items In Each Row (LG)', 'MODULE_CONTENT_IN_CATEGORY_LISTING_DISPLAY_ROW_LG', '4', 'How many products should display per Row in LG (Large) viewport?', '6', '4', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now()); -insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Items In Each Row (XL)', 'MODULE_CONTENT_IN_CATEGORY_LISTING_DISPLAY_ROW_XL', '6', 'How many products should display per Row in XL (Extra Large) viewport?', '6', '4', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now()); insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_IN_CATEGORY_LISTING_SORT_ORDER', '200', 'Sort order of display. Lowest is displayed first.', '6', '4', now()); insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable New Products Module', 'MODULE_CONTENT_IN_CARD_PRODUCTS_STATUS', 'True', 'Do you want to enable this module?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now()); From e57d926635cfdb9ad30c759717d71b41df720ef2 Mon Sep 17 00:00:00 2001 From: gburton Date: Sun, 11 Aug 2019 11:33:59 +0100 Subject: [PATCH 13/15] Update Also Purchased Module to match sitewide Style --- .../product_info/cm_pi_also_purchased.php | 15 ++---- .../templates/tpl_cm_pi_also_purchased.php | 54 ++++++++++++------- 2 files changed, 40 insertions(+), 29 deletions(-) diff --git a/includes/modules/content/product_info/cm_pi_also_purchased.php b/includes/modules/content/product_info/cm_pi_also_purchased.php index b162bdaf2..4ad0935c2 100644 --- a/includes/modules/content/product_info/cm_pi_also_purchased.php +++ b/includes/modules/content/product_info/cm_pi_also_purchased.php @@ -37,11 +37,12 @@ function __construct() { } function execute() { - global $oscTemplate, $languages_id; + global $oscTemplate, $languages_id, $currencies, $PHP_SELF; $content_width = (int)MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_CONTENT_WIDTH; + $card_layout = IS_PRODUCT_PRODUCTS_LAYOUT; - $orders_query = tep_db_query("select p.products_id, p.products_image, pd.products_name from orders_products opa, orders_products opb, orders o, products p LEFT JOIN products_description pd on p.products_id = pd.products_id where opa.products_id = '" . (int)$_GET['products_id'] . "' and opa.orders_id = opb.orders_id and opb.products_id != '" . (int)$_GET['products_id'] . "' and opb.products_id = p.products_id and opb.orders_id = o.orders_id and p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "' group by p.products_id order by o.date_purchased desc limit " . (int)MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_CONTENT_LIMIT); + $orders_query = tep_db_query("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 orders_products opa, orders_products opb, orders o, products p left join specials s on p.products_id = s.products_id LEFT JOIN products_description pd on p.products_id = pd.products_id where opa.products_id = '" . (int)$_GET['products_id'] . "' and opa.orders_id = opb.orders_id and opb.products_id != '" . (int)$_GET['products_id'] . "' and opb.products_id = p.products_id and opb.orders_id = o.orders_id and p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "' group by p.products_id order by o.date_purchased desc limit " . (int)MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_CONTENT_LIMIT); $num_products_ordered = tep_db_num_rows($orders_query); if ($num_products_ordered > 0) { @@ -65,21 +66,15 @@ function install() { tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Also Purchased Module', 'MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_STATUS', 'True', 'Should this module be shown on the product info page?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_CONTENT_WIDTH', '12', 'What width container should the content be shown in?', '6', '1', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Number of Products', 'MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_CONTENT_LIMIT', '4', 'How many products (maximum) should be shown?', '6', '1', now())"); - - tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Products In Each Row (SM)', 'MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_DISPLAY_ROW_SM', '2', 'How many products should display per Row in SM (Small) viewport?', '6', '4', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())"); - tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Products In Each Row (MD)', 'MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_DISPLAY_ROW_MD', '3', 'How many products should display per Row in MD (Medium) viewport?', '6', '4', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())"); - tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Products In Each Row (LG)', 'MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_DISPLAY_ROW_LG', '4', 'How many products should display per Row in LG (Large) viewport?', '6', '4', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())"); - tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Products In Each Row (XL)', 'MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_DISPLAY_ROW_XL', '6', 'How many products should display per Row in XL (Extra Large) viewport?', '6', '4', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())"); - tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_SORT_ORDER', '120', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); - } + } function remove() { tep_db_query("delete from configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { - return array('MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_STATUS', 'MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_CONTENT_WIDTH', 'MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_CONTENT_LIMIT', 'MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_DISPLAY_ROW_SM', 'MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_DISPLAY_ROW_MD', 'MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_DISPLAY_ROW_LG', 'MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_DISPLAY_ROW_XL', 'MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_SORT_ORDER'); + return array('MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_STATUS', 'MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_CONTENT_WIDTH', 'MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_CONTENT_LIMIT', 'MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_SORT_ORDER'); } } \ No newline at end of file diff --git a/includes/modules/content/product_info/templates/tpl_cm_pi_also_purchased.php b/includes/modules/content/product_info/templates/tpl_cm_pi_also_purchased.php index 94721d6a8..01b212041 100644 --- a/includes/modules/content/product_info/templates/tpl_cm_pi_also_purchased.php +++ b/includes/modules/content/product_info/templates/tpl_cm_pi_also_purchased.php @@ -1,31 +1,47 @@ -
- - +
+

-

- -
+
-
-
- -
- - +
+ +
+
+ +
+
+ display_price($orders['products_price'], tep_get_tax_rate($orders['products_tax_class_id'])), $currencies->display_price($orders['specials_new_products_price'], tep_get_tax_rate($orders['products_tax_class_id']))); + } + else { + echo sprintf(IS_PRODUCT_SHOW_PRICE, $currencies->display_price($orders['products_price'], tep_get_tax_rate($orders['products_tax_class_id']))); + } + ?> +
+
+ -
+
' . PHP_EOL; - if ( $item%MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_DISPLAY_ROW_MD == 0 ) echo '
' . PHP_EOL; - if ( $item%MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_DISPLAY_ROW_LG == 0 ) echo '
' . PHP_EOL; - if ( $item%MODULE_CONTENT_PRODUCT_INFO_ALSO_PURCHASED_DISPLAY_ROW_XL == 0 ) echo '
' . PHP_EOL; + if ( $item%IS_PRODUCT_PRODUCTS_DISPLAY_ROW_SM == 0 ) echo '
' . PHP_EOL; + if ( $item%IS_PRODUCT_PRODUCTS_DISPLAY_ROW_MD == 0 ) echo '
' . PHP_EOL; + if ( $item%IS_PRODUCT_PRODUCTS_DISPLAY_ROW_LG == 0 ) echo '
' . PHP_EOL; + if ( $item%IS_PRODUCT_PRODUCTS_DISPLAY_ROW_XL == 0 ) echo '
' . PHP_EOL; $item++; } - ?> -
+ ?> +
Date: Sat, 10 Aug 2019 17:41:46 +0100 Subject: [PATCH 14/15] Update pull_request_template.md (cherry picked from commit 393d96f37c91eeaa40070a43efcc4adefac23ce4) --- .github/pull_request_template.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index b2e640881..45fd0fbc4 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,13 +1,14 @@ -**IMPORTANT: Please do not create a Pull Request without creating an issue first.** +**IMPORTANT: Please do not create a PR unless you have first created an ISSUE and your issue has been discussed and accepted.** -*Any change needs to be discussed before proceeding. Failure to do so WILL result in the rejection of the pull request.* +*Any change needs to be discussed BEFORE you make a Pull Request. Failure to do so WILL result in immediate rejection of your Pull Request.* -Please provide enough information so that others can review your pull request (you can skip this if you're fixing a simple typo): +Please provide enough information in your raised ISSUE so that others can understand and review the details of your Test Plan: Explain the **details** for making this change. What existing problem does the pull request solve? Example: When "Adding a function to do X", explain why it is necessary to have a way to do X. **Test plan (required)** -Demonstrate the code is solid. +Demonstrate the code is solid. + Example: Link to an install that shows your new code in action. If that is not possible provide screenshots and/or the exact commands you ran and their output, screenshots / videos if the pull request changes UI. From 6f6d42a07137fb64ec689bc943666b2e7c5e97c3 Mon Sep 17 00:00:00 2001 From: gburton Date: Mon, 12 Aug 2019 11:27:00 +0100 Subject: [PATCH 15/15] 1.0.2.0 --- includes/version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/version.php b/includes/version.php index f74f0cbbf..67539e47a 100755 --- a/includes/version.php +++ b/includes/version.php @@ -1 +1 @@ -1.0.1.4 \ No newline at end of file +1.0.2.0 \ No newline at end of file