
Originally Posted by
ianhg
Its the MODULE_PAYMENT_BRAINTREE_DEBUGGING and MODULE_PAYMENT_BRAINTREE_VERSION that are showing a problem $new_version_details = plugin_version_check_for_updates(1781, MODULE_PAYMENT_BRAINTREE_VERSION)
even though I have this before
PHP Code:
$this->codeVersion = (defined('MODULE_PAYMENT_BRAINTREE_VERSION')) ? MODULE_PAYMENT_BRAINTREE_VERSION : false;
Just not too sure how fix undefined constant, just want to stop the PHP errors.
Thanks
ian,
a few things:- when posting your code, try and keep the line feed or carriage returns. your post a couple above is a little hard to read.
- the errors that you are seeing are warnings and should not affect processing.
- warnings can be turned off by going to configuration -> logging.
- these warnings only occur when you are first installing the module and are of little consequence.
- i can not vouch for how the rest of the module works.
- if you want the warnings to disappear, you can replace the whole construct function to the code i have listed below. this has worked in my limited testing.
- hope that helps!
PHP Code:
function __construct() {
include_once(zen_get_file_directory(DIR_FS_CATALOG . DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/payment/', 'braintree_api.php', 'false'));
global $order;
$this->code = 'braintree_api';
$this->title = MODULE_PAYMENT_BRAINTREE_TEXT_ADMIN_TITLE;
$this->codeVersion = (defined('MODULE_PAYMENT_BRAINTREE_VERSION')) ? MODULE_PAYMENT_BRAINTREE_VERSION : false;
$this->enabled = defined('MODULE_PAYMENT_BRAINTREE_STATUS') && (MODULE_PAYMENT_BRAINTREE_STATUS == 'True');
// Set the title & description text based on the mode we're in
if ($this->enabled && IS_ADMIN_FLAG === true) {
if (file_exists(DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'plugin_support.php')) {
require_once(DIR_FS_CATALOG . DIR_WS_FUNCTIONS . 'plugin_support.php');
$new_version_details = plugin_version_check_for_updates(1781, MODULE_PAYMENT_BRAINTREE_VERSION);
if ($new_version_details !== FALSE) {
$this->title .= '<span class="alert">' . ' - NOTE: A NEW VERSION OF THIS PLUGIN IS AVAILABLE. <a href="' . $new_version_details['link'] . '" target="_blank">[Details]</a>' . '</span>';
}
}
$this->description = sprintf(MODULE_PAYMENT_BRAINTREE_TEXT_ADMIN_DESCRIPTION, ($this->codeVersion) ? ' (rev' . $this->codeVersion . ')': '');
$this->title = MODULE_PAYMENT_BRAINTREE_TEXT_ADMIN_TITLE;
if ($this->enabled) {
if (MODULE_PAYMENT_BRAINTREE_SERVER == 'sandbox')
$this->title .= '<strong><span class="alert"> (sandbox active)</span></strong>';
if (MODULE_PAYMENT_BRAINTREE_DEBUGGING == 'Log File' || MODULE_PAYMENT_BRAINTREE_DEBUGGING == 'Log and Email')
$this->title .= '<strong> (Debug)</strong>';
if (!function_exists('curl_init'))
$this->title .= '<strong><span class="alert"> CURL NOT FOUND. Cannot Use.</span></strong>';
}
} else {
$this->description = MODULE_PAYMENT_BRAINTREE_TEXT_DESCRIPTION;
$this->title = MODULE_PAYMENT_BRAINTREE_TEXT_TITLE; //cc
}
if ((!defined('BRAINTREE_OVERRIDE_CURL_WARNING') || (defined('BRAINTREE_OVERRIDE_CURL_WARNING') && BRAINTREE_OVERRIDE_CURL_WARNING != 'True')) && !function_exists('curl_init'))
$this->enabled = false;
if (empty($this->enabled) || !$this->enabled) {
return;
}
$this->enableDebugging = (MODULE_PAYMENT_BRAINTREE_DEBUGGING == 'Log File' || MODULE_PAYMENT_BRAINTREE_DEBUGGING == 'Log and Email');
$this->emailAlerts = (MODULE_PAYMENT_BRAINTREE_DEBUGGING == 'Log and Email');
$this->sort_order = MODULE_PAYMENT_BRAINTREE_SORT_ORDER;
$this->order_pending_status = MODULE_PAYMENT_BRAINTREE_ORDER_PENDING_STATUS_ID;
if ((int) MODULE_PAYMENT_BRAINTREE_ORDER_STATUS_ID > 0) {
$this->order_status = MODULE_PAYMENT_BRAINTREE_ORDER_STATUS_ID;
}
$this->zone = (int) MODULE_PAYMENT_BRAINTREE_ZONE;
if (is_object($order))
$this->update_status();
if (!(PROJECT_VERSION_MAJOR > 1 || (PROJECT_VERSION_MAJOR == 1 && substr(PROJECT_VERSION_MINOR, 0, 3) >= 5)))
$this->enabled = false;
// debug setup
if (!defined('DIR_FS_LOGS')) {
$log_dir = 'cache/';
} else {
$log_dir = DIR_FS_LOGS;
}
if (!@is_writable($log_dir))
$log_dir = DIR_FS_CATALOG . $log_dir;
if (!@is_writable($log_dir))
$log_dir = DIR_FS_SQL_CACHE;
// Regular mode:
if ($this->enableDebugging)
$this->_logLevel = 2;
// DEV MODE:
if (defined('BRAINTREE_DEV_MODE') && BRAINTREE_DEV_MODE == 'true')
$this->_logLevel = 3;
}