Jump to content
shopmaker

Error and blank screen on updating currencies

Recommended Posts

Cubecart v 6.2.2
Browser Chrome
Windows 10

Hi. I'm new to Cubecart and have set up a new store over the last two weeks which is now live. 

I've pretty much got all of it going to my liking. I've installed the Kurouto skin and noted that a few options stopped working, such as "hide document title". This is not a big issue and I can live with it, but the following problem is bugging me. When I first installed I tried the currency update option it worked fine and it fetched the rates no problem. Now I try it and all I get is a blank screen and the following error in the system error log:

[Exception] /home/tvcommco/public_html/store/admin_xxxxxx/sources/settings.currency.inc.php:37 - String could not be parsed as XML

If anyone could point me to a solution I'd be very grateful. My store address is https:www.welovefabric.co.uk/store

Thank you.

Share this post


Link to post
Share on other sites

I've never used or even seen that feature, so I went looking.

The same thing happens to me.

 

Try this.

 

Edit admin.xxx/sources/settings.currency.inc.php

 

around line 27, you should find the current address for fetching the currency rate.

www.ecb.europa.eu', '/stats/eurofxref/eurofxref-daily.xml

Change this to:

 

https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml

 

Seems to work for me.

 

 

 

 

Edited by keat

Share this post


Link to post
Share on other sites

Correction: I no longer get the error message or a blank screen, but the column indicating the last updated date is stuck on the last time it worked, which was August 30th (it's now September 12th). The rates don't seem to have changed, either. Is this the correct XML file?

Share this post


Link to post
Share on other sites

I wasn't aware of the issue being previously reported, however, after making the change I suggested earlier, it worked for me and showed an update time of yesterday @ 00:00.

So I just I ran it again this evening and now get an update time of today @ 00:00, and I'm almost certain the Dollar rate has updated.

 

As a matter of interest, did you change yours to https ?

https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml

 

 

Edited by keat

Share this post


Link to post
Share on other sites

Just FYI: The Request class strips off anything before, and also, colon-slash-slash.

I fear your edit may not have given you the solution you were looking for.

Share this post


Link to post
Share on other sites

Ok thanks everyone, changing all the links to https was the answer. In the original post it wasn't made clear that there was more than one link to change. 

Thanks all for your help.

Share this post


Link to post
Share on other sites

At what point did it not work?

Did you get the banner that said the currency rate update succeeded or failed?

 

Share this post


Link to post
Share on other sites

So just to clarify, in the following instructions the "http://" is changed to "https://" in two places, which made it work for me. Initially I'd changed the "http://" only line 27 and got a banner saying that it had failed to update, but it's working fine now after changing both.

From the post here:https://github.com/cubecart/v6/issues/2165

/begin/

So, in settings.currency.inc.php, find:

if (($request = new Request('www.ecb.europa.eu', '/stats/eurofxref/eurofxref-daily.xml')) !== false) {
  $request->setMethod('get');
  $rates_xml = $request->send();

Change to:

if (($request = new Request('www.ecb.europa.eu', '/stats/eurofxref/eurofxref-daily.xml')) !== false) {
  $request->setMethod('get');
  $request->setSSL();
  $rates_xml = $request->send();

A few lines later, find:

$rates_xml = file_get_contents('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml');

Change to:

$rates_xml = file_get_contents('https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml');

 

/end/

Share this post


Link to post
Share on other sites
11 hours ago, bsmither said:

At what point did it not work?

Did you get the banner that said the currency rate update succeeded or failed?

 

Still just the blank page.

 

10 hours ago, shopmaker said:

So just to clarify, in the following instructions the "http://" is changed to "https://" in two places, which made it work for me. Initially I'd changed the "http://" only line 27 and got a banner saying that it had failed to update, but it's working fine now after changing both.

From the post here:https://github.com/cubecart/v6/issues/2165

/begin/

So, in settings.currency.inc.php, find:


if (($request = new Request('www.ecb.europa.eu', '/stats/eurofxref/eurofxref-daily.xml')) !== false) {
  $request->setMethod('get');
  $rates_xml = $request->send();

Change to:


if (($request = new Request('www.ecb.europa.eu', '/stats/eurofxref/eurofxref-daily.xml')) !== false) {
  $request->setMethod('get');
  $request->setSSL();
  $rates_xml = $request->send();

A few lines later, find:


$rates_xml = file_get_contents('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml');

Change to:


$rates_xml = file_get_contents('https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml');

 

/end/

Where is the second https you mention?  There are only 2 actions listed here, one is to change the http to https and the other to add the $request->setSSL(); line.  I don't see a second change from http to https in these two steps.

Share this post


Link to post
Share on other sites

Around line 27

if (($request = new Request('www.ecb.europa.eu', '/stats/eurofxref/eurofxref-daily.xml')) !== false) {
  $request->setMethod('get');
  $rates_xml = $request->send();


Change to:

if (($request = new Request('https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml')) !== false) {
  $request->setMethod('get');
  $request->setSSL();
  $rates_xml = $request->send();

A few lines later, find:

$rates_xml = file_get_contents('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml');

Change to:

$rates_xml = file_get_contents('https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml');

 

I never added the line:  $request->setSSL();

and it still seems to work.

Share this post


Link to post
Share on other sites
8 minutes ago, keat said:

I never added the line:  $request->setSSL();

and it still seems to work.

Just a blank page either way with me.  Might have to wait for the next version with all the fixes and upgrade my client's store to that and see if it fixes it.

Share this post


Link to post
Share on other sites

This one may or may not be causing problems:

open_basedir restriction in effect. File(/opt/plesk/php/7.2/share/pear/smarty_internal_data.class.php)
is not within the allowed path(s): (/var/www/vhosts/anabolnaturals.com/:/tmp/)

The autoloader is including /opt/plesk/php/7.2/share/pear/ as a valid directory to look in. Someone will be along shortly to discuss the relevance of this situation.

Here is the problem as posted in the Github. The edits there fixes this issue:

Entity: line 6: parser error : Opening and ending tag mismatch: hr line 5 and body
</body> in /var/www/vhosts/anabolnaturals.com/httpdocs
       ^ in /var/www/vhosts/anabolnaturals.com/httpdocs
Entity: line 7: parser error : Opening and ending tag mismatch: body line 3 and ht
</html> in /var/www/vhosts/anabolnaturals.com/httpdocs
       ^ in /var/www/vhosts/anabolnaturals.com/httpdocs
Entity: line 8: parser error : Premature end of data in tag html line 1

The expected response from the bank does not have <hr>, <body>, or <html> tags in it. However, an error document that says, "Please request our secure web page" does.

Therefore, some edits that have been made might not have been done correctly.

Restore the file to its original, just to make sure you are at the baseline, then apply the edits exactly as you see them at the conclusion of the Github issue thread.

However, the error_log entries are all Warnings. Meaning, none of these issues should be causing CubeCart (or PHP) to crash. Unless, we have found a "non-crash dead-end". Meaning, PHP thinks there isn't any more processing to do, but there was no output to send back to the browser either.

To answer that, we would need to learn what the Response Code for the Currency Update page request was: 200 OK, or 500 Server Error.

Share this post


Link to post
Share on other sites

No edits have been made to this file, but I went back and replaced it from the original CC download and added the edits.  Same issue.  Chrome developer tools network info shows 200 OK.  Putting the xml link directly in the url window returns valid xml.  CC is just hanging on something somewhere in this script's process.

Share this post


Link to post
Share on other sites

Any additional entries in the error_log?

Also, view in admin, Error Log, System Error Log tab.

Share this post


Link to post
Share on other sites

Oh man, I am an idiot.  I just realized I was updating everything in the admin/sources directory locally with my web editor and then uploading with it.  I completely forgot about that very strange feature of CC to copy and rename the admin folder on the server with a random _xxxxx to obscure the login page from bots.  I do see the purpose, but it is kind of an oddity that I have never seen before and still can't get used to it in my workflow.  I need to remember to push the modified admin folder back to my local site files after upgrades (or at least rename it the same) so it syncs with the right folder.    I fixed THAT one and it is now working.  

Thanks for your time on this.  Sorry it was a wild goose chase.

Share this post


Link to post
Share on other sites

Been there, done that, and probably will again at some point in the future.

 

Generally, the way I would do this, would be to ftp the file in question to my local pc.

Make the edit.

Using FTP, rename the original file, something lke  ' settings.currency.inc.php.sept18'

Then quickly upload the newly modified file.

The time between the rename and new upload is minimal.

This offers me the protection of being able to roll back quickly, and visibilty of when I last made an edit on that file.

Edited by keat

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×