Robert ORourke Posted August 21, 2023 Share Posted August 21, 2023 I have installed Paypal Commerce to my cubecart 6.2.6 site but when I enable the plugin my website just loads a white screen. I have checked my error log and get the following [<strong>Exception</strong>] /var/www/vhosts/personalisedtradegifts.co.uk/httpdocs/modules/plugins/paypal_commerce/hooks/class.gui.head_js.php:20 - syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) I don't know if updating my cubecart version is necessary but I'm scared of breaking something so I'll leave that until I know I need to. I'm not overly technical on this side so any advice would be great. Robert O'Rourke www.personalisedtradegifts.co.uk Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 21, 2023 Share Posted August 21, 2023 (edited) Please let us know the version of the PayPal Commerce plugin. That can be determined by using a text viewer to look at the plugin file config.xml. There will be a statement near line 20 that reads something like: <version>1.8.5</version> Then, look at the plugin file /hooks/class.gui.head_js.php, and let us know what line 20 looks like. Also, let us know the exact version of PHP that is running your site. Edited August 21, 2023 by bsmither Quote Link to comment Share on other sites More sharing options...
Robert ORourke Posted August 21, 2023 Author Share Posted August 21, 2023 I tried Paypal Commerce 1.8.5 then installed 1.8.3 to see if it made a difference. Currently on 1.8.3 PHP Version 7.2.34 Then, look at the plugin file /hooks/class.gui.head_js.php, and let us know what line 20 looks like. ..... I don't understand how to find this? Regards Robert Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 21, 2023 Share Posted August 21, 2023 If your site is hosted, your hosting provider should provide a way for you to manage your site - many times with Cpanel. Cpanel has a file viewer tool. Use it to find and view the file /modules/plugins/paypal_commerce/hooks/class.gui.head_js.php. The viewer should show line numbers, so copy the statement at line 20 and paste it in your reply to this forum conversation. Quote Link to comment Share on other sites More sharing options...
Robert ORourke Posted August 21, 2023 Author Share Posted August 21, 2023 OK found it in my Plesk } elseif(isset($_GET['_a']) && !in_array($_GET['_a'], array('basket'))) { Regards Robert Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 21, 2023 Share Posted August 21, 2023 Ok, nothing wrong in that line. However... In the file class.gui.head_js.php, lines 15-19, there is this: if($module_config['applepay']=='1') { $head_js[] = <<<EOT <script src="https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js"></script> EOT; } The <<<EOT is called 'Heredoc' text syntax. There are rules for how Heredoc is written: Quote A third way to delimit strings is the heredoc syntax: <<<. After this operator, an identifier is provided, then a newline. The string itself follows, and then the same identifier again to close the quotation. The closing identifier may be indented by space or tab, in which case the indentation will be stripped from all lines in the doc string. Prior to PHP 7.3.0, the closing identifier must begin in the first column of the line. Since you are running PHP 7.2, these lines 15-19 must be written as follows: if($module_config['applepay']=='1') { $head_js[] = <<<EOT <script src="https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js"></script> EOT; } So, determine if your text viewer is also an editor and if so, make the changes to the above code. Quote Link to comment Share on other sites More sharing options...
Robert ORourke Posted August 21, 2023 Author Share Posted August 21, 2023 Mine looks the same ... if($module_config['applepay']=='1') { $head_js[] = <<<EOT <script src="https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js"></script> EOT; } My viewer does indeed appear to let me alter the code Regards Robert Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 21, 2023 Share Posted August 21, 2023 Again, make sure that the three middle lines all start at column one - no leading spaces. Quote Link to comment Share on other sites More sharing options...
Robert ORourke Posted August 21, 2023 Author Share Posted August 21, 2023 Oh WOW ... Website now loading! Will run through and see if paypal integrated properly. Thank you SOOO much for the help! Many Thanks Robert Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.