Jump to content

Paypal Commerce Installation results in website loading a white screen


Recommended Posts

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

Link to comment
Share on other sites

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 by bsmither
Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...