Code:
function updateNotifyAttributesModuleStartOptionsLoop(&$callingClass, $notifier, $i, &$products_options_fields){
global $db, $options_menu_images, $products_options_array, $products_options_names,
$PWA_STOCK_QTY;
$this->_products_options_names_current++;
if ($this->_products_options_names_current == 1) {
global $currencies;
$show_attribute_stock_left = true;
/****************************************************
/* Absolute-Solutions.co.uk Edit
/*
/* Attributes Grid format
/* 1 of 2
/****************************************************/
// PRODUCTS_OPTIONS_TYPE_GRID is the ID for the GRID option
if (!defined('PRODUCTS_OPTIONS_TYPE_GRID')) {// || !defined('CONFIG_ATTRIBUTE_OPTION_GRID_INSTALLED') || CONFIG_ATTRIBUTE_OPTION_GRID_INSTALLED != 'true') {
$products_options_types_name = 'Grid';
/*if (!defined('PRODUCTS_OPTIONS_TYPE_GRID'))*/ {
$sql = "SELECT products_options_types_name, products_options_types_id FROM " . TABLE_PRODUCTS_OPTIONS_TYPES . " WHERE
products_options_types_name = :products_options_types_name: AND products_options_types_name != '';";
$sql = $db->bindVars($sql, ':products_options_types_name:', $products_options_types_name, 'string');
$result = $db->Execute($sql);
if ($result !== false && $result->RecordCount() > 0) {
// Is found, reassign $resultGID to found value.
$resultGID = $result->fields['products_options_types_id'];
} else {
$sql = "SELECT pot.products_options_types_id, pot.products_options_types_name
FROM ".TABLE_PRODUCTS_OPTIONS_TYPES." pot
order by pot.products_options_types_id desc limit 1";
$result = $db->Execute($sql);
$resultGID = $result->fields['products_options_types_id'] + 1;
$sql = "INSERT INTO ".TABLE_PRODUCTS_OPTIONS_TYPES." (`products_options_types_id`, `products_options_types_name`)
VALUES (:resultGID:, :products_options_types_name:);";
$sql = $db->bindVars($sql, ':resultGID:', $resultGID, 'integer');
$sql = $db->bindVars($sql, ':products_options_types_name:', $products_options_types_name, 'string');
$result = $db->Execute($sql);
}
if( $result !== false /*&& $result->fields['products_options_types_name'] != ''*/ ){
// PRODUCT_TYPE_ATTRIBUTE_OPTION_GRID was the "old" version.
$configuration_title = 'Selection list product option type (Grid)';
$configuration_key = 'PRODUCTS_OPTIONS_TYPE_GRID';
$configuration_value = $resultGID;
$configuration_description = 'Numeric value of the grid product option type used for SBA';
$configuration_group_id = 6;
$sort_order = 0;
$last_modified = 'NULL';
$date_added = 'now()';
$use_function = 'NULL';
$set_function = 'NULL';
$sql = "INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value,
configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function)
VALUES
(:configuration_title:, :configuration_key:, :configuration_value:,
:configuration_description:,
:configuration_group_id:, :sort_order:, :last_modified:, :date_added:, :use_function:, :set_function:);";
$sql = $db->bindVars($sql, ':configuration_title:', $configuration_title, 'string');
$sql = $db->bindVars($sql, ':configuration_key:', $configuration_key, 'string');
$sql = $db->bindVars($sql, ':configuration_value:', $configuration_value, 'integer');
$sql = $db->bindVars($sql, ':configuration_description:', $configuration_description, 'string');
$sql = $db->bindVars($sql, ':configuration_group_id:', $configuration_group_id, 'integer');
$sql = $db->bindVars($sql, ':sort_order:', $sort_order, 'integer');
$sql = $db->bindVars($sql, ':last_modified:', $last_modified, (($last_modified == 'now()' || $last_modified == 'NULL') ? 'noquotestring' : 'string'));
$sql = $db->bindVars($sql, ':date_added:', $date_added, (($date_added == 'now()' || $date_added == 'NULL') ? 'noquotestring' : 'string'));
$sql = $db->bindVars($sql, ':use_function:', $use_function, (($use_function == 'now()' || $use_function == 'NULL') ? 'noquotestring' : 'string'));
$sql = $db->bindVars($sql, ':set_function:', $set_function, (($set_function == 'now()' || $set_function == 'NULL') ? 'noquotestring' : 'string'));
$db->Execute($sql);
}
define('PRODUCTS_OPTIONS_TYPE_GRID', $resultGID);
}
}
Bookmarks