Jump to content
thirty bees forum
  • 0

Server 500 error on check out


Question

Posted (edited)

Hi, I'm getting a Server 500 error when attempting to check out.

Decrypting the error message file I get

Source file: classes/Link.php


 

Line 161 (161: throw new PrestaShopException('Invalid product vars') is highlighted in red so I am assuming the rest of the code is okay.

 (!$idLang) {
150:            $idLang = Context::getContext()->language->id;
151:        }
152:
153:        $url = $this->getBaseLink($idShop, null, $relativeProtocol).$this->getLangLink($idLang, null, $idShop);
154:
155:        if (!is_object($product)) {
156:            if (is_array($product) && isset($product['id_product'])) {
157:                $product = new Product($product['id_product'], false, $idLang, $idShop);
158:            } elseif ((int) $product) {
159:                $product = new Product((int) $product, false, $idLang, $idShop);
160:            } else {
161:                throw new PrestaShopException('Invalid product vars');
162:            }
163:        }
164:
165:        // Set available keywords
166:        $params = [];
167:        $params['id'] = $product->id;
168:        $params['rewrite'] = (!$alias) ? $product->getFieldByLang('link_rewrite') : $alias;
169:
170:        $params['ean13'] = (!$ean13) ? $product->ean13 : $ean13;
171:        $params['meta_keywords'] =    Tools::str2url($product->getFieldByLang('meta_keywords'));

I am not sure how this got generated but I may have been logged in as the same "customer" in two different browsers on my laptop at the same time. I was also fiddling with performance settings and messing with the cache settings, but I put them all back to the settings before I started fiddling and ensured I was only logged in by one browser. So went back to the starting position essentially but still it would not let me proceed so suspect something nasty got written to the database perhaps? that prevents moving on?

Any ideas on this one? I had it before and I did a complete new install to get rid of it and rebuilt the whole site again. Now I have crasdhed it again and cant recover from clicking checkout and getting server 500 error even with just one login and rebuilding cache etc.

Edited by James1
typos

17 answers to this question

Recommended Posts

  • 1
Posted

I've been able to recreate the 500 Server error.

1) Preferences/Orders has to be saved as: Order process type = One-page checkout

2) Fill the shopping cart with at least one item and then go to checkout. Don't complete the purchase and go back to the home page. Play around viewing items and then go back to the cart and voila, instant 500 server error.

3) Delete all cookies for the TB site, hit the back button to bring up the site and log back in again.

4) Shop away again and the checkout works again unless you come out of checkout without completing. Which will lead to the 500 server problem.

I suspect that the cookie data causes the problem with the code throwing up the 500 server error. Perhaps the code needs to recognize that the cart has been abandoned and reset the cookie?

This only happens on one page checkout.

And sorry to be the bearer of more bad news, on one page checkout,the payment method does not link on clicking after you have checked the box agreeing to the terms and conditions, the only way I have found it clickable in terms of proceeding is to uncheck the terms and conditions box and recheck it and mystically the payment method (in my case Paylike) decides to become active and work! Suspect something up with ajax?

My advice for now, stick to the 5 page checkout process.

  • 0
Posted

The plot thickens on the above. Cannot create new user (in case it was a particular user issue) without getting 500 server error although user does get created when getting back in after the error. And still cant check out with 500 server error. The new error log again highlights the same problem as above.

  • 0
Posted

Maybe someone will come along who has an immediate solution for your current issues but in the meantime I can make some general suggestions that might help, depending on what you have already tried:

  • In the back office under `Advanced Parameters -> Performance` make sure that template recompilation is set to "Force compilation" and that all types of caching are disabled.
     
  • If your webserver is running any sort of caching you may want to disable that during development and testing as well. It's great to use on a live site but as with all other caching it can cause weird problems during development.
     
  • Disable any & all CDN caching you may have set up. It can cause weird & unexpected problems during development.
     
  • Reset all file permissions in your public_html directory & subdirectories to 755 for folders and 644 for files. Make sure the file & folder ownership is set correctly as well. Some web hosts have a button you can press to do this automatically. Some you must do this yourself from the command line.
     
  • Make sure that mod_security is disabled for this domain. It's not completely incompatible with TB if it is set up exactly right but the standard general rules tend to wreak havoc. During development it should always be disabled.
     
  • Clear your local browser cache & cookies and/or use an incognito mode tab to work on & test your site. Local cache can also have weird and unexpected impacts when making changes to the site itself.
     
  • Run the Core Updater and make sure you have all the latest updates for 1.1.x Bleeding Edge. Make sure you do not accidentally downgrade to 1.0.x which is the default action if you have not run Core Updater before. Downgrading will wreak massive havoc on your site...
     
  • Consider disabling non-Thirty Bees modules (`Advanced Parameters -> Performance`) and see if the problem goes away.
     
  • Go to `Preferences  -> SEO & URLs` and regenerate the .htaccess file. If you have made any additions to this file try commenting them out.
     
  • Are you running Apache? Make sure the conf.d for your domain is set up properly. In particular I have found that setting `Require all granted` for the public_html directory is necessary on my server.
     
  • Are you running Nginx by itself without Apache at all? That requires some special setup to make work with TB.

That's what comes to mind that I would try right away. I hope something there works for you, too.

 

 

  • Thanks 1
  • 0
Posted

Thank you, thank you. Thank you for that. I will work through that list and let you know which one works!

My I share a little php file I have to set all file and directory permissions? Edit the file to the permissions you want, currently set 644 file, 755 for folder. I upload to root run it from the browser and then delete, obviously a dangerous tool if left in root!

fix.php

  • Thanks 1
  • 0
Posted

Turn overrides and external modules off and try again. If it works, you can go deeper into the issue. 

To have this error message on customer creation is really strange...

You should also give information where Link class is used. This info should be in stack track.

  • 0
Posted
2 minutes ago, James1 said:

My I share a little php file I have to set all file and directory permissions? Edit the file to the permissions you want, currently set 644 file, 755 for folder. I upload to root run it from the browser and then delete, obviously a dangerous tool if left in root!

It's also important to make sure the file ownership is correctly set. Often the webserver is running on a different process to who you log into SSH/SFTP as and that results in the file ownerships being set differently to the webserver process.

  • 0
Posted

I doubt there needs to be made any chmod changes... The issue seems to be in the usage of Link Class. It's used to generate a product link probably but there is no valid product object.... 

Btw have you deleted any products or so? :S

  • 0
Posted
Just now, wakabayashi said:

I doubt there needs to be made any chmod changes... The issue seems to be in the usage of Link Class. It's used to generate a product link probably but there is no valid product object....

You're very likely right as you know a lot more about TB's internals than I do. I just have a long list of things I go through and try before asking for help in the hopes of fixing anything easy.

  • Like 1
  • 0
Posted

It is a brand new install today with the test data. I haven't touched the product data, neither deleted it or added to it. All files are 644, directories 755. I had it working then fiddled! I wonder if being logged in twice in two different browsers at the same time caused an issue? Even after I undone everything I thought I had done the error still persisted. Some of the things mentioned are above my pay grade but I'll see if I can get an increase in pay, I'm just a sales and marketing guy!

Just noticed this when fiddling with Preferences/Orders , 5 step check out causes no problems, only when set to single page check out does the server 500 error appear.

  • 0
Posted

Usually when I kill something so early on I just nuke it all and reinstall.

I've also learned to make backups regularly. I actually have a small bit of VB.NET code that I wrote that does backups remotely over SSH/SFTP. It puts the shop into maintenance mode (if it's not there already) and then zips the entire directory tree. Then it dumps the database into an SQL file and zips that too. Then it transfers the whole lot back to my local machine and puts it into a folder named with the site name & a timestamp. Once everything is done it enables the shop again if it had to disable it at the start. Then when I inevitably screw something up I have a way to recover quickly. This has saved me so much time and frustration.

  • 0
Posted

That sounds a very handy way of doing things. This is my second new install in two days, 100% everything replaced with new. Only I get the 500 server issue back as well when I fiddle with TBs.  I don't won't to load real data and go live and then find I need to do a complete new install, so much work will be wasted, your method sounds good advice. Determined not to give up on TB, I really like a lot of it especially the built for speed, still not fully understanding all this is cache stuff and wonder if the TB software and server conflict as both are doing the same job?

I'm an empiricist, what works works even if I don't understand why at all! So I fiddle away until I like the result.

  • 0
Posted

Solution for now is the five page check out process, no errors and works. Changing themes and regenerating does not get rid of the error. Error  happens when single page checkout is selected but at one point this worked okay.

  • 0
Posted
2 hours ago, James1 said:

My advice for now, stick to the 5 page checkout process.

I highly recommend trying out @datakick's Chex one page checkout module. There's a thread with many pages of discussion and improvements here. There's a free trial so you can test it without having to buy it first but IMO it is very much worth the price. It's the best checkout experience for TB or PS and I don't think I have seen a better checkout for any other platform, either.

 

  • 0
Posted

Hiya. Yes I downloaded Chex One Page Checkout module (trial before I buy) this morning and have installed it but no more time for that right now, got to fix a girlfriend's leaking toilet cistern this PM! I will have a play with the module over the weekend. I'm using the Paylike module for payment but will test a few others to see if it is the payment module that is causing the problem, it is either a cart, a payment or checkout code problem somewhere.

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
×
×
  • Create New...