Jump to:

10990 Posts in 2727 Topics by 1818 members

All other Modules

SilverStripe Forums » All other Modules » How to Disable Translatable on Search Results

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 659 Views
  • Tama
    Avatar
    Community Member
    130 Posts

    How to Disable Translatable on Search Results Link to this post

    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.

  • rcurry
    Avatar
    Community Member
    1 Post

    Re: How to Disable Translatable on Search Results Link to this 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.

  • Tama
    Avatar
    Community Member
    130 Posts

    Re: How to Disable Translatable on Search Results Link to this post

    Cheers Robert

  • sashion
    Avatar
    Community Member
    23 Posts

    Re: How to Disable Translatable on Search Results Link to this post

    Hey,

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

    Cheers,
    Sash

  • Tama
    Avatar
    Community Member
    130 Posts

    Re: How to Disable Translatable on Search Results Link to this post

    Hi Sash

    Yes, updating solved the problem for us.

    Cheers
    Tama

  • elgordo
    Avatar
    Community Member
    70 Posts

    Re: How to Disable Translatable on Search Results Link to this post

    This commit resolved the issue for me

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

    Cheers

    Gordon

    659 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.