Sitemapmadesimple and products module

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
rlparker25
Forum Members
Forum Members
Posts: 57
Joined: Thu Jan 17, 2008 3:58 pm

Sitemapmadesimple and products module

Post by rlparker25 »

Hi,

I am having some problems getting the xml sitemap to generate urls for products set up via the products manager.

How do I get it to include all of the links to my products? at the moment it just includes the page that calls the product module but not any of the product pages. Is it possible to include these?

Thanks

Rachael
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Sitemapmadesimple and products module

Post by Dr.CSS »

Products "pages" are not the same as pages in content > pages...
rlparker25
Forum Members
Forum Members
Posts: 57
Joined: Thu Jan 17, 2008 3:58 pm

Re: Sitemapmadesimple and products module

Post by rlparker25 »

yes I know!

my question was in there a way to get them included in the xml file created by sitemap made simple.

at the moment I have made a UDT which gets all the products and creates the xml for them, this tag is then inserted into the sitemapmadesimple template. This work well but I was wondering if there was an easier way as it also does not include pages created by any other module like news or job etc
User avatar
manc
Forum Members
Forum Members
Posts: 107
Joined: Wed Apr 01, 2009 12:59 pm

Re: Sitemapmadesimple and products module

Post by manc »

did you ever find out how to do this?
rlparker25
Forum Members
Forum Members
Posts: 57
Joined: Thu Jan 17, 2008 3:58 pm

Re: Sitemapmadesimple and products module

Post by rlparker25 »

Hi,

sort of! I created a UDT to generate my own xml list of products and their URLs then put this in the template for the site map

so my site map template now looks like this

Code: Select all

{* sitemap template *}
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
	http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">

{foreach from=$output item='page'}
<url>
  <loc>{$page->url}</loc>
  <lastmod>{$page->date|date_format:"%Y-%m-%d"}</lastmod>
  <priority>{$page->priority}</priority>
  <changefreq>{$page->frequency}</changefreq>
</url>
{/foreach}

{googlexml}

</urlset>
and my tag {googlexml} looks like this, I included a make alias function to make my urls pretty.

Code: Select all

global $gCms;

$db = &$gCms->db;

function make_alias($string, $isForm=false)
  {
	$string = trim($string);
	$string = preg_replace("/[_-\W]+/", "_", $string);
	$string = trim($string, '_');
	return strtolower($string);
  }



$query = 'SELECT * FROM cms_module_products WHERE status="Published" ';

$result= $db->Execute($query);

while ($row= $result->FetchRow())
{

echo "<url>\r\n";
 echo " <loc>http://www.domainname.org.uk/products/".$row['id']."/49/".make_alias($row['product_name'])."</loc>\r\n";
 echo " <lastmod></lastmod>\r\n";
 echo "<priority>0.7</priority>\r\n";
 echo " <changefreq>weekly</changefreq>\r\n";
echo "</url>\r\n";

}


hope this helps
User avatar
manc
Forum Members
Forum Members
Posts: 107
Joined: Wed Apr 01, 2009 12:59 pm

Re: Sitemapmadesimple and products module

Post by manc »

i have done this. in the sitemapmadesimple admin area, the URLs appear in the info tab. however, they do not show up in mydomain.com/sitemap.xml
rlparker25
Forum Members
Forum Members
Posts: 57
Joined: Thu Jan 17, 2008 3:58 pm

Re: Sitemapmadesimple and products module

Post by rlparker25 »

try opening a page and saving it again. the sitemap.xml file only updates if a change is made to a page
User avatar
manc
Forum Members
Forum Members
Posts: 107
Joined: Wed Apr 01, 2009 12:59 pm

Re: Sitemapmadesimple and products module

Post by manc »

nothing.
rlparker25
Forum Members
Forum Members
Posts: 57
Joined: Thu Jan 17, 2008 3:58 pm

Re: Sitemapmadesimple and products module

Post by rlparker25 »

Sorry, i'm not sure what to suggest as this worked fine for me.
User avatar
manc
Forum Members
Forum Members
Posts: 107
Joined: Wed Apr 01, 2009 12:59 pm

Re: Sitemapmadesimple and products module

Post by manc »

hmmm this is a doozy. i'll have a good messaround and see what i can do.

otherwise is there a way of changing gsitemap.php to accomodate it?
http://dev.cmsmadesimple.org/project/files/166
User avatar
manc
Forum Members
Forum Members
Posts: 107
Joined: Wed Apr 01, 2009 12:59 pm

Re: Sitemapmadesimple and products module

Post by manc »

also, do you know how to add the hierarchy into the URL of the product. ie make

http://mydomain.com/products/1/23/product-in-question

to

http://mydomain.com/products/hierarchy/ ... n-question?
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Sitemapmadesimple and products module

Post by calguy1000 »

manc wrote: also, do you know how to add the hierarchy into the URL of the product. ie make

http://mydomain.com/products/1/23/product-in-question

to

http://mydomain.com/products/hierarchy/ ... n-question?
Would take a code change. It's not part of the module atm.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Post Reply

Return to “Modules/Add-Ons”