Index: openacs-4/packages/ecommerce/www/sitemap.xml.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/sitemap.xml.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/ecommerce/www/sitemap.xml.tcl 19 Oct 2008 20:50:44 -0000 1.4 +++ openacs-4/packages/ecommerce/www/sitemap.xml.tcl 15 Nov 2008 12:07:06 -0000 1.5 @@ -1,20 +1,43 @@ #sitemap.xml.tcl +set cache_product_as_file [parameter::get -parameter CacheProductAsFile -default 0] set sitemap_xml " \n" -set sitemap_list [db_list_of_lists get_catalog_products " - select product_id, last_modified from ec_products + +if { $cache_product_as_file } { + + set sitemap_list [db_list_of_lists get_catalog_sku_products " + select sku, last_modified from ec_products + where active_p='t' and present_p = 't' and sku is not null + order by last_modified desc"] + + foreach url_pair $sitemap_list { + set sku [lindex $url_pair 0] + set last_modified [lindex $url_pair 1] + set url "[ec_insecure_location][ec_url]${sku}.html" + set last_mod "" + regsub -- { } $last_modified {T} last_mod + append last_mod ":00" + append sitemap_xml "$url${last_mod}\n" + } + +} else { + + set sitemap_list [db_list_of_lists get_catalog_products " + select product_id, last_modified from ec_products where active_p='t' and present_p = 't' order by last_modified desc"] -foreach url_pair $sitemap_list { - set product_id [lindex $url_pair 0] - set last_modified [lindex $url_pair 1] - set url "[ec_insecure_location][ec_url]product?usca_p=t&product_id=${product_id}" - set last_mod "" - regsub -- { } $last_modified {T} last_mod - append last_mod ":00" - append sitemap_xml "$url${last_mod}\n" + foreach url_pair $sitemap_list { + set product_id [lindex $url_pair 0] + set last_modified [lindex $url_pair 1] + set url "[ec_insecure_location][ec_url]product?usca_p=t&product_id=${product_id}" + set last_mod "" + regsub -- { } $last_modified {T} last_mod + append last_mod ":00" + append sitemap_xml "$url${last_mod}\n" + } } + append sitemap_xml "\n" ns_return 200 text/xml $sitemap_xml