Zen Cart Logo
Forums / General Questions / wanting to style the error message when credit card declined

wanting to style the error message when credit card declined

Locked

Views: 10,869

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
20 Nov 2008, 10:16 PM
#1
danwebman avatar

danwebman

New Zenner

Join Date:
Nov 2008
Posts:
71
Plugin Contributions:
0

wanting to style the error message when credit card declined

When my credit card gets declined, it sends back to payment step 2 with a tiny text saying "your credit card was declined..."
-basic white text over normal background color (black)
-it is at the utmost top of the page above everything!
-Version 1.3.8
-This is from a gateway services module for my CC purcahses
-- Below is (some of) the source code I get back with the page that has the error message at the top of it

Wondering how I can make this bigger and maybe even add a red background to the message

****There is Some Code Above This*****
function couponpopupWindow(url) {
  window.open(url,'couponpopupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=320,screenX=150,screenY=150,top=150,left=150')
}
function submitFunction($gv,$total) {
  if ($gv >=$total) {
    submitter = 1;	
  }
}

function methodSelect(theMethod) {
  if (document.getElementById(theMethod)) {
    document.getElementById(theMethod).checked = 'checked';
  }
}

//--></script>
</head>

<body id="checkoutpaymentBody">

<div id="mainWrapper">

Your credit card was declined. Please try another card or contact your bank for more info.

<!--bof-header logo and navigation display-->

<div id="headerWrapper">
<!--bof-navigation display-->
<div id="navMainWrapper">
<div id="navMain">
*******There Is More Code Below This*******
20 Nov 2008, 11:17 PM
#2
litepockets avatar

litepockets

Zen Follower

Join Date:
Apr 2008
Location:
Covington, Washington, United States
Posts:
206
Plugin Contributions:
0

Re: wanting to style the error message when credit card declined

Dan, what is website please

21 Nov 2008, 12:55 AM
#4
litepockets avatar

litepockets

Zen Follower

Join Date:
Apr 2008
Location:
Covington, Washington, United States
Posts:
206
Plugin Contributions:
0

Re: wanting to style the error message when credit card declined

OK thank you, I will take a look in a bit, have a few things i have to take care of tonight, but should be a quick css class definition....

21 Nov 2008, 4:04 PM
#5
litepockets avatar

litepockets

Zen Follower

Join Date:
Apr 2008
Location:
Covington, Washington, United States
Posts:
206
Plugin Contributions:
0

Re: wanting to style the error message when credit card declined

Dan, quick FYI, when you click on your logo you get taken to lulu.com.... don't know if that is by design or what...

Onto the issue @ hand...

when I enter an incorrect cc # after I press continue it is highlighted in red... when I enter a real cc # with incorrect exp and security code, it doesn't display an error at all... What payment module are you using...?

21 Nov 2008, 4:26 PM
#6
litepockets avatar

litepockets

Zen Follower

Join Date:
Apr 2008
Location:
Covington, Washington, United States
Posts:
206
Plugin Contributions:
0

Re: wanting to style the error message when credit card declined

Dan,

I'm sorry, you are absolutely right, it is indeed up there...

OK, in your code below it looks like you copy and pasted what was displayed. You will need to locate the file that produces this text. Around the text make a div with a created class...> <div class="ccDecline">Your credit card was declined. Please try another card or contact your bank for more info.</div>.

Once you create that div in that file, open you includes/templates/yourtemplate/css/ stylesheet.css file and add the following the end of the document:

.ccDecline {
background-color:#FF0000;
font-weight: bold;
}

This should do it....

The trouble will be finding the document that produces the message. It will likely be in a variable. So look up that string in your admin panel. Lookup admin>tools>developers toolkit

in the last field type 4-5 words from the string, (Your credit card was declined) will work. In the dropdown next to it select catalog. Your results searching for the page this string is in will be displayed. sift through there to find the page that produces this string. Add the div above, and your set :)

25 Nov 2008, 3:26 AM
#7
danwebman avatar

danwebman

New Zenner

Join Date:
Nov 2008
Posts:
71
Plugin Contributions:
0

Re: wanting to style the error message when credit card declined

Neither attemp worked... when I try and modify the file that has the DECLINED message in any way, it produces a blank page during checkout.:

****FROM THE: languages/english/modules/payment/

<?php define('MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_TITLE', 'Gateway Services (Credit Card)'); define('MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_PUBLIC_TITLE', 'Credit Card'); define('MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_DESCRIPTION', '<strong>Gateway Services Credit Card Module</strong><br><br>Credit Card Test Info:<br>CC Number: 4111111111111111<br>CC Expiry: Any valid expiration'); define('MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_CREDIT_CARD_OWNER', 'Credit Card Owner:'); define('MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_CREDIT_CARD_NUMBER', 'Credit Card Number:'); define('MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_CREDIT_CARD_EXPIRES', 'Credit Card Expiry Date:'); define('MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_JS_CC_OWNER', '* The owner\'s name of the credit card must be at least ' . CC_OWNER_MIN_LENGTH . ' characters.\n'); define('MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_JS_CC_NUMBER', '* The credit card number must be at least ' . CC_NUMBER_MIN_LENGTH . ' characters.\n'); define('MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_JS_CSC', '* The credit card security code must be 3 characters (4 for American Express).\n'); define('MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_ERROR_CSC', 'The credit card security code must be 3 characters (4 for American Express).'); define('MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_ERROR_MESSAGE', 'There has been an error processing your credit card. Please try again.'); define('MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_DECLINED_MESSAGE', 'Your credit card was declined. Please try another card or contact your bank for more info.'); define('MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_ERROR', 'Credit Card Error!'); define('MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_CARD_SECURITY_CODE', 'Credit Card Security Code:'); define('MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_CSC_DESCRIPTION', '(located on the back of the credit card)'); ?>

---This is the entire page for the .php document. The weird thing is that if it is a wrong # entered for the credit card an error message is in the middle of the page with red background? The error message at the top only comes up when the "...credit card has been declined....."

****here is some .php from where the error message is generated in the : /modules/payment/

function before_process() {

  if ($_GET['response'] == '1') return;
  if ($_GET['response'] == '2') {
    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_DECLINED_MESSAGE), 'SSL', true, false));
  }
  // Code 3 is an error - but anything else is an error too (IMHO)
    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_ERROR_MESSAGE), 'SSL', true, false));
}

function after_process() {
  return false;
}

function get_error() {

  $error = array('title' => MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_ERROR,
                 'error' => stripslashes(urldecode($_GET['error'])));

  return $error;
}

function check() {
    global $db;
  if (!isset($this->_check)) {
    $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_GATEWAY_SERVICES_CC_STATUS'");
    $this->_check = $check_query->RecordCount();
  }
  return $this->_check;
}
25 Nov 2008, 4:04 AM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: wanting to style the error message when credit card declined

I suspect your payment module wasn't written for the version of Zen Cart that you're using.

The current version of Zen Cart doesn't rely on the &error_message= parameter to display payment messages.

It would instead be written something like this:```
if ($_GET['response'] == '2') {
$messageStack->add_session('checkout_payment', MODULE_PAYMENT_GATEWAY_SERVICES_CC_TEXT_DECLINED_MESSAGE, 'error');
zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true, false));
}

26 Nov 2008, 7:15 AM
#9
danwebman avatar

danwebman

New Zenner

Join Date:
Nov 2008
Posts:
71
Plugin Contributions:
0

Re: wanting to style the error message when credit card declined

So I tried it just as you wrote it for the message stack, and it gave me a blank page during checkout... any other ideas?

26 Nov 2008, 8:15 AM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: wanting to style the error message when credit card declined

A blank page means you've created a PHP syntax error, either by directly editing a file incorrectly, or required files are not found.

There is a debug logging utility in step 2a of this FAQ article dealing with Blank Pages: https://www.zen-cart.com/tutorials/index.php?article=82