Page 1 of 1

Disable SSL on the product page

Posted: Sun Mar 06, 2016 2:42 am
by Josetxu
Hi,

I need some help.

In my installation I OC2.1 SSL is enabled on the product page, Why can this happen? Should only enable SSL in checkout, and login ...
But not always SSL is activated. Examples:

SSL is not activated when I go to the product page from the serch field, or from latest, special, featured or other module.
SSL is activated when I go to the product page from a category or subcategory.

That can happen?

Regards

Re: Disable SSL on the product page

Posted: Sun Mar 06, 2016 7:23 am
by EvolveWebHosting
Check your config files and make sure you only added the 's' in the HTTPS section of each config file.

Re: Disable SSL on the product page

Posted: Sun Mar 06, 2016 8:21 am
by Josetxu
Hi,
The configuration files are correct. only "S" in https.

Re: Disable SSL on the product page

Posted: Sun Mar 06, 2016 8:28 am
by EvolveWebHosting
Josetxu wrote:Hi,
The configuration files are correct. only "S" in https.
What is in your .htaccess file?

Re: Disable SSL on the product page

Posted: Sun Mar 06, 2016 8:46 am
by Josetxu
This is my .htaccess file, but I tried also with the default.

Code: Select all

# 1.To use URL Alias you need to be running apache with mod_rewrite enabled. 

# 2. In your opencart directory rename htaccess.txt to .htaccess.

# For any support issues please visit: http://www.opencart.com

Options +FollowSymlinks

<IfModule mod_expires.c>
  ExpiresActive on

# Perhaps better to whitelist expires rules? Perhaps.
  ExpiresDefault "access plus 1 month"

# cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
  ExpiresByType text/cache-manifest "access plus 0 seconds"

# Your document html
  ExpiresByType text/html "access plus 0 seconds"

# Data
  ExpiresByType text/xml "access plus 0 seconds"
  ExpiresByType application/xml "access plus 0 seconds"
  ExpiresByType application/json "access plus 0 seconds"

# Feed
  ExpiresByType application/rss+xml "access plus 1 hour"
  ExpiresByType application/atom+xml "access plus 1 hour"

# Favicon (cannot be renamed)
  ExpiresByType image/x-icon "access plus 1 week"

# Media: images, video, audio
  ExpiresByType image/gif "access plus 1 month"
  ExpiresByType image/png "access plus 1 month"
  ExpiresByType image/jpg "access plus 1 month"
  ExpiresByType image/jpeg "access plus 1 month"
  ExpiresByType video/ogg "access plus 1 month"
  ExpiresByType audio/ogg "access plus 1 month"
  ExpiresByType video/mp4 "access plus 1 month"
  ExpiresByType video/webm "access plus 1 month"

# HTC files (css3pie)
  ExpiresByType text/x-component "access plus 1 month"

# Webfonts
  ExpiresByType application/x-font-ttf "access plus 1 month"
  ExpiresByType font/opentype "access plus 1 month"
  ExpiresByType application/x-font-woff "access plus 1 month"
  ExpiresByType image/svg+xml "access plus 1 month"
  ExpiresByType application/vnd.ms-fontobject "access plus 1 month"

# CSS and JavaScript
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"

  <IfModule mod_headers.c>
    Header append Cache-Control "public"
  </IfModule>

</IfModule>

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/javascript
<IfModule mod_setenvif.c>
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>

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

### Additional Settings that may need to be enabled for some servers 
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.

# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off

# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off

# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M

# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M

# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200

# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200

# 7. disable open_basedir limitations
# php_admin_value open_basedir none

Re: Disable SSL on the product page

Posted: Sun Mar 06, 2016 9:15 am
by IP_CAM
You should just be aware, that your Shop could end up, not been accepted/passed as Secure Site, if you have parts of the software functioning on non-ssl-requests.
Just to mention it.
Ernie
openshop.li

Re: Disable SSL on the product page

Posted: Sun Mar 06, 2016 9:54 am
by EvolveWebHosting
Are you running a browser extension that tries to force SSL for every page you view (including sites that are not yours) or is there an SSL related module you're using on your site?

Re: Disable SSL on the product page

Posted: Sun Mar 06, 2016 10:08 am
by Josetxu
SSL is not forcing the browser, if this happens, also the main page would appear SSL.

This is the web: rc-innovations.es

Re: Disable SSL on the product page

Posted: Sun Mar 06, 2016 11:21 am
by EvolveWebHosting
Josetxu wrote:SSL is not forcing the browser, if this happens, also the main page would appear SSL.

This is the web: rc-innovations.es
I was asking if you had a browser extension like this to Force SSL on sites you visit.

https://addons.mozilla.org/en-US/firefo ... verywhere/


Take a look in the controller file for the product.php file. catalog/controller/product/product.php

'href' => $this->url->link('product/product', $url . '&product_id=' . $this->request->get['product_id'])

You will probably find 'SSL' in one of the href lines and it shouldn't be there.

Re: Disable SSL on the product page

Posted: Sun Mar 06, 2016 7:55 pm
by Josetxu
Hi,

I found the source of the problem, in a modification of category.php, I disabled the "~" file and ssl not working.
modification/catalog/controller/product->category.php

I searched several lines of code with the word "SSL". Should I delete all lines SSL or only one?

Code: Select all

$totalpages = ceil($pagination->total/$pagination->limit);
				if (isset($this->request->get['page'])) {
					$this->document->addLink($this->url->link('product/category','path=' . $this->request->get['path'].$url,'SSL'),'canonical');
				}
				if($page == 1 && $page < $totalpages) {
					$this->document->addLink($this->url->link('product/category', 'path=' . $this->request->get['path'].$url."&page=2",'SSL'), 'next');
				}

				if($page > 1 && ($page < $totalpages)) {
					$pagenumbernext = $page + 1;
					$pagenumberprev = $page - 1;
					$this->document->addLink($this->url->link('product/category', 'path=' . $this->request->get['path'].$url."&page=".$pagenumbernext,'SSL'), 'next');
					$this->document->addLink($this->url->link('product/category', 'path=' . $this->request->get['path'].$url."&page=".$pagenumberprev,'SSL'), 'prev');
				}


				if($page > 1 && ($page == $totalpages)) {
					$pagenumber = $page - 1;
					$this->document->addLink($this->url->link('product/category', 'path=' . $this->request->get['path'].$url."&page=".$pagenumber,'SSL'), 'prev');
				}
				
			$pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}');

			$data['pagination'] = $pagination->render();

			$data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit));

			// http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html
			if ($page == 1) {
			    $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'], 'SSL'), 'canonical');
			} elseif ($page == 2) {
			    $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'], 'SSL'), 'prev');
			} else {
			    $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page - 1), 'SSL'), 'prev');
			}

			if ($limit && ceil($product_total / $limit) > $page) {
			    $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1), 'SSL'), 'next');

Code: Select all

if($this->config->get("nerdherd_direct_links")) {
	$link = $this->url->link('product/product','product_id=' . $result['product_id'],'SSL');
} else {
    $link = $this->url->link('product/product','path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url,'SSL');

Code: Select all

				$totalpages = ceil($pagination->total/$pagination->limit);
				if (isset($this->request->get['page'])) {
					$this->document->addLink($this->url->link('product/category','path=' . $this->request->get['path'].$url,'SSL'),'canonical');
				}
				if($page == 1 && $page < $totalpages) {
					$this->document->addLink($this->url->link('product/category', 'path=' . $this->request->get['path'].$url."&page=2",'SSL'), 'next');
				}

				if($page > 1 && ($page < $totalpages)) {
					$pagenumbernext = $page + 1;
					$pagenumberprev = $page - 1;
					$this->document->addLink($this->url->link('product/category', 'path=' . $this->request->get['path'].$url."&page=".$pagenumbernext,'SSL'), 'next');
					$this->document->addLink($this->url->link('product/category', 'path=' . $this->request->get['path'].$url."&page=".$pagenumberprev,'SSL'), 'prev');
				}


				if($page > 1 && ($page == $totalpages)) {
					$pagenumber = $page - 1;
					$this->document->addLink($this->url->link('product/category', 'path=' . $this->request->get['path'].$url."&page=".$pagenumber,'SSL'), 'prev');
				}
				
			$pagination->url = $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&page={page}');

			$data['pagination'] = $pagination->render();

			$data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit));

			// http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html
			if ($page == 1) {
			    $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'], 'SSL'), 'canonical');
			} elseif ($page == 2) {
			    $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'], 'SSL'), 'prev');
			} else {
			    $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page - 1), 'SSL'), 'prev');
			}

			if ($limit && ceil($product_total / $limit) > $page) {
			    $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1), 'SSL'), 'next');

Re: Disable SSL on the product page

Posted: Mon Mar 07, 2016 8:41 am
by Josetxu
Hi,

I solved the problem, I removed "SSL" in these two lines of code:

Code: Select all

if($this->config->get("nerdherd_direct_links")) {
   $link = $this->url->link('product/product','product_id=' . $result['product_id'],'SSL');<<--- DELETE
} else {
    $link = $this->url->link('product/product','path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url,'SSL'); <<----DELETE