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.

All other Modules

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

How to Disable Translatable on Search Results


Reply

6 Posts   681 Views

Avatar
Tama

28 September 2012 at 11:14am (Last edited: 28 September 2012 11:15am), Community Member, 130 Posts

We are running SS3 with Translatable.

If a search term is entered the following page comes up:
http://localhost.devsite/home/SearchForm?Search=book&action_results=Go

With the following error:

[Notice] Undefined property: Page::$Locale
GET /home/SearchForm?Search=book&action_results=Go
Line 542 in C:\source\devsite\translatable\code\model\Translatable.php

The Source shown is:

533     * It falls back to "Locale='' OR Lang IS NULL" and assumes that
534     * this implies querying for the default language.
535     *
536     * Use {@link disable_locale_filter()} to temporarily disable this "auto-filtering".
537     */
538    function augmentSQL(SQLQuery &$query) {
539       // If the record is saved (and not a singleton), and has a locale,
540       // limit the current call to its locale. This fixes a lot of problems
541       // with other extensions like Versioned
542       $locale = ($this->owner->ID && $this->owner->Locale) ? $this->owner->Locale : Translatable::get_current_locale();
543       $baseTable = ClassInfo::baseDataClass($this->owner->class);
544       if(
545          $locale
546          // unless the filter has been temporarily disabled
547          && self::locale_filter_enabled()
548          // DataObject::get_by_id() should work independently of language

Line 536 suggests that this can be disabled, but I don't know how.

Any suggestions would be appreciated.

Avatar
rcurry

1 October 2012 at 1:30pm Community Member, 1 Post

Hi Tama,

If you update your version of Translatable it should fix this problem. The Locale variable wasn't being checked for properly so it would always crash when it found an object without it.

Avatar
Tama

2 October 2012 at 9:20am Community Member, 130 Posts

Cheers Robert

Avatar
sashion

5 December 2012 at 6:29am (Last edited: 5 December 2012 6:29am), Community Member, 23 Posts

Hey,

I got the same error. Updating didn´t solve the problem...
@Tama: Did this solve yours?

Cheers,
Sash

Avatar
Tama

6 December 2012 at 12:43pm Community Member, 130 Posts

Hi Sash

Yes, updating solved the problem for us.

Cheers
Tama

Avatar
elgordo

10 May 2013 at 12:55pm Community Member, 70 Posts

This commit resolved the issue for me

https://github.com/silverstripe/silverstripe-translatable/pull/39

Cheers

Gordon