Jump to content
Sign in to follow this  
choduk

Why do my menu links randomly change?

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.

Edited by choduk

Share this post


Link to post
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.

  • Like 1

Share this post


Link to post
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.

Share this post


Link to post
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.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks. I'll look into that. If I'm still having issues, would upgrading to the latest version of Cubecart fix this?

Share this post


Link to post
Share on other sites

I have yet to confirm CC6011 contributes to this problem. I will check on this shortly.

  • Like 1

Share this post


Link to post
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.

 

Edited by bsmither
  • Like 1

Share this post


Link to post
Share on other sites

Thanks.

I've applied those changes and cleared the cache. Initial tests look promising. I'll test a few more times throughout the day and hopefully the links will stay the same.

I'll let you know later on.

Share this post


Link to post
Share on other sites

Just a quick update to let you know that I've used the website several times today and it all seems to be working flawlessly.

Thanks again for your help.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...