[MSU Sitemaps] Overcoming Google's 50,000 item sitemap limit

Technical difficulties? Ask for help here.
NeilColeclough
Posts: 6
Joined: Tue Aug 24, 2010 8:52 am

[MSU Sitemaps] Overcoming Google's 50,000 item sitemap limit

Postby NeilColeclough » Tue Aug 24, 2010 10:38 am

Recent additions to my product list mean that the sitemap now has 50,260 items. Google won't accept sitemaps with any more than 50,000 items and so is rejecting the sitemap. Is there a way to configure sitemaps.php to generate multiple product sitemaps with fewer than 50,000 items each? If not, as a workaround for now, how can I get rid of the new products sitemap?

NeilColeclough
Posts: 6
Joined: Tue Aug 24, 2010 8:52 am

Re: [MSU Sitemaps] Overcoming Google's 50,000 item sitemap l

Postby NeilColeclough » Wed Aug 25, 2010 8:49 am

For any others encountering this problem, this is how I fixed it.
I made a copy of sitemaps/products.php and saved it as sitemaps/products2.php

In sitemaps/products.php find

$result = tep_db_query("SELECT p.products_id, p.products_date_added, p.products_last_modified FROM ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_DESCRIPTION." pd WHERE p.products_status = '1' AND pd.products_id = p.products_id AND pd.language_id = '".$langId."' ORDER BY p.products_id DESC");


and change it to

$result = tep_db_query("SELECT p.products_id, p.products_date_added, p.products_last_modified FROM ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_DESCRIPTION." pd WHERE p.products_status = '1' AND p.products_id <= '26000' AND pd.products_id = p.products_id AND pd.language_id = '".$langId."' ORDER BY p.products_id DESC");

(*note - change the 26000 value to the middle product_id value for your store if you need to)

In sitemaps/products2.php find

$result = tep_db_query("SELECT p.products_id, p.products_date_added, p.products_last_modified FROM ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_DESCRIPTION." pd WHERE p.products_status = '1' AND pd.products_id = p.products_id AND pd.language_id = '".$langId."' ORDER BY p.products_id DESC");


and change it to

$result = tep_db_query("SELECT p.products_id, p.products_date_added, p.products_last_modified FROM ".TABLE_PRODUCTS." p, ".TABLE_PRODUCTS_DESCRIPTION." pd WHERE p.products_status = '1' AND p.products_id > '26000' AND pd.products_id = p.products_id AND pd.language_id = '".$langId."' ORDER BY p.products_id DESC");


(again, change the 26000 value if you need to)

Resubmit sitemaps.php to Google and hey presto your products are now split into two sitemaps both of which are within Google's limit. Green ticks all the way!