Post by Randem » Sat Apr 02, 2016 7:29 am

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
Last edited by Randem on Mon Apr 04, 2016 7:15 am, edited 2 times in total.

NEVER take serious; anyone who gives negative impact statements with no ABSOLUTE proof!
OpenCart Helpful Information * Upgrade 1.5 to 2.1 * Upgrade 2.1 to 2.2
"Why do people NEVER have enough time to do it right but ALWAYS enough time to do it over?"
DO NOT EVER GIVE SOMEONE YOU DON"T KNOW ADMIN ACCESS TO ANYTHING!
I am NOT affiliated with OpenCart


User avatar
Active Member

Posts

Joined
Sat Sep 27, 2014 9:17 am

Post by Randem » Sat Apr 02, 2016 4:13 pm

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]


NEVER take serious; anyone who gives negative impact statements with no ABSOLUTE proof!
OpenCart Helpful Information * Upgrade 1.5 to 2.1 * Upgrade 2.1 to 2.2
"Why do people NEVER have enough time to do it right but ALWAYS enough time to do it over?"
DO NOT EVER GIVE SOMEONE YOU DON"T KNOW ADMIN ACCESS TO ANYTHING!
I am NOT affiliated with OpenCart


User avatar
Active Member

Posts

Joined
Sat Sep 27, 2014 9:17 am

Post by Randem » Sun Apr 03, 2016 4:29 am

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.

NEVER take serious; anyone who gives negative impact statements with no ABSOLUTE proof!
OpenCart Helpful Information * Upgrade 1.5 to 2.1 * Upgrade 2.1 to 2.2
"Why do people NEVER have enough time to do it right but ALWAYS enough time to do it over?"
DO NOT EVER GIVE SOMEONE YOU DON"T KNOW ADMIN ACCESS TO ANYTHING!
I am NOT affiliated with OpenCart


User avatar
Active Member

Posts

Joined
Sat Sep 27, 2014 9:17 am

Post by Randem » Mon Apr 04, 2016 7:09 am

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).

NEVER take serious; anyone who gives negative impact statements with no ABSOLUTE proof!
OpenCart Helpful Information * Upgrade 1.5 to 2.1 * Upgrade 2.1 to 2.2
"Why do people NEVER have enough time to do it right but ALWAYS enough time to do it over?"
DO NOT EVER GIVE SOMEONE YOU DON"T KNOW ADMIN ACCESS TO ANYTHING!
I am NOT affiliated with OpenCart


User avatar
Active Member

Posts

Joined
Sat Sep 27, 2014 9:17 am

Post by makdykstra » Fri Apr 22, 2016 11:07 am

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

Newbie

Posts

Joined
Fri Apr 22, 2016 8:34 am

Post by Randem » Sat Apr 23, 2016 3:24 am

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.

NEVER take serious; anyone who gives negative impact statements with no ABSOLUTE proof!
OpenCart Helpful Information * Upgrade 1.5 to 2.1 * Upgrade 2.1 to 2.2
"Why do people NEVER have enough time to do it right but ALWAYS enough time to do it over?"
DO NOT EVER GIVE SOMEONE YOU DON"T KNOW ADMIN ACCESS TO ANYTHING!
I am NOT affiliated with OpenCart


User avatar
Active Member

Posts

Joined
Sat Sep 27, 2014 9:17 am

Post by inertia » Tue Apr 26, 2016 11:25 pm

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?

New member

Posts

Joined
Tue Dec 08, 2015 9:24 pm

Post by Randem » Wed Apr 27, 2016 2:23 am

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...

NEVER take serious; anyone who gives negative impact statements with no ABSOLUTE proof!
OpenCart Helpful Information * Upgrade 1.5 to 2.1 * Upgrade 2.1 to 2.2
"Why do people NEVER have enough time to do it right but ALWAYS enough time to do it over?"
DO NOT EVER GIVE SOMEONE YOU DON"T KNOW ADMIN ACCESS TO ANYTHING!
I am NOT affiliated with OpenCart


User avatar
Active Member

Posts

Joined
Sat Sep 27, 2014 9:17 am

Post by Kudzai » Thu Apr 28, 2016 7:01 am

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?

Newbie

Posts

Joined
Thu Apr 28, 2016 6:06 am

Post by integris » Fri Jun 24, 2016 12:30 am

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

Newbie

Posts

Joined
Wed May 18, 2016 4:14 am

Post by recseiuq » Tue Jun 28, 2016 4:28 pm

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.

Newbie

Posts

Joined
Sat Jun 11, 2016 6:53 am

Post by Randem » Tue Jun 28, 2016 5:15 pm

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.

NEVER take serious; anyone who gives negative impact statements with no ABSOLUTE proof!
OpenCart Helpful Information * Upgrade 1.5 to 2.1 * Upgrade 2.1 to 2.2
"Why do people NEVER have enough time to do it right but ALWAYS enough time to do it over?"
DO NOT EVER GIVE SOMEONE YOU DON"T KNOW ADMIN ACCESS TO ANYTHING!
I am NOT affiliated with OpenCart


User avatar
Active Member

Posts

Joined
Sat Sep 27, 2014 9:17 am

Post by straightlight » Tue Jun 28, 2016 7:42 pm

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.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by EvolveWebHosting » Wed Jun 29, 2016 1:38 am

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.

Image
https://www.evolvewebhost.com
$10.49 .com Registration and $9.99 .com Transfers in now
Guaranteed top level opencart performance and support. Risk free 30 day money back guarantee & free transfers.
Image


User avatar
Active Member

Posts

Joined
Fri Mar 27, 2015 11:13 pm
Location - Denver, Colorado, USA
Who is online

Users browsing this forum: No registered users and 41 guests