NodsDorf Posted January 2, 2010 Posted January 2, 2010 I'm getting a T String error after installing the CCGV module. Not an expert but this code looks funny.. does this look right? line 88-90 Exact error: = Parse error: syntax error, unexpected T_STRING in /home6/onlinecd/public_html/index/includes/classes/payment.php on line 89 Code: Editable Code Box: // Start - CREDIT CLASS Gift Voucher Contribution // function javascript_validation() { function javascript_validation($coversAll) { //added the $coversAll to be able to pass whether or not the voucher will cover the whole //price or not. If it does, then let checkout proceed when just it is passed. $js = ''; if (is_array($this->modules)) { if ($coversAll) { $addThis='if (document.checkout_payment.cot_gv.checked) { payment_value='cot_gv'; } else '; } else { $addThis=''; } // End - CREDIT CLASS Gift Voucher Contribution $js = '<script language="javascript"><!-- ' . "\n" . 'function check_form() {' . "\n" . ' var error = 0;' . "\n" . ' var error_message = "' . JS_ERROR . '";' . "\n" .
germ Posted January 3, 2010 Posted January 3, 2010 } else '; That line is definitely going to cause an error. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
NodsDorf Posted January 3, 2010 Author Posted January 3, 2010 Thanks germ, I'm trying to use logic to figure out what the author meant to code there. even if I delete line 90 the } else '; I still get stuck on line 89's t_string error So is the problem has to be with the payment_value or cot_gv variable right?
germ Posted January 3, 2010 Posted January 3, 2010 Try this: $addThis='if (document.checkout_payment.cot_gv.checked) { payment_value=\'cot_gv'; If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
MrPhil Posted January 3, 2010 Posted January 3, 2010 No, $addThis is supposed to get a full string (containing some PHP code). There are two single quotes within it which need to be escaped: $addThis='if (document.checkout_payment.cot_gv.checked) { payment_value=\'cot_gv\'; } else '; Presumably there is a single statement later on, where $addThis gets put in front of it, yielding in the end either if (document.checkout_payment.cot_gv.checked) { payment_value='cot_gv'; } else some_other_statement; or just some_other_statement;
NodsDorf Posted January 3, 2010 Author Posted January 3, 2010 No, $addThis is supposed to get a full string (containing some PHP code). There are two single quotes within it which need to be escaped: $addThis='if (document.checkout_payment.cot_gv.checked) { payment_value=\'cot_gv\'; } else '; Presumably there is a single statement later on, where $addThis gets put in front of it, yielding in the end either if (document.checkout_payment.cot_gv.checked) { payment_value='cot_gv'; } else some_other_statement; or just some_other_statement; Thanks Germ and MrPhil by escaping both the ' in the 'cot_gv' variable it is no longer giving me an error. Going to verify that it didn't cause other problems with the module now. Thanks.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.