PrestaShop Forum

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum

Jump to content

[Module] Lazymans Google XML sitemap (Automatic XML Sitemap Generator SMAP)

41 replies to this topic
#1
Katmatcreations

    PrestaShop Apprentice

  • Members
  • PipPip
  • 326 posts
I been meaning to do this one for a while and with the recent errors i was getting with the Google sitemap module i decided to make time today.

Thats not to say the presta team dont do a good job, infact i want everyone who posts on here to say thank you to the presta team (and not me!).

Down to business, ill call it a module but its not really!

There is 1 file, it is called SMAP.php it will generate the same as a sitemap.xml when the google bot requests it! to do so i took the SQL from the google sitemap module.

all you need to do to make this work is upload it to your presta root directory folder and add 1 line to .htaccess

RewriteRule (.*)\.xml(.*) $1.php$2 [nocase]   


when you point google at your sitemap (via google webmaster tools) you then say that your sitemap is called smap.xml

NOTE: i would have called it sitemap.php (and thus it would be known as sitemap.xml) but there is something already called that in the presta root!

NOTE2: this will only work at the moment if you have URL-rewrite on, i only ever build sites with it on so only needed it on.

NOTE3: at no extra cost by using this i have doubled the product entries you will submit to google!!

when you submit

Quote



it will also submit

Quote



and both are relevant and will be indexed by the google server :)

DISCLAIMER

i dont take any responsibility for anything this does or doesnt to do in the course of human (or any other) history herein this reality or therefore the party of the third part who handles the party of the second part who in tern requires singing rights over the party of the first part who would otherwise settle the party of the third part in the even of a termination of the second part!

Anyway enjoy! Hope it works like it does for me and i hope the theory behind it gets included in the next presta release *HINT HINT*

28/09 ***EDIT*** code has been updated!

Attached Files

  • Attached File  smap.php   4bytes   767 downloads


#2
Katmatcreations

    PrestaShop Apprentice

  • Members
  • PipPip
  • 326 posts
EDIT reserved #1

Once size fits all again :)

#3
21846657

    PrestaShop Fanatic

  • Moderators
  • 1140 posts
Hi KC (If I may be allowed :lol: ), I just have a look into the codes. I have to say this is quite a module! Thanks a bunch.

* 欢迎访问PrestaShop官方中文论坛

* 搜索是你的朋友。提问之前请善用搜索引擎和论坛搜索。

* 未获得帮助?——请详述问题,提供PrestaShop版本、运行环境(Web Server/PHP/MySQL)、浏览器类型等必要信息。

* 如果问题解决了,请为你的帖子标题加上[已解决]。谢谢。

#4
Katmatcreations

    PrestaShop Apprentice

  • Members
  • PipPip
  • 326 posts
LOL no probs, makes my life easier so i wanted to share it. :)

Ive used the same technique before on other sites, its the lazymans sitemap!

hrmmm im going to rename it!

#5
Batdelfuego

    PrestaShop Newbie

  • Members
  • Pip
  • 4 posts
Nice work Karmatcreations!

I've just installed it on my fresh PrestaShop...

One thing I notice tho is in the urls... I'm getting duplicates of the www.

It looks like this:

http://www.www.poopb...tent/1-delivery

Yeah i know the domain is funny... but thats what were going to be selling... :)

I've just installed my PrestaShop about 3 hours ago and it's my first time trying the system (After going through a bunch of other cart testing)

Do you know why I might be getting this doubling?

Also in your 3rd Note... Isnt referencing 2 urls to the same content in the same site be considered as "duplicate content" from Google? I'm still trying to figure out how to fix this in the PrestaShop Admin... so that each product as a unique url...

#6
Katmatcreations

    PrestaShop Apprentice

  • Members
  • PipPip
  • 326 posts
haha what a great domain name :)

OH crap i forgot to mention its only for version 1.2.4, its all i have in development environment. ill edit the top to mention it.

IN version 1.1 they included the WWW in a different way to 1.2.

Ill whip you up a 1.1 version give me a second and ill use the second post for it to go!

Google shouldnt count it as doubles but if it does ill change it, in theory its 2 different URLs.

#7
Katmatcreations

    PrestaShop Apprentice

  • Members
  • PipPip
  • 326 posts
ok try the file in post 2

#8
Batdelfuego

    PrestaShop Newbie

  • Members
  • Pip
  • 4 posts
All right! Works perfectly now!
Thanks a bunch!

I thought I had the lastest PrestaShop version installed tho.
I downloaded it last night from the home page.
I'll have to check that out.

Thanks for your sitemap code and your quick fix.
Really nice of you.

And yeah... thanks to the PrestaShop team too ;)

#9
Katmatcreations

    PrestaShop Apprentice

  • Members
  • PipPip
  • 326 posts
Just realised i missed something and took the www. out (google didnt like it)

So one size fits all now :)

#10
citrix34

    PrestaShop Apprentice

  • Members
  • PipPip
  • 224 posts
A very useful script Katmatcreations.
Many thanks


JP
Mephivio, créateur de sites internet et plateformes e-commerce à base de technologies Open Source et travaux d'infographie pour la communication visuelle des entreprises.

Boutique en ligne (Software) : Mephishop
Blog IT : Veille Techno IT

#11
mr_c

    PrestaShop Apprentice

  • Members
  • PipPip
  • 42 posts
Can i ask what the difference between this and http://www.ecartserv...sitemap-module/ is?

thanks

#12
Katmatcreations

    PrestaShop Apprentice

  • Members
  • PipPip
  • 326 posts
Well for starters mine doesnt need someone to click a button to generate a XML file, when google comes knocking for the latest sitemap the php queries the database (by itself) and outputs as XML.

as far as googlebot is concerned its reading the PHP as XML and is happy!

plus you get products being submitted twice!

#13
jhnstcks

    PrestaShop Fanatic

  • Moderators
  • 1913 posts
I have installed the file and added the required line to htaccess, when the xml is generated every product URL i set to product id 1, as you can see in my examples below:

http://purplegiraffe...es-707-tortoise
http://purplegiraffe...sel-sunglasses-
http://purplegiraffe...ses-shiny-black

Categories and CMS pages work fine, its just the products that are messed up.

Edit: this happens on 3 sites so its not just one installation.
Helpful hints and tips to Empower your Prestashop site - Join us on Facebook and get involved, tell us the things that help you.
If you think someone's answer helped, please give him/her a Positive Reputation vote by liking their post.
E-commerce hosting from Scotserve, fast, reliable and affordable.

#14
Katmatcreations

    PrestaShop Apprentice

  • Members
  • PipPip
  • 326 posts
which version of presta are you using?

#15
jhnstcks

    PrestaShop Fanatic

  • Moderators
  • 1913 posts
1.2.4
Helpful hints and tips to Empower your Prestashop site - Join us on Facebook and get involved, tell us the things that help you.
If you think someone's answer helped, please give him/her a Positive Reputation vote by liking their post.
E-commerce hosting from Scotserve, fast, reliable and affordable.

#16
jolvil

    PrestaShop Fanatic

  • Members
  • PipPipPipPip
  • 2706 posts

Quote

NOTE3: at no extra cost by using this i have doubled the product entries you will submit to google!!

when you submit
http://www.website.com/1-product
it will also submit
http://www.website.c...egory/1-product
and both are relevant and will be indexed by the google server


This is a duplicate content !!!!

#17
Katmatcreations

    PrestaShop Apprentice

  • Members
  • PipPip
  • 326 posts

From 1253948177:

Quote

NOTE3: at no extra cost by using this i have doubled the product entries you will submit to google!!

when you submit
http://www.website.com/1-product
it will also submit
http://www.website.c...egory/1-product
and both are relevant and will be indexed by the google server


This is a duplicate content !!!!


yep and yet its 2 different links.

#18
Katmatcreations

    PrestaShop Apprentice

  • Members
  • PipPip
  • 326 posts

From 1253947269:

1.2.4


did you upgrade to 1.2.4 or do a clean install when you setup shop?

im trying to work out why your version of presta 1.2.4 seems to be different to the others that i use this on

#19
jhnstcks

    PrestaShop Fanatic

  • Moderators
  • 1913 posts
2 of them are upgrades and one was a clean install.

To be honest I cant see how it would matter as the rest of the url is correct apart from the product_id, there is obviously a problem with that section of the code somehow.
Helpful hints and tips to Empower your Prestashop site - Join us on Facebook and get involved, tell us the things that help you.
If you think someone's answer helped, please give him/her a Positive Reputation vote by liking their post.
E-commerce hosting from Scotserve, fast, reliable and affordable.

#20
Katmatcreations

    PrestaShop Apprentice

  • Members
  • PipPip
  • 326 posts
ok think i know what it is, ill test today and do an update