Post by djohno24 » Sat Jan 20, 2018 7:48 am

Hi Guys

Firstly sorry if not in the correct place for posting!

I am running 2.2.0.0 and until yesterday everything was working as it should.

My domain is www.stitchink.co.uk/store

I am trying to get all the site structure together before i upload all of my products, I decided to make changes to enable SEO URL's and followed the instructions to the letter. When this was working I added SEO URL's to all my categories and products and everything was looking good.

I then added code from google analytics and this was working ok tracking users online.

I then tried a test checkout to find that i could no longer do this and got an error message "Error Undefined" which i soon realised were something to do with my SSL. I contacted my service provider and they said all was good there end.

I have tried to re trace my steps and disabled SEO URL's. I can paste in the https:// on a product page and it will checkout however when i leave the page it then goes back to unsecured.

My code in the .htaccess is as follows

Options +FollowSymlinks

# Prevent Directoy listing
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
Order deny,allow
Deny from all
</FilesMatch>

# SEO URL Settings
RewriteEngine On

# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/

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]

My code in /config.php

<?php
// HTTPS
define('HTTP_SERVER', 'https://www.stitchink.co.uk/store/');

// HTTPS
define('HTTPS_SERVER', 'https://www.stitchink.co.uk/store/');

// DIR
define('DIR_APPLICATION', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/catalog/');
define('DIR_SYSTEM', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/system/');
define('DIR_IMAGE', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/image/');
define('DIR_LANGUAGE', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/catalog/language/');
define('DIR_TEMPLATE', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/catalog/view/theme/');
define('DIR_CONFIG', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/system/config/');
define('DIR_CACHE', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/system/storage/cache/');
define('DIR_DOWNLOAD', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/system/storage/download/');
define('DIR_LOGS', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/system/storage/logs/');
define('DIR_MODIFICATION', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/system/storage/modification/');
define('DIR_UPLOAD', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/system/storage/upload/');

// DB
define('DB_DRIVER', 'mysqli');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'stitchink_co_uk_');
define('DB_PASSWORD', 'xxxxxxxxxx');
define('DB_DATABASE', 'stitchink_co_uk_');
define('DB_PORT', '3306');
define('DB_PREFIX', 'oc_');

My code in /admin/config.php

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

// HTTPS
define('HTTPS_SERVER', 'https://www.stitchink.co.uk/store/admin/');
define('HTTPS_CATALOG', 'https://www.stitchink.co.uk/store/');

// DIR
define('DIR_APPLICATION', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/admin/');
define('DIR_SYSTEM', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/system/');
define('DIR_IMAGE', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/image/');
define('DIR_LANGUAGE', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/admin/language/');
define('DIR_TEMPLATE', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/admin/view/template/');
define('DIR_CONFIG', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/system/config/');
define('DIR_CACHE', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/system/storage/cache/');
define('DIR_DOWNLOAD', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/system/storage/download/');
define('DIR_LOGS', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/system/storage/logs/');
define('DIR_MODIFICATION', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/system/storage/modification/');
define('DIR_UPLOAD', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/system/storage/upload/');
define('DIR_CATALOG', '/customers/d/5/f/stitchink.co.uk/httpd.www/store/catalog/');

// DB
define('DB_DRIVER', 'mysqli');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'stitchink_co_uk_');
define('DB_PASSWORD', 'xxxxxxxxxx');
define('DB_DATABASE', 'stitchink_co_uk_');
define('DB_PORT', '3306');
define('DB_PREFIX', 'oc_');

I assume its something very simple that i just cant see,

Thanks in advance
Last edited by djohno24 on Wed Jan 24, 2018 8:57 am, edited 1 time in total.

Newbie

Posts

Joined
Thu Jul 01, 2010 11:20 am

Post by MrPhil » Sun Jan 21, 2018 12:58 am

Change your passwords right away!

I can't understand from your post what's going on. You say your store was working OK -- then what things did you change and what things did your host change, and now exactly what happens? What error messages and other events?

User avatar
Active Member

Posts

Joined
Wed May 10, 2017 11:52 pm

Post by djohno24 » Sun Jan 21, 2018 3:57 am

Hi,

When a visitor visits the site its not secure and as such they get an error message error undefined when the try add to cart.
Everything was ok before I changed code to use SEO URL'S.
So for example if visited www.stitchink.co.uk/store the page is not secure but then if you type https:// in front that page will then become secure. If you then click on another page like a product page it again reverts back to non secure but again if i type https:// in front of the url it becomes secure.
I am wanting to try get it so the the pages automatically become secure.

Everything was ok until i changed the site to use SEO URL'S (Now disabled) in the admin area of the cart.
Another thing i did was add the Google Analytics code but i cant see that effecting it

Thanks

Newbie

Posts

Joined
Thu Jul 01, 2010 11:20 am

Post by MrPhil » Mon Jan 22, 2018 2:20 am

It sounds like you have two separate issues here, which should be two separate threads: 1) https failure and 2) some "undefined" error.

Regarding the https business, you don't have HTTPS usage properly defined in your configure.php files. You need to make everything http: as https: instead (nothing http:, change them to https: ). This way, links to other pages will now be https (secure) instead of http. I'm assuming that you want all pages under SSL, and not just sensitive information, and you have https enabled. You also need in your .htaccess (assuming an Apache server, or the equivalent for other servers) a 301 redirect for any incoming http: request to use https: instead. Coordinate this with your forcing of www in the domain name, so that at most only one 301 redirect is issued, even if a request comes in for http and non-www.

Once this is cleared up, we can begin to address the issue of this error message you're seeing. I would fix the other stuff first, just in case as a byproduct it clears up this error, too. Sometimes that happens.

User avatar
Active Member

Posts

Joined
Wed May 10, 2017 11:52 pm

Post by straightlight » Mon Jan 22, 2018 5:52 am

If this issue is about a downloaded extension for those SEO modifications over the .htaccess file, contact the extension developer for more information. Otherwise, if these modifications are being used for the SEO links provided from the core, I would not suggest to use them but rather download an SEO extension from the marketplace. There are countless ones that can be used as I would suggest to revert the changes from the .htaccess file to its previous state before officially install any extensions.

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
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by djohno24 » Wed Jan 24, 2018 9:19 am

Hi,

I didn't use a SEO extension all I did was follow the instructions to enable SEO URL'S.

Before I enabled SEO URL'S every page was secure and running fine. It seems that it is not forcing the https:// so when a product page is visited it will not be secure, However if you then type the https://before the url the page becomes secure.

Because the product pages are not secure, this is causing the issue of the error when i try to add something to the cart. If i add the https:// in front of the url and make the page secure i can then add to cart and the error will not appear thus letting me checkout.

Hope this explains it better

Thanks

Newbie

Posts

Joined
Thu Jul 01, 2010 11:20 am

Post by straightlight » Wed Jan 24, 2018 10:24 pm

If you're using the SEO from the core, it would rather be suggested to use one from the marketplace. There are countless ones already published and that provide great success.

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
Programmer / Opencart Tester


Legendary Member

Posts

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

Post by MrPhil » Wed Jan 24, 2018 10:48 pm

djohno24 wrote:
Wed Jan 24, 2018 9:19 am
Before I enabled SEO URL'S every page was secure and running fine. It seems that it is not forcing the https:// so when a product page is visited it will not be secure, However if you then type the https://before the url the page becomes secure.
It sounds like something in SEO URLs is forcing a hard-coded http:, rather than allowing https:. If it was working with https: on all pages before, that should mean that your configure files are set up correctly with no http:, just https:. You've gone back and checked that you didn't accidentally bring back old configure files with http:? If that's clean, it sounds like you're going to have to scan through all your code looking for hard-coded http:. Use grep (on Linux) or findstr (on Windows) to bulk search all your files, rather than one-by-one. Does SEO URLs store any URLs in the database? If so, you might need to check there too for hard-coded http: entries.

User avatar
Active Member

Posts

Joined
Wed May 10, 2017 11:52 pm

Post by ADD Creative » Wed Jan 24, 2018 11:06 pm

Follow the instruction here. viewtopic.php?t=162984

For OpenCart 2.2.0.0 you need the changes to the system/config/ catalog.php and admin.php files.

www.add-creative.co.uk


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by ADD Creative » Wed Jan 24, 2018 11:19 pm

For site wide SSL you may need the changes in this post. http://forum.opencart.com/viewtopic.php ... 58#p620058

www.add-creative.co.uk


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by djohno24 » Mon Jan 29, 2018 10:33 am

Ok Guys,

So tried ever thing (twice) and could not solve the problem and was close to giving up but then i found a fix in the market place ( Enable SSL on all pages)
I installed this and everything is good except when i now enable seo url's it doesn't show any images on the webpages. Think i'll just leave it whilst things are good and just keep it disables :)

Newbie

Posts

Joined
Thu Jul 01, 2010 11:20 am

Post by chobits332 » Wed Oct 28, 2020 7:44 am

So, I had the https padlock not working on pages with the seo urls, and the error undefined when adding an item to cart, and items in cart not staying in cart issues.

All these were fixed for me when I changed the order of where the code was inputted in the .htaccess file. At first I put this code at the bottom of the file, that was incorrect, then I put it under #SEO URL Settings under the last rule, that was also incorrect. Only after I moved the code to the top, like shown bellow, did all those issues stop. I noticed that where you post the code in a file matters while messing with the stylesheet a while ago. I notice that depending on where I put my css code in the stylesheet, certain lines took priority.

This is the code placement for the .htaccess file that got it all to work for me, along with going into the config files and changing http to https like other guides suggest. The code was added right under
" # If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/"
and I did not put in a duplicate RewriteEngine On

Code: Select all

# SEO URL Settings
RewriteEngine On 
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
RewriteCond %{HTTPS} off 

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


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

Newbie

Posts

Joined
Wed Oct 28, 2020 7:33 am
Who is online

Users browsing this forum: No registered users and 10 guests