Hi David. Regarding previous question about a little modification to sitemap.php.
Is there any easy way to choose which merchants are going to be generated into sitemap?
Thanks.
Yes, I use multiple feeds for same merchant in some cases.
However, I only have to change filename with merchant, isn't it?
$sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` WHERE merchant IN ('Merchant1','Merchant2',...) AND imported > 0 AND products > 0 ORDER BY filename";
Hi,
A DISTINCT() select from the products table would do the trick - have a go with:
$sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` WHERE filename IN (SELECT DISTINCT(filename) FROM `".$config_databaseTablePrefix."products`) ORDER BY filename";
Cheers,
David.
--
PriceTapestry.com
Sorry, maybe I am missing something.
But with that sentence, where I choose which merchants are going to be into sitemap?
Ah yes sorry, I forgot about the specific merchants requirements in which case as you proposed would be fine..
$sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` WHERE merchant IN ('Merchant1','Merchant2',...) AND imported > 0 AND products > 0 ORDER BY filename";
(bear in mind that this only covers the case where merchant names are entered on Feed Registration Step 2 but if that's all your feeds then no problem...)
Cheers,
David.
--
PriceTapestry.com
Hi David.
I want to narrow the sitemap, as I am putting a lot of URL with not value for google and my crawl budget is lower every day.
I have done a big table with most valuable EAN (so I have pt_products and pt_promoted)
How can I put in sitemap only items that appears into pt_promoted? (there are some merchants which don't have any product "promoted")
Hi,
Assuming a `name` column on your pt_promoted table, then the sitemap index and per-feed sitemap can be restricted by product name as follows - edit sitemap.php and look for the following code at line 55:
$sql = "SELECT normalised_name FROM `".$config_databaseTablePrefix."products` WHERE filename='".database_safe($_GET["filename"])."' LIMIT ".$start.",".$limit;
...and REPLACE with:
$sql = "SELECT normalised_name FROM `".$config_databaseTablePrefix."products` WHERE filename='".database_safe($_GET["filename"])."' AND name IN (SELECT name FROM `".$config_databaseTablePrefix."promoted`) LIMIT ".$start.",".$limit;
And then the following code at line 84:
$sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` WHERE imported > 0 ORDER BY filename";
...and REPLACE with:
$sql = "SELECT DISTINCT(filename) FROM `".$config_databaseTablePrefix."products` WHERE name IN (SELECT name FROM `".$config_databaseTablePrefix."promoted`) ORDER BY filename";
Hope this helps!
Cheers,
David.
--
PriceTapestry.com
Hi,
Sure - in addition to the previous mod (from node 6312) using:
$sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` WHERE imported > 0 AND products > 0 ORDER BY filename";
..you could further refine by filename using an IN clause e.g.
$sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` WHERE filename IN ('Feed1.xml','Feed2.xml') AND imported > 0 AND products > 0 ORDER BY filename";
That would require a 1-1 merchant <> feed mapping which is normally the case, but if you are using multi-merchant feeds let me know and I'll show how to extend the mod for that scenario...
Hope this helps!
Cheers,
David.
--
PriceTapestry.com