From 09067b6d004aadd42ef061851567579436019431 Mon Sep 17 00:00:00 2001 From: Harald Ponce de Leon Date: Mon, 21 Nov 2016 03:04:16 +0100 Subject: [PATCH] general updates; language definition update --- catalog/admin/categories.php | 6 ++--- catalog/includes/OSC/Schema/products.txt | 2 +- .../content/product_info/cm_pi_gtin.php | 22 +++++++++++++------ .../content/product_info/templates/gtin.php | 6 ++++- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/catalog/admin/categories.php b/catalog/admin/categories.php index 9f66ba8f6..7cb1eb350 100644 --- a/catalog/admin/categories.php +++ b/catalog/admin/categories.php @@ -242,8 +242,8 @@ 'products_weight' => (float)HTML::sanitize($_POST['products_weight']), 'products_status' => HTML::sanitize($_POST['products_status']), 'products_tax_class_id' => HTML::sanitize($_POST['products_tax_class_id']), - 'manufacturers_id' => (int)HTML::sanitize($_POST['manufacturers_id'])); - $sql_data_array['products_gtin'] = (tep_not_null($_POST['products_gtin'])) ? str_pad(HTML::sanitize($_POST['products_gtin']), 14, '0', STR_PAD_LEFT) : 'null'; + 'manufacturers_id' => (int)HTML::sanitize($_POST['manufacturers_id']), + 'products_gtin' => tep_not_null($_POST['products_gtin']) ? str_pad(HTML::sanitize($_POST['products_gtin']), 14, '0', STR_PAD_LEFT) : 'null'); $products_image = new upload('products_image'); $products_image->set_destination(OSCOM::getConfig('dir_root', 'Shop') . 'images/'); @@ -743,7 +743,7 @@ function updateNet() {
products_weight); ?>
- +
products_gtin); ?>
diff --git a/catalog/includes/OSC/Schema/products.txt b/catalog/includes/OSC/Schema/products.txt index bdf0ec93c..a7aa0ff61 100644 --- a/catalog/includes/OSC/Schema/products.txt +++ b/catalog/includes/OSC/Schema/products.txt @@ -11,7 +11,7 @@ products_status tinyint(1) not_null products_tax_class_id int not_null manufacturers_id int products_ordered int default(0) not_null -products_gtin char(14) null +products_gtin char(14) -- primary products_id idx_products_model products_model diff --git a/catalog/includes/modules/content/product_info/cm_pi_gtin.php b/catalog/includes/modules/content/product_info/cm_pi_gtin.php index 127989c63..ff573325d 100644 --- a/catalog/includes/modules/content/product_info/cm_pi_gtin.php +++ b/catalog/includes/modules/content/product_info/cm_pi_gtin.php @@ -6,6 +6,7 @@ * @license MIT; https://www.oscommerce.com/license/mit.txt */ + use OSC\OM\HTML; use OSC\OM\OSCOM; use OSC\OM\Registry; @@ -35,7 +36,7 @@ function execute() { global $oscTemplate; $content_width = (int)MODULE_CONTENT_PRODUCT_INFO_GTIN_CONTENT_WIDTH; - + $OSCOM_Db = Registry::get('Db'); $Qgtin = $OSCOM_Db->prepare('select products_gtin from :table_products where products_id = :products_id'); @@ -43,14 +44,21 @@ function execute() { $Qgtin->execute(); if ($Qgtin->fetch() !== false) { - $gtin = $Qgtin->valueProtected('products_gtin') - $gtin = substr($gtin, 0-MODULE_CONTENT_PRODUCT_INFO_GTIN_LENGTH); + $gtin = $Qgtin->value('products_gtin'); + + if (!empty($gtin)) { + $gtin = substr($gtin, 0 - MODULE_CONTENT_PRODUCT_INFO_GTIN_LENGTH); + + if (!empty($gtin)) { + $gtin = HTML::outputProtected($gtin); - ob_start(); - include('includes/modules/content/' . $this->group . '/templates/gtin.php'); - $template = ob_get_clean(); + ob_start(); + include('includes/modules/content/' . $this->group . '/templates/gtin.php'); + $template = ob_get_clean(); - $oscTemplate->addContent($template, $this->group); + $oscTemplate->addContent($template, $this->group); + } + } } } diff --git a/catalog/includes/modules/content/product_info/templates/gtin.php b/catalog/includes/modules/content/product_info/templates/gtin.php index 10c77b7cf..b143717f5 100644 --- a/catalog/includes/modules/content/product_info/templates/gtin.php +++ b/catalog/includes/modules/content/product_info/templates/gtin.php @@ -1,8 +1,12 @@ + +