'.$item['code'].'';
+ $this->_xml['body'][] = '
+ '.$this->l('Connection Test Failed.').'',
+ '#FFD8D8', false);
+
+ Configuration::updateValue('SHIPWIRE_API_CONNECTED', 1);
+ return array('
+ '.$this->l('Congratulations! Your store is now linked to Shipwire.').'
+
+ ',
+ '#D6F5D6', true);
+
+ }
+
+ /*
+ ** Display a custom message for settings update
+ ** $text string Text to be displayed in the message
+ ** $type string (confirm|warn|error) Decides what color will the
+ ** message have (green|yellow)
+ */
+ private function _displayConfirmation($text = '', $type = 'confirm')
+ {
+ switch ($type)
+ {
+ case 'confirm':
+ $img = 'ok.gif';
+ break ;
+ case 'warn':
+ $img = 'warn2.png';
+ break ;
+ case 'error':
+ $img = 'disabled.gif';
+ break ;
+ default:
+ die('Invalid type.');
+ }
+
+ return array(
+ 'class' => Tools::safeOutput($type),
+ 'img' => Tools::safeOutput($img),
+ 'text' => (empty($text) ? $this->l('Settings updated') : $text)
+ );
+ }
+
+ /******************************************************************/
+ /** Web-service methods *******************************************/
+ /******************************************************************/
+
+ /******************************************************************/
+ /** Tools methods *************************************************/
+ /******************************************************************/
+ public function getCurrentURL($htmlEntities = false)
+ {
+ $url = $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
+ return (!empty($_SERVER['HTTPS']) ? 'https' : 'http').
+ '://'.($htmlEntities ? preg_replace('/&/', '&', $url): $url);
+ }
+
+ public function log($orderId, $transactionId)
+ {
+ return Db::getInstance()->Execute('REPLACE INTO `'._DB_PREFIX_.'shipwire_log`
+ (`transaction_ref`, `id_order`, `date_added`)
+ VALUES (\''.pSQL($transactionId).'\',
+ '.(int)$orderId.',
+ \''.date('Y-m-d H:i:s').'\')');
+ }
+
+ /******************************************************************/
+ /** Display methods *************************************************/
+ /******************************************************************/
+ private function _displayContent()
+ {
+ $cookie = $this->context->cookie;
+
+ $buffer = '
+ ';
+
+ if (isset($this->dParams['confirmMessage']))
+ $buffer .= '
+