Skip to content

Commit

Permalink
general updates; language definition update
Browse files Browse the repository at this point in the history
  • Loading branch information
haraldpdl committed Nov 21, 2016
1 parent 414d98d commit 09067b6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
6 changes: 3 additions & 3 deletions catalog/admin/categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/');
Expand Down Expand Up @@ -743,7 +743,7 @@ function updateNet() {
<div class="row">
<?= OSCOM::getDef('text_products_weight') . HTML::inputField('products_weight', $pInfo->products_weight); ?>
</div>

<div class="row">
<?= OSCOM::getDef('text_products_gtin') . HTML::inputField('products_gtin', $pInfo->products_gtin); ?>
</div>
Expand Down
2 changes: 1 addition & 1 deletion catalog/includes/OSC/Schema/products.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 15 additions & 7 deletions catalog/includes/modules/content/product_info/cm_pi_gtin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -35,22 +36,29 @@ 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');
$Qgtin->bindInt(':products_id', $_GET['products_id']);
$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);
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?php
use OSC\OM\OSCOM;
?>

<div class="col-sm-<?php echo $content_width; ?> gtin">
<ul class="list-group">
<li class="list-group-item">
<span itemprop="gtin<?php echo MODULE_CONTENT_PRODUCT_INFO_GTIN_LENGTH; ?>" class="badge"><?php echo $gtin; ?></span>
<?php echo MODULE_CONTENT_PRODUCT_INFO_GTIN_PUBLIC_TITLE; ?>
<?php echo OSCOM::getDef('module_content_product_info_gtin_public_title'); ?>
</li>
</ul>
</div>

0 comments on commit 09067b6

Please sign in to comment.