Dirty Butter Posted December 28, 2013 Share Posted December 28, 2013 I've been too busy to check on Webmaster Tools of late and only realized yesterday that for the last month Google was accepting our sitemap as valid, but was NOT indexing the products. I suspected it was due to the https url's and used find/replace to change them back to http yesterday. Today's sitemap shows 3,220 pages indexed, as expected. What can I do to get CC to create the sitemap with http, rather than https url's? Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted December 28, 2013 Share Posted December 28, 2013 Open classes/seo.class.php and find line 649: $store_url = (CC_SSL) ? $GLOBALS['config']->get('config','standard_url') : $GLOBALS['storeURL']; Replace with: $store_url = $GLOBALS['config']->get('config','standard_url'); Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 28, 2013 Share Posted December 28, 2013 The easiest change to make would be: In the file /classes/seo.class.php, near line 835, starts the _sitemap_link() function. Change: $updated = (!$updated) ? time() : $updated; to: $updated = (!$updated) ? time() : $updated; $store_url = (CC_SSL) ? $GLOBALS['config']->get('config','standard_url') : $GLOBALS['storeURL']; Six lines in, change: $GLOBALS['storeURL'] to: $store_url This makes sure that, when SEO-mode is switched off, the "Standard URL" is used. (I'm not sure why 'config'.'standard_url' is not used as a matter of course.) When the SEO-mode is switched on, SEO->generatePath() is used. The problem here is that generatePath() is used to create all seo-friendly URLs at all times -- under SSL and otherwise. $GLOBALS['storeURL'] will be http or https according to other criteria. To deal with this, we will need to get a bit messy. In _sitemap_link(), change: $input['url'] = $this->generatePath($input['id'], $type, '', true, true); to: $input['url'] = $this->generatePath($input['id'], $type, '', $store_url, true); We are hijacking one of the parameters that says to use the store domain address or to not use it when returning a URL. In the generatePath() function, near the end, change: return (($absolute) ? $GLOBALS['storeURL'] . '/' . $safe_path : $safe_path) . (($extension) ? $this->_extension : ''); to: return (($absolute) ? ( (is_string($absolute)) ? $absolute : $GLOBALS['storeURL'] ) . '/' . $safe_path : $safe_path) . (($extension) ? $this->_extension : ''); What we have done is to further the testing of $absolute so that if $absolute is actually a string (not just simply something that looks true), then we will use the string. Otherwise we will use the global store URL, whatever it is, as discussed above. Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted December 28, 2013 Share Posted December 28, 2013 I will revisit this as it looks more complex than I first thought. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted December 28, 2013 Author Share Posted December 28, 2013 I'll wait to use either approach then, as it's not that hard to find/replace. I can't believe I'm the only one to have this problem with SSL and Google Sitemaps. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted January 4, 2014 Author Share Posted January 4, 2014 Perhaps related, I had to hard code the logo url in our email template to get the logo to show up in Outlook after the SSL change. It worked properly with the logo string previously, but when I activated the SSL the logo had an https url. For some reason Outlook would not show it. By hard coding the http version of the logo, all works perfectly again. Doing the find/replace in the sitemap has been more of an issue than I had imagined. I'm in the process of testing an upgrade to our skin, with cache disabled. But to flip back and forth between current version and new version, as I test, I need to rebuild the sitemap, as there are new pages with the new version. Last night Google "caught me" in the midst of testing and sure enough, this morning only 4 items were indexed - thanks to the https. SO - do I use Bsmither's suggestion or Al's???????? Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted January 5, 2014 Share Posted January 5, 2014 I still have a GitHub issue open about this which over the holiday period I haven't been able to look at yet. Sorry. Maybe a dirty fix in between is a string replacement of https:// to http:// prior to file write. GitHub Issue #69 Brian please let me know your GitHub username if you want access. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted January 5, 2014 Author Share Posted January 5, 2014 Maybe a dirty fix in between is a string replacement of https:// to http:// prior to file write. Which, of course, I haven't a clue how to do on my on. LOL Well, what do you know - I think I did it! I Googled how to code a string replace and played with it until I found what seems to be the right code and placement. In seo.class.php at the end of the create sitemap section: $sitemap = $this->_sitemap_xml->getDocument(true); //MY ADDITION TO CHANGE HTTPS TO HTTP IN SITEMAP $sitemap=str_replace("https:","http:",$sitemap); Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted January 14, 2014 Share Posted January 14, 2014 Please find fix here: https://github.com/cubecart/CubeCart/commit/22f854b9f52eb0380fb24ff113e25a9e0d6cbc3c Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.