Create a Custom Magento XML Sitemap with PHP

Create a Custom Magento XML Sitemap with PHP

The built-in option for Magento simply takes all the products and makes the sitemap. Which will work for 95% of the stores out there. But if your working on a really custom shop you might want to create your own. This one shop I’m working on has all Configurable Products so I do not want the simple products showing in my sitemap.

I also want to turn off categories like “featured” that I use for sliders and such.

  1. Create File to Overwrite

    Create a file called “my_sitemap.xml” in your root.

  2. Download Script

    You can download the freshest code from our GitHub Gist.

  3. Change Site Source

    Enter Your.com in the Base Variable

  4. Run.

    Make sure your Flat File Index is updated in the Magento Admin. Then, either run it manually when you make a change or set up a cron job.

Jon Tsourakis

Written by:

Jon Tsourakis followed his dream of opening an independent digital marketing agency. As CEO of Revital Agency, he uses logic and intuition to help companies grow their business online.
  • Christian

    Nice script but have you one sitemap php script where all the products will listed? 🙂

  • Christian

    Nice script! 🙂 But is there a way to list all products with a php script?

SUBSCRIBE TO THE REVITAL AGENCY BLOG

GET FREE MARKETING TIPS & UNCOVER
THE BEST WAYS TO GROW YOUR BUSINESS.

Enter your email address below: