Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Credit Card Expiry Date Length

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #21  
Old 06-16-2004, 01:03 AM
 
DanUK DanUK is offline
 

X-Adept
  
Join Date: Dec 2003
Location: UK
Posts: 800
 

Default

Thanks for the code Boomer (much more efficient than my attempt )!

This works on my 3.5.4 version up to a point, but the value is not present on the order email. I'm doing offline processing if that matters. Just wondering if there's anything obvious that may be stopping it being output?

Many thanks

Dan
__________________
4.4.2

and

4.6.1
Reply With Quote
  #22  
Old 06-17-2004, 05:56 AM
 
DanUK DanUK is offline
 

X-Adept
  
Join Date: Dec 2003
Location: UK
Posts: 800
 

Default

Finally, seem to have got it to work. The only difference being I put the:

Code:
$card_expire = $card_expire_Month.substr($card_expire_Year,2,2);

Statement in payment/payment_cc.php where I originally put the concatenating code in my original example, so:

Code:
require "../include/payment_method.php"; if ($REQUEST_METHOD=="POST") { $order_details = ""; HERE! >>>> $card_expire = $card_expire_Month.substr($card_expire_Year,2,2); if ($store_cc) {

Now I get a 2 digit month and year. I'm off now to do the same with the "valid from" date.

Oh, I've also used the numerical equivalent for the displaying of month seen as CC's only use digits -believe you me, some people have difficulty trying to work out the numeric value of a month so best keep things simple, so:

Code:
{html_select_date prefix="card_expire_" time=$time month_format=%m start_year="-2" end_year="+8"}

noting the month_format=%m attribute.

Dan

Dan
__________________
4.4.2

and

4.6.1
Reply With Quote
  #23  
Old 06-18-2004, 05:25 AM
 
DanUK DanUK is offline
 

X-Adept
  
Join Date: Dec 2003
Location: UK
Posts: 800
 

Default Javascript help

OK, using the examples I have written about above, I've successfuly created dropdown boxes for the expiry and valid from dates using the smarty function, html_select_date. The problem I have now is when I switch CC validation on the Javascript cc checking function falls flat as it's checking the default $expire_date value. At the moment I'm getting two values that are eventually concatenated:

card_expire_Month e.g. 06
card_expire_Year e.g. 2004

I was trying to be clever in altering the cc validating javascript by changing function checkExpirationDate in check_cc_number_script.tpl by replacing:

Code:
ed = expiration_date.value;

with:

Code:
ed = card_expire_Month + card_expire_Year.substring(2,2);

to concatenate the month and the last two digits of the year from these Smarty select boxes. Now I get a javascript error saying "card_expire_Month" is undefined.

Any ideas on how to sort this before I remove the expiry date checking javascript altogether?

Thanks

Dan
__________________
4.4.2

and

4.6.1
Reply With Quote
  #24  
Old 07-01-2004, 09:23 AM
 
markroyko markroyko is offline
 

Newbie
  
Join Date: Apr 2004
Posts: 6
 

Default fix for javascript and linkpoint

Actually, if you're using the drop-down method seen in earlier posts, there's really no reason to re-validate with the javascript. (Since it only checks for string value entry errors, and presumably, these kind of errors would no longer exist.....) With that in mind, I just skipped the expiration date-checking js altogether by changing the following in checkout.tpl. Change it from this (at around line 53):
to this:
That takes care of the js errors.

....Also, I use linkpoint and had to change the following on lines 59 and 60 in the cc_linkpoint.php file to reflect the new post variables. (There's no need to search for individual entries in the card_expire string.....), so change from this:
Code:
$post[] = "<cardexpmonth>".substr($userinfo["card_expire"],0,2)."</cardexpmonth>"; $post[] = "<cardexpyear>".substr($userinfo["card_expire"],2,2)."</cardexpyear>";

to this:
Code:
$post[] = "<cardexpmonth>".$userinfo["card_expire_month"]."</cardexpmonth>"; $post[] = "<cardexpyear>".$userinfo["card_expire_year"]."</cardexpyear>";


You may need to do something similar with other payment gateways.
__________________
www.markroyko.com
Reply With Quote
  #25  
Old 07-01-2004, 11:30 AM
 
SMDStudios SMDStudios is offline
 

eXpert
  
Join Date: Dec 2003
Location: Orlando, FL
Posts: 207
 

Default

Looks like there are a couple different versions floating around of this mod. Once all the bugs are worked out could someone post a final version of this mod?

TIA!
__________________
X-Cart Gold various versions
Tahoe Web Design

WebsiteCM.com - We recommend WebsiteCM
Reply With Quote
  #26  
Old 02-08-2006, 06:38 AM
 
DanUK DanUK is offline
 

X-Adept
  
Join Date: Dec 2003
Location: UK
Posts: 800
 

Default

OK, I worked out how to have a blank month and year added to the valid from date select boxes (as it looks odd if there's an entry and you don't actually need it) by adding:

Code:
year_empty="" month_empty=""

so it looks like:

Code:
{html_select_date prefix="card_valid_from_" month_format="%m" display_days=false start_year="-5" end_year="+4" year_empty="" month_empty=""}

But, I can't work out how to have the blank boxes selected by default. I've searched on Google and looked at various smarty pages, but the closest I can find is using the time attribute but that only works with dates. Anyone know how to do this?

Thanks

Dan[/code]
__________________
4.4.2

and

4.6.1
Reply With Quote
  #27  
Old 07-19-2006, 02:42 PM
 
jrhalli jrhalli is offline
 

Newbie
  
Join Date: Sep 2004
Location: Texas
Posts: 3
 

Default

I'm working on the same thing as above...I've managed to get the Year dropdown to default to "Select a Year", but the Month defaults to December now, wheras previously it was defaulting to the current month.

The closest I've come to finding an explanation is on another forum located at: http://www.phpinsider.com/smarty-forum/viewtopic.php?t=5198&highlight=htmlselectdate and http://www.phpinsider.com/smarty-forum/viewtopic.php?t=6141&highlight=htmlselectdate

I'm still trying to figure out how to get the month to default to month_empty="Select Month".

This is the link to the {html_select_date} custom function:
http://smarty.php.net/manual/en/language.function.html.select.date.php
__________________
-John
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:55 PM.

   

 
X-Cart forums © 2001-2020