Is there an easy way of obtaining a list of categories and brands on my sites so that I can ping them? If I view the html on the Categories or Brands page, there's just code.
Hi,
Sure - as a text file output have a go with the following:
<?php require("includes/common.php"); header("Content-Type: text/plain"); // CATEGORIES $sql = "SELECT DISTINCT(category) as category FROM `".$config_databaseTablePrefix."products` WHERE category <> '' ORDER BY category"; if (database_querySelect($sql,$rows)) { foreach($rows as $product) { if ($config_useRewrite) { $href = "category/".urlencode(tapestry_hyphenate($product["category"]))."/"; } else { $href = "search.php?q=category:".urlencode($product["category"]).":"; } print "http://".$_SERVER["HTTP_HOST"].$config_baseHREF.$href."\n"; } } // BRANDS $sql = "SELECT DISTINCT(brand) as brand FROM `".$config_databaseTablePrefix."products` WHERE brand <> '' ORDER BY brand"; if (database_querySelect($sql,$rows)) { foreach($rows as $product) { if ($config_useRewrite) { $href = "brand/".urlencode(tapestry_hyphenate($product["brand"]))."/"; } else { $href = "search.php?q=brand:".urlencode($product["brand"]).":"; } print "http://".$_SERVER["HTTP_HOST"].$config_baseHREF.$href."\n"; } }?>
Cheers, David. -- PriceTapestry.com
Perfect David. Thank you very much
©2006-2025 IAAI Software | Contact Us | Privacy Policy
Hi,
Sure - as a text file output have a go with the following:
<?php
require("includes/common.php");
header("Content-Type: text/plain");
// CATEGORIES
$sql = "SELECT DISTINCT(category) as category FROM `".$config_databaseTablePrefix."products` WHERE category <> '' ORDER BY category";
if (database_querySelect($sql,$rows))
{
foreach($rows as $product)
{
if ($config_useRewrite)
{
$href = "category/".urlencode(tapestry_hyphenate($product["category"]))."/";
}
else
{
$href = "search.php?q=category:".urlencode($product["category"]).":";
}
print "http://".$_SERVER["HTTP_HOST"].$config_baseHREF.$href."\n";
}
}
// BRANDS
$sql = "SELECT DISTINCT(brand) as brand FROM `".$config_databaseTablePrefix."products` WHERE brand <> '' ORDER BY brand";
if (database_querySelect($sql,$rows))
{
foreach($rows as $product)
{
if ($config_useRewrite)
{
$href = "brand/".urlencode(tapestry_hyphenate($product["brand"]))."/";
}
else
{
$href = "search.php?q=brand:".urlencode($product["brand"]).":";
}
print "http://".$_SERVER["HTTP_HOST"].$config_baseHREF.$href."\n";
}
}
?>
Cheers,
David.
--
PriceTapestry.com