Jump to content

Why do my menu links randomly change?


choduk

Recommended Posts

Hello all.

I hope you can help me. I'm having a bit of a strange issue with my Cubecart website. It randomly rewrites my product menu links. All of the other links on my site seem fine.

My site is at: https://www.snapframecity.com

For instance, the first link in the product menu, which should be: https://www.snapframecity.com/snap-frames.html
Occasionally, this will change itself to: https://mail.snapframecity.com/snap-frames.html, or https://hostmaster.snapframecity.com/snap-frames.html or https://ww.snapframecity.com/snap-frames.html

It means that my site keeps generating warnings about the certificate not being safe and I'm worrying that this will affect my google results.

Does anyone have any experience of this or are you able to suggest anywhere to start looking? I've tried my hosting provider and they're adamant that it's on the Cubecart side of things.

Link to comment
Share on other sites

Please let us know the exact version of CubeCart you are running. Some versions back, absolute URLs were constructed for the nav menu.

Given that CubeCart can use whatever domain name used to call for it, the menu structure could (until the cached structure is cleared) contain the domain name, even if it is incorrect.

This means that your domain's DNS records could show that some subdomains point to the same location as www - the CubeCart store. Or, that unknown subdomains (i.e., hostmaster) do not return a "Host not found" error, but rather defaults to an actively resolved domain -- which is a problem with your web server configuration.

Link to comment
Share on other sites

Hi. Thanks for replying.

It's version 6.0.10. I'm aware that there are newer versions available, but I've tweaked a few files here and there to change a few things, so I don't want to just blindly update it until I can setup a test server and put aside some time.

Web design isn't my primary job - I'm a graphic designer who's been tasked with putting this store together, so I'm learning as I go.

If you can point me in the right direction as to what settings I need to change, that would be much appreciated.

Many thanks for your help.

Link to comment
Share on other sites

I think the key thing to fix is to have your hosting provider assist you with having sub-domains (mail, hostmaster, etc) resolve to alternate services - not to your site.

Also, your domain name registrar should also assist you in making sure non-existent sub-domains (ww) return a "Server Not Found" error.

Link to comment
Share on other sites

Please make the following edits:

In /classes/seo.class.php, find:

	public function buildURL($type, $item_id = false, $amp = '&') {
		// Some SEO paths are not stored in the database
		if (!$item_id && in_array($type, $this->_static_sections)) {
			if (($item = $GLOBALS['db']->select('CubeCart_seo_urls', array('path'), array('type' => $type))) !== false) {
				return $GLOBALS['storeURL'].'/'.$item[0]['path'].$this->_extension;
			} else {
				return  $GLOBALS['storeURL'].'/'.$this->setdbPath($type, '', '', false).$this->_extension;
			}
		} elseif (($item = $GLOBALS['db']->select('CubeCart_seo_urls', array('path'), array('type' => $type, 'item_id' => $item_id))) !== false) {
			return $GLOBALS['storeURL'].'/'.$item[0]['path'].$this->_extension;
		} else {
			return  $GLOBALS['storeURL'].'/'.$this->setdbPath($type, $item_id, '', false).$this->_extension;
		}
	}


Change to:

	public function buildURL($type, $item_id = false, $amp = '&', $absolute = true) {
		// Some SEO paths are not stored in the database
		$url = ($absolute) ? $GLOBALS['storeURL'].'/' : $GLOBALS['rootRel'];

		if (!$item_id && in_array($type, $this->_static_sections)) {
			if (($item = $GLOBALS['db']->select('CubeCart_seo_urls', array('path'), array('type' => $type))) !== false) {
				return $url.$item[0]['path'].$this->_extension;
			} else {
				return  $url.$this->setdbPath($type, '', '', false).$this->_extension;
			}
		} elseif (($item = $GLOBALS['db']->select('CubeCart_seo_urls', array('path'), array('type' => $type, 'item_id' => $item_id))) !== false) {
			return $url.$item[0]['path'].$this->_extension;
		} else {
			return  $url.$this->setdbPath($type, $item_id, '', false).$this->_extension;
		}
	}

 

In the file /classes/gui.class.php, near the end of the file, find:

private function _makeTree($tree_data) {

A few lines later, find:

$branch['url'] = $GLOBALS['seo']->buildURL('cat', $branch['cat_id'], '&');

Change to:

$branch['url'] = $GLOBALS['seo']->buildURL('cat', $branch['cat_id'], '&', false);


Then find:

private function _displayNavigation() {

A few lines later, find:

				'saleitems' => $GLOBALS['seo']->buildURL('saleitems',false,'&'),
				'certificates' => $GLOBALS['seo']->buildURL('certificates',false,'&')

Change to:

				'saleitems' => $GLOBALS['seo']->buildURL('saleitems',false,'&',false),
				'certificates' => $GLOBALS['seo']->buildURL('certificates',false,'&',false)

You will need to have CubeCart clear its internal cache.

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...