Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Data Model Questions

GoogleSiteMap change Locale




9 June 2010 at 9:46am (Last edited: 9 June 2010 10:41am), Community Member, 180 Posts


i have site in 8 languages
how to modify GoogleSiteMap to create map for each language ?

in GoogleSiteMap.php there is a code

      $filter = '';
      $bt = defined('DB::USE_ANSI_SQL') ? "\"" : "`";
      if(self::$use_show_in_search) {
         $filter = "{$bt}ShowInSearch{$bt} = 1";
      $this->Pages = Versioned::get_by_stage('SiteTree', 'Live', $filter);

i tried to put
$filter = 'Locale = en_US'; -> doesnt work

$this->Pages = DataObject::get('SiteTree', "Locale == 'en_US'", '', '', '');
which gave me an error

[User Error] Couldn't run query: SELECT "SiteTree_Live"."ClassName", .....
"ErrorPage_Live" ON "ErrorPage_Live"."ID" = "SiteTree_Live"."ID" WHERE (Locale == 'en_US') AND ("SiteTree_Live"."Locale" = 'pl_PL') ORDER BY "Sort" Something is wrong in your syntax obok '== 'en_US') AND ("SiteTree_Live"."Locale" = 'pl_PL') ORDER BY "Sort"' w linii 1

so i put:
Locale = 'en_US'

and now the SQL Query is searching pages which are satisfing the conditions Locale = 'en_US' AND "Locale" = 'pl_PL' but it is always false

how to change this conditions "Locale" = 'pl_PL' to other Locale ?


there was a problem with Translatable::set_default_locale in _config.php