Page 1 of 1
Sitemapmadesimple and products module
Posted: Wed Aug 05, 2009 10:29 am
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
Re: Sitemapmadesimple and products module
Posted: Wed Aug 05, 2009 6:46 pm
by Dr.CSS
Products "pages" are not the same as pages in content > pages...
Re: Sitemapmadesimple and products module
Posted: Thu Aug 06, 2009 8:00 am
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
Re: Sitemapmadesimple and products module
Posted: Fri Aug 28, 2009 8:42 am
by manc
did you ever find out how to do this?
Re: Sitemapmadesimple and products module
Posted: Fri Aug 28, 2009 9:11 am
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
Re: Sitemapmadesimple and products module
Posted: Fri Aug 28, 2009 11:52 am
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
Re: Sitemapmadesimple and products module
Posted: Fri Aug 28, 2009 1:20 pm
by rlparker25
try opening a page and saving it again. the sitemap.xml file only updates if a change is made to a page
Re: Sitemapmadesimple and products module
Posted: Fri Aug 28, 2009 1:26 pm
by manc
nothing.
Re: Sitemapmadesimple and products module
Posted: Fri Aug 28, 2009 1:58 pm
by rlparker25
Sorry, i'm not sure what to suggest as this worked fine for me.
Re: Sitemapmadesimple and products module
Posted: Fri Aug 28, 2009 2:01 pm
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
Re: Sitemapmadesimple and products module
Posted: Fri Aug 28, 2009 3:22 pm
by manc
Re: Sitemapmadesimple and products module
Posted: Fri Aug 28, 2009 3:32 pm
by calguy1000
Would take a code change. It's not part of the module atm.