+ Reply to Thread
Results 1 to 10 of 10

Thread: Sorting title?

  1. #1

    Sorting title?

    Dear Flynax Community,

    For the sorting option in listing list. Is there any way if I can change
    Screen Shot 2020-01-30 at 5.14.34 PM.png

    Date (Ascending)
    Date (Descending)
    Price (Ascending)
    Price (Descending)

    to

    Date (Oldest)
    Date (Newest)
    Price (Low to High)
    Price (High to Low)

    Thank you

  2. #2
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    1,600
    Hello,

    You can translate it via Languages > Search


    or go to ftp > templates > tpl > blocks > grid_navbar.tpl

    find {$lang[$st]}

    and change it adding a condition like:

    Code:
    Only registered members can view the code.
    Last edited by Rudi; February 3, 2020 at 05:56 AM.

  3. #3
    Quote Originally Posted by Rudi View Post
    Hello,

    You can translate it via Languages > Search
    Yes Rudi, but it only Ascending and Descending, so if I translate Ascending to Oldest and Descending to Newest then I will have:

    Date (Oldest)
    Date (Newest)
    Price (Oldest)
    Price (Newest)

    The price part will look weird. Can I add another text phrase for price that different from date.

  4. #4
    Hi Rudi,

    Thanks for your hint, I looked at the grid_navbar.tpl file and made change from:

    {foreach from=$sort_types key='st_key' item='st'}
    <li><a rel="nofollow" {if $sort_by == $sort_key && $sort_type == $st_key}class="active"{/if} title="{$lang.sort_listings_by} {$field_item.name} ({$lang[$st]})" href="{if $config.mod_rewrite}?{else}index.php?{$pageInfo.qu ery_string}&{/if}sort_by={$sort_key}&sort_type={$st_key}">{$fiel d_item.name} ({$lang[$st]})</a></li>
    {/foreach}
    To:

    {foreach from=$sort_types key='st_key' item='st'}
    <li><a rel="nofollow" {if $sort_by == $sort_key && $sort_type == $st_key}class="active"{/if} title="{$lang.sort_listings_by} {$field_item.name} ({$lang[$st]})" href="{if $config.mod_rewrite}?{else}index.php?{$pageInfo.qu ery_string}&{/if}sort_by={$sort_key}&sort_type={$st_key}">{if $field_item.Type == 'date'}
    {$field_item.name} ({$lang[$st]})
    {elseif $field_item.Type == 'price'}
    {$field_item.name} ({$lang[$st]})
    {else}
    {$field_item.name} ({$lang[$st]})
    {/if}
    However for this part ({$lang[$st]}), I'm a bit confused because I added 2 new lang phrase which are: 'newest' and 'oldest', and 'low to high' and 'high to low'. How do I change two variations of:

    'newest' and 'oldest',
    'low to high' and 'high to low'

    with just ({$lang[$st]})

    I looked at the top of the file and see this part
    {php}
    $types = array('asc' => 'ascending', 'desc' => 'descending'); $this -> assign('sort_types', $types);
    $sort = array('price', 'number', 'date', 'mixed'); $this -> assign('sf_types', $sort);
    {/php}
    I probably need to add something to this?

  5. #5
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    1,600
    ok, you can create two phrase keys with _asc and _desc postfixes like YOUR_FIELD_KEY_asc and YOUR_FIELD_KEY_desc and implement this way:

    Code:
    Only registered members can view the code.
    Last edited by Rudi; September 22, 2020 at 06:50 AM.

  6. #6
    It worked great thanks Rudi

  7. #7
    Hello Wei,

    I appreciate if you can share with us the final modification on this thread.

    Thanks

  8. #8
    Hi Nazzal,

    Basically everything have been posted here. I didn't add any new except my own language phrase.

  9. #9
    Quote Originally Posted by Rudi View Post
    ok, you can create two phrase keys with _asc and _desc postfixes like YOUR_FIELD_KEY_asc and YOUR_FIELD_KEY_desc and implement this way:

    Code:
    Only registered members can view the code.

    Hello Rudi,

    I need more details where to replace this code? because there are two {$lang[$st]}

  10. #10
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    1,600
    Hello,

    You need to go to templates > tpl > blocks > grid_navbar.tpl

    find a section at the bottom with {if $sorting}

    then inside this block find a code:

    {$field_item.name} ({$lang[$st]})

    you need to replace:

    Code:
    Only registered members can view the code.
    with:
    Code:
    Only registered members can view the code.

    where YOUR_FIELD_KEY is the key of your listing field

+ Reply to Thread