Page 1 of 1
Solution for "error undefined" message in V2.2.0.0
Posted: Sat Apr 02, 2016 7:29 am
by Randem
The ever so annoying
"error undefined" message is really stating that you are attempting to do a cross-domain operation. All this really means is that you must force OpenCart to use either HTTP or HTTPS but not both. The real message should probably be
"Cross-Origin Request Blocked"
If your browsers URL is HTTP the add to cart operation is HTTPS you will get this message and the reverse is true also.
This is a job for your .htaccess file and setting all your operations in OpenCart to the same protocol. You will need to do some coding changes to accomplish this task.
This will solve your issue. You will need to make some code changes
Fix: Force Admin to SSL - 20160306 - daniGo - v1.0.0
Fix: Force URL's in store to be terminated properly with a trailing slash or any store without trailing slash will default to main store. Force HTTPS protocol to HTTPS if SSL is selected in store settings - v1.0.3
These as well as other fixes can be found
here
Re: Solution for "error undefined" message in V2.2.0.0
Posted: Sat Apr 02, 2016 4:13 pm
by Randem
Sample .htaccess file to redirect to HTTPS
Code: Select all
Options +FollowSymlinks
# Prevent Directoy listing
Options -Indexes
# Prevent Direct Access to files
<FilesMatch "\.(tpl|ini|log)">
Order deny,allow
Deny from all
</FilesMatch>
# SEO URL Settings
RewriteEngine On
#RewriteCond %{HTTPS} on
#RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#SSL Port
RewriteCond %{SERVER_PORT} !=443
# Remove www. from any domain query
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1%{REQUEST_URI} [R=301,L]
# All broswer request get redirected to HTTPS
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Re: Solution for "error undefined" message in V2.2.0.0
Posted: Sun Apr 03, 2016 4:29 am
by Randem
This also means you can't use a combination of different domain entries such as
https://www.yourdomain.com
https://yourdomain.com
http://www.yourdomain.com
http://yourdomain.com
A mix of these names will cause the error also. Every reference to your OpenCart site must be exactly the same. The names are not interchangeable. You can handle this in your .httaccess file by forcing one or the other but you also need to change the references in your store setting, orders etc... to match.
Re: Solution for "error undefined" message in V2.2.0.0
Posted: Mon Apr 04, 2016 7:09 am
by Randem
BTW: If you have orders from another store URL in the order table because you are transferring the data to a new domain you will need to change the URLs in the orders or you will get this error again if you attempt to edit them (Not a good idea anyway).
Re: Solution for "error undefined" message in V2.2.0.0
Posted: Fri Apr 22, 2016 11:07 am
by makdykstra
Randem ... this is the first thread I've seen on this issue!! THANK YOU!! For a novice Opencart user like myself, could you explain in more detail what I should do?? If you don't mind breaking it down as simply as you could. My cart was working perfectly and now all of the sudden the undefined error message is displaying and customers can't add to their carts.
Thanks so much!! I'm at:
www.mindyourmannersmonsters.org
Re: Solution for "error undefined" message in V2.2.0.0
Posted: Sat Apr 23, 2016 3:24 am
by Randem
Hi makdykstra,
All the fixes that I have for for v2.2.0.0 are here:
Migrating your data from OpenCart Version 2.1.0.x to Version 2.2.0.0 (TEST ONLY)
Don't let the title fool you.
Unfortunately v2.2.0.0 cannot be totally made to go HTTPS without problems and some extensive code changes. v2.2.0.0 is not production ready yet. You are better off with v2.1.0.x in the long run.
More v2.2.0.0 reading
Other Helpful Information
This should help.
Re: Solution for "error undefined" message in V2.2.0.0
Posted: Tue Apr 26, 2016 11:25 pm
by inertia
I am using OC 2.1.0.1 and since I have just started to use SSL (a requirement for Amazon's payment system) I an getting the Error Undefined and also I cannot edit any orders.
Will your suggestions fix both of my problems?
on a side note, I am not a programmer so excuse any stupid questions.
So, If I change my .htaccess file so that all of my pages are HTTPS will solve my 2 issues?
Re: Solution for "error undefined" message in V2.2.0.0
Posted: Wed Apr 27, 2016 2:23 am
by Randem
No... you will need to the instructions and apply the fixes follow. You will need to learn how things work or you will need to get someone to apply them for you.
No Magic bullets...
Re: Solution for "error undefined" message in V2.2.0.0
Posted: Thu Apr 28, 2016 7:01 am
by Kudzai
I keep getting the "error undefined" message when I try to add something to the cart. I am using the default theme on an http server (not https) How can I fix that?
Re: Solution for "error undefined" message in V2.2.0.0
Posted: Fri Jun 24, 2016 12:30 am
by integris
This will solve your issue. You will need to make some code changes
Fix: Force URL's in store to be terminated properly with a trailing slash or any store without trailing slash will default to main store. Force HTTPS protocol to HTTPS if SSL is selected in store settings - v1.0.3
These as well as other fixes can be found here
I wanted my site to be https/www for all pages. Installing the v2.2.changes.zip up above didn't do it. I compiled all the steps into one answer on this stackexchange question:
http://stackoverflow.com/questions/3627 ... 3#37996993
Re: Solution for "error undefined" message in V2.2.0.0
Posted: Tue Jun 28, 2016 4:28 pm
by recseiuq
Hi Randem, could I ask a couple of questions?
1. I am running 2.2.0.0 with your 2.2.0.x fixes and I am getting the "Error Unknown" issue when trying to install the
Acute Category Manager extension. My site is fully SSL as far as I can tell, so it doesn't seem like it's the result of mixing HTTP & HTTPS. I have left a comment on the extension's homepage but have not had any response from the developer so far. Do you know any way to find out more about what's causing the error? I've checked my webserver (NGINX) and PHP5-fpm logs but there's no sign of what's causing this.
2. Do you not recommend people use 2.2.0.0, even with your abovementioned fixes? Is there a discussion of the issues with that version somewhere?
Thanks in advance. And thanks for your excellent work.
Re: Solution for "error undefined" message in V2.2.0.0
Posted: Tue Jun 28, 2016 5:15 pm
by Randem
Hi recseiuq,
Thank you and you are welcome!
1. If you only get this error when you attempt to install the Acute Category Manager package, it would seem that the package is attempting to do something strange or at least in a manner not working with version 2.2.0.0. Since the package is using OCMOD; I cannot help you with that part (not Verses in OCMOD Procedures); If it were VQMOD I could help you track it down better with VQMOD Manager. What is in the OCMOD log?
Have you attempted to install it in a clean OpenCart system with no MODS? Without SSL?
2. I would recommend using OpenCart Version 2.1.0.x for it is more stable with the fixes.
Re: Solution for "error undefined" message in V2.2.0.0
Posted: Tue Jun 28, 2016 7:42 pm
by straightlight
Take note that the errors can also be tracked from the admin - > systems - > tools - > error log page despite whether it comes from VQMod or OCMod.
Re: Solution for "error undefined" message in V2.2.0.0
Posted: Wed Jun 29, 2016 1:38 am
by EvolveWebHosting
A client of mine had this happen.
They had www included in the URLs within the config files so I added a 301 redirect in the .htaccess file to force every page to load with www in the URL and the issue was resolved.