Post by silkcamel » Sun May 01, 2016 11:21 pm

Hi All,

This is Opencart 2.2.0.0, clean version, just installed paypal express checkout module in payment section.
I'm trying to test the payment and add one product to cart, there is a pop up message shows:

This site says
Error
Underfined

Anybody has this issue and know what's the problem? Thank you!

Attachments

opencart 2.2 error.jpg

opencart 2.2 error.jpg (6.48 KiB) Viewed 4934 times


New member

Posts

Joined
Sun May 01, 2016 6:05 am

Post by florinsith » Mon May 02, 2016 5:52 pm

Does that happen on any page or just homepage? Could you post a link?

Image
My Extensions - SuperTheme - Opencart templates - Opencart modules


User avatar
Expert Member

Posts

Joined
Fri May 14, 2010 2:36 am


Post by silkcamel » Mon May 02, 2016 10:28 pm

florinsith,

link has been sent to you, please check your private message. Thanks.

Bill

New member

Posts

Joined
Sun May 01, 2016 6:05 am

Post by Qphoria » Mon May 02, 2016 10:33 pm

When you first visit your site, if you don't visit it as the url in your config.php file for HTTP_SERVER, ajax callbacks won't work because of same origin policy. The best way to handle this is to force www or non-www in your htaccess file to match what your config.php file has. If you use www in your config, force it in the htaccess, and vice versa.

According to stack overflow, this is the preferred way:

Code: Select all

RewriteEngine On
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Source:

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by silkcamel » Mon May 02, 2016 11:08 pm

Hi Qphoria,

It's very clear for step1-6, I'll do that.

May I confirm the last step? just want to make sure I will do the right way.

1. find the .htaccess.txt in the public_html folder;
2. edit it by adding the coding your provided to line 31?
3. save it and rename the .htaccess.txt to .htaccess

see attached photos. Am I right?

Attachments

1.jpg

1.jpg (79.11 KiB) Viewed 4916 times

2.jpg

2.jpg (85.57 KiB) Viewed 4916 times

3jpg.jpg

3jpg.jpg (40.77 KiB) Viewed 4916 times


New member

Posts

Joined
Sun May 01, 2016 6:05 am

Post by Qphoria » Tue May 03, 2016 12:38 pm

yes correct.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by silkcamel » Tue May 03, 2016 10:44 pm

Hi Qphoria,

I've completed those steps and it work, non-www redirected to www site. May I ask one more favor? how to have it redirected to https instead of http so that I can have padlock icon for every pages? right now every page is http not https.

(1) system/config/catalog.php had been edited per your instruction.
Do I need to edit the system/config/admin.php as well?
attached is the admin.php (just look like to same as catalog.php before editing.

Attachments

5-3-16--0.jpg

5-3-16--0.jpg (9.84 KiB) Viewed 4877 times


New member

Posts

Joined
Sun May 01, 2016 6:05 am

Post by silkcamel » Tue May 03, 2016 10:50 pm

and attached are the

(1) modified .htacess file
(2) public_html/config.php
(3) public_html/admin/config.php

what coding should I add to have SSL padlock show to every pages, or at least homepage, checkout, payment pages?
PS: I've installed SSL certificate in the server.

Thank you very much

Attachments

5-3-16.jpg

5-3-16.jpg (59.85 KiB) Viewed 4877 times

5-3-16-2.jpg

5-3-16-2.jpg (12.39 KiB) Viewed 4877 times

5-3-16-3.jpg

5-3-16-3.jpg (21.56 KiB) Viewed 4877 times


New member

Posts

Joined
Sun May 01, 2016 6:05 am

Post by Qphoria » Wed May 04, 2016 12:18 am

just set the http:// to https:// in the HTTP_SERVER value in the config.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by silkcamel » Wed May 04, 2016 2:42 am

Thanks Qphoria, you are the HERO.

This is just for other people who has the same issues. see markup as attached.

I edited the config.php in both root and admin folder. and it works, now, every pages goes to https:// and have padlock icon beside it.

Attachments

5-3-16-5.jpg

5-3-16-5.jpg (48.92 KiB) Viewed 4867 times


New member

Posts

Joined
Sun May 01, 2016 6:05 am

Post by civolis » Thu May 05, 2016 2:03 am

Hi guys. I did all this tricks in my store but, in the checkout page I have a lot of 404 (file not found) in the js, css and images files. What could be happening?

In the store admin is defined to SSL true.

Bellow my htaccess in root and in folder store:
/.htaccess

Code: Select all

# Acesso http redirecionado para https
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www.(.*) [NC]
RewriteRule (.*) https://mydomain.com.br%{REQUEST_URI} [L,QSA]

RewriteCond %{HTTP_HOST} ^mydomain.com.br$ [NC,OR]
RewriteCond %{REQUEST_URI} !store/
RewriteCond %{REQUEST_URI} !loja/
RewriteRule (.*) /store/$1 [L]
/store/.htaccess

Code: Select all

RewriteBase /store/
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/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]

RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^(.*)$ index.php [F,L]
Last edited by straightlight on Wed Aug 10, 2016 10:14 am, edited 1 time in total.
Reason: Added code tags.

Newbie

Posts

Joined
Thu May 05, 2016 12:27 am

Post by cc-cr » Sat Jul 16, 2016 6:06 am

Hi

I have the same issue in opencast 2.2.0.0 , a user reported the "undefined error" when adding an item to the shopping cart. Prior to this my test had not shown this error.

reading the solution I have experimented further

the domain is used without www and then it works fine

if I use http://www.domain_name the error occurs.

When I add the lines as described above (very well described I like to add) this creates many problems the home page is completely garbled up.

there was initially no .htaccess file in my public_html folder


this is the beginning of config.php in the root

<?php

Code: Select all

// HTTP
define('HTTP_SERVER', 'http://funwithfido.co.uk/');

// HTTPS
define('HTTPS_SERVER', 'http://funwithfido.co.uk/');

// DIR
and this in the beginning of admin folder config.php file

Code: Select all

<?php
// HTTP
define('HTTP_SERVER', 'http://funwithfido.co.uk/admin/');
define('HTTP_CATALOG', 'http://funwithfido.co.uk/');

// HTTPS
define('HTTPS_SERVER', 'http://funwithfido.co.uk/admin/');
define('HTTPS_CATALOG', 'http://funwithfido.co.uk/');
advice on how to proceed is most welcome

Daniel
Last edited by straightlight on Wed Aug 10, 2016 10:15 am, edited 1 time in total.
Reason: Added code tags.

Newbie

Posts

Joined
Sat Jul 16, 2016 5:52 am

Post by Daniel » Fri Jul 29, 2016 12:24 pm

or another solution is replace the url class with the one from the master branch.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by nzbsa » Fri Jul 29, 2016 7:51 pm

As I have entire store in https://domain (no www) this redirect works perfect,
http and www is redirected straight to https://domain

You could customize to your needs

Code: Select all

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Newbie

Posts

Joined
Fri Jul 29, 2016 7:20 pm

Post by IP_CAM » Tue Aug 02, 2016 11:15 am

and just to mention it, this .htaccess routing only functions, without producing 'too many rerouting' messages on Test Sites, if NO Image/Script Subdomain Routing has been defined, linked to the Shop Site.
Example:
---
http:// www. shopsite/shop_index.php (default Site Access)
---
Now, if an image/Script Subdomain Link would look like:
---
http:// shopsite/image/...
http:// scripts. shopsite/...
http:// images. shopsite/image/...
http:// scripts. shopsite/scripts/...
---
e.t.c., the images and Scripts would all be redirected as well by the .htaccess order, and called from:
---
http:// www. shopsite/...
http:// www. shopsite/image/...
http:// www. shopsite/scripts/...
---
e.t.c., because the .htaccess is ordered to do this, and therefore not longer be Cookie-free as well !
A Double Shot in the knee, kind of... :D

At least, if a SHOP is placed in the Site ROOT Section, and, therefore, only ONE .htaccess File exists,
for the Site and the Shop. But if a Shop is placed in a Subdirectory, above mentioned Findings
have NO effect, if the Site /ROOT/ .htaccess - WWW or no WWW - Site Rerouting is defined in the ROOT
Directory, and the ../Shop/ .htaccess File does NOT contain such specific rerouting Informations.

According to what I just found out, after placing my first test Shop in the Site ROOT Section. ;)

Ernie

This .htaccess File is, what I usually have in my HTML ROOT Section, to redirect everything
to WWW: where I have my master index.html HTML Page, serving as IFRAME-Masterpage,
to have the Responsive Demo Framepages working. It can be set either way, by QUOTING, what is not used.

Code: Select all

# Rabbit Rabbit Security Upgrade
Options +SymLinksIfOwnerMatch

# Prevent Directory listing 
Options -Indexes

# SEO URL Settings
RewriteEngine On
RewriteBase /

#Force (http host) www to non www (optional)
#RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
#RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

#Force (https host) www to non www (optional)
#RewriteCond %{HTTPS} on
#RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
#RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

#Force (http host) non www to www (optional)
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

#Force (https host) non www to www (optional)
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

#@__HCP_END__@#

I am no longer active around here, to reach me, contact: jti@jacob.ch
My latest Freeware Opencart LIGHT Testsite, available on demand: http://www.ebikes.li/shop/
My 888 FREE OC Extension-Repositories - from OC v.1.5.x up,
on the largest OC Extension Github Site: https://github.com/IP-CAM
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by RachSobie » Sat Aug 20, 2016 4:27 pm

IP_CAM wrote:and just to mention it, this .htaccess routing only functions, without producing 'too many rerouting' messages on Test Sites, if NO Image/Script Subdomain Routing has been defined, linked to the Shop Site.
Example:
---
http:// www. shopsite/shop_index.php (default Site Access)
---
Now, if an image/Script Subdomain Link would look like:
---
http:// shopsite/image/...
http:// scripts. shopsite/...
http:// images. shopsite/image/...
http:// scripts. shopsite/scripts/...
---
e.t.c., the images and Scripts would all be redirected as well by the .htaccess order, and called from:
---
http:// www. shopsite/...
http:// www. shopsite/image/...
http:// www. shopsite/scripts/...
---
e.t.c., because the .htaccess is ordered to do this, and therefore not longer be Cookie-free as well !
A Double Shot in the knee, kind of... :D

At least, if a SHOP is placed in the Site ROOT Section, and, therefore, only ONE .htaccess File exists,
for the Site and the Shop. But if a Shop is placed in a Subdirectory, above mentioned Findings
have NO effect, if the Site /ROOT/ .htaccess - WWW or no WWW - Site Rerouting is defined in the ROOT
Directory, and the ../Shop/ .htaccess File does NOT contain such specific rerouting Informations.

According to what I just found out, after placing my first test Shop in the Site ROOT Section. ;)

Ernie

This .htaccess File is, what I usually have in my HTML ROOT Section, to redirect everything
to WWW: where I have my master index.html HTML Page, serving as IFRAME-Masterpage,
to have the Responsive Demo Framepages working. It can be set either way, by QUOTING, what is not used.

Code: Select all

# Rabbit Rabbit Security Upgrade
Options +SymLinksIfOwnerMatch

# Prevent Directory listing 
Options -Indexes

# SEO URL Settings
RewriteEngine On
RewriteBase /

#Force (http host) www to non www (optional)
#RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
#RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

#Force (https host) www to non www (optional)
#RewriteCond %{HTTPS} on
#RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
#RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

#Force (http host) non www to www (optional)
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

#Force (https host) non www to www (optional)
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

#@__HCP_END__@#
my site is non-www and HTTPS is not working. I have tried all of the steps above (changing config/ admin config, setting to true etc) and continually get the too many reroutes 500 error.
My site is in the route folder.
do I need to include the # from the above codes in the files?

Just to add I have added this code

Code: Select all

#Force (https host) www to non www (optional)
#RewriteCond %{HTTPS} on
#RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
#RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
changed the config/ admin config from HTTP to HTTPS and when I add to cart I get the error undefined message.
only the home page and checkout remain in HTTPS the otherpages all still revert to HTTP. Oh it remains as www. too so not redirecting to non-www

Active Member

Posts

Joined
Fri Jun 24, 2016 4:12 pm

Post by IP_CAM » Sun Aug 21, 2016 12:48 am

# means, that this Line has just an informative Value, it's DISABLED from doing anything!
One can SWITCH OFF such lines, i.E., in order to leave a Routine in both ways, but only
use one of them, matching individual requirements. Like in this specific Sections,
where one has to either change to www. or no www.
Ernie

I am no longer active around here, to reach me, contact: jti@jacob.ch
My latest Freeware Opencart LIGHT Testsite, available on demand: http://www.ebikes.li/shop/
My 888 FREE OC Extension-Repositories - from OC v.1.5.x up,
on the largest OC Extension Github Site: https://github.com/IP-CAM
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by RachSobie » Sun Aug 21, 2016 5:25 pm

IP_CAM wrote:# means, that this Line has just an informative Value, it's DISABLED from doing anything!
One can SWITCH OFF such lines, i.E., in order to leave a Routine in both ways, but only
use one of them, matching individual requirements. Like in this specific Sections,
where one has to either change to www. or no www.
Ernie
Thanks Ernie ;D

Active Member

Posts

Joined
Fri Jun 24, 2016 4:12 pm
Who is online

Users browsing this forum: No registered users and 4 guests