test
Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • Luna Garden Moderator
    #1043254

    Hi,

    We’re looking at this and will get back to you soon, pls stay tuned.

    thesdhotel Friend
    #1043289

    Hello, I found this, maybe it can help? https://formatjs.io/dust/
    (I know you’re using dust.js)

    Just an idea. Maybe you have a better one

    • This reply was modified 7 years, 6 months ago by  thesdhotel.
    Luna Garden Moderator
    #1043697

    Hi,

    Thanks for your idea, our developer will take a look on it. We’re trying to custom for you and it will take a few days.

    thesdhotel Friend
    #1043787

    Thanks! I think it could be beneficial for everybody to have a way to customize the Format of custom fields containing dates or numbers, when used to display in the product-item.php layout. So you could also consider to implement this possibility officially for everybody too 🙂

    • This reply was modified 7 years, 6 months ago by  thesdhotel.
    • This reply was modified 7 years, 6 months ago by  thesdhotel.
    Luna Garden Moderator
    #1043792

    Yes, we intend to add this custom to release, but not for next version as we’re making for Sorting feature first.

    thesdhotel Friend
    #1043822

    Ok sure! Let me know when you have the customization in the meanwhile, thanks 😀

    Mo0nlight Moderator
    #1044667

    Hi.

    You can try this to include the library.

    Copy the file download from https://formatjs.io/dust/
    dust-intl-with-locales.min.js
    dust-intl-with-locales.min.js.map

    To folder : components/com_jamegafilter/assets/js/

    Edit the file:
    components/com_jamegafilter/assets/asset.php
    Add the code.

    $doc->addScript('components/com_jamegafilter/assets/js/dust-intl-with-locales.min.js');

    After the code.

    $doc->addScript('components/com_jamegafilter/assets/js/main.js');

    Edit the file:
    /plugins/jamegafilter/(content or k2 or eshop etc)/tmpl/default.php
    add this code.

    DustIntl.registerWith(dust);

    After

    for (var key in p) {
      if (p.hasOwnProperty(key)) {
        var compiled = dust.compile(p[key], key);
        dust.loadSource(compiled);
      }
    }

    That finish the setup.
    From now You can using the library.

    I took a sample screenshot. how to use the date. in this case is content from joomla
    first edit the file:
    /plugins/jamegafilter/content/helper.php
    Add the code

                $item->show_published_date = (int)(strtotime($baseItem->publish_up).'000');
                $item->show_created = (int)(strtotime($baseItem->created).'000');

    Look at the attachment.

    And then look at the json file.
    Look at attachment.

    And edit the file:
    /plugins/jamegafilter/content/layouts/default/product-item.php

    Add the code.

                {@formatDate val=show_published_date formatName="short"/}
                <br/>
                {@formatDate val=show_created formatName="short"/}

    Then look at the attachment and the result attachment.


    1. Screen-Shot-2017-06-28-at-2.47.54-PM
    2. Screen-Shot-2017-06-28-at-2.48.24-PM
    3. Screen-Shot-2017-06-28-at-2.50.13-PM
    4. Screen-Shot-2017-06-28-at-2.50.25-PM
    thesdhotel Friend
    #1044785

    Hello, Thanks! How can I make this work with {attr.ct1.value} for example? (Custom Field)?

    I tried using {@formatDate val=attr.ct1.value formatName="short"/} but it didn’t work.

    Also another thing I didn’t understand, why did you append 000 to the UNIX dates?

    Thanks a lot!

    • This reply was modified 7 years, 6 months ago by  thesdhotel.
    • This reply was modified 7 years, 6 months ago by  thesdhotel.
    Mo0nlight Moderator
    #1045152

    Hi.

    It’s because javascript timer using millisecond. so we need to append thousand to the number.

    If you find it difficult to make change, you could post your ftp, admin info so i could make the change for you.

    thesdhotel Friend
    #1045609

    Hello, I made the change and it works correctly with a Joomla field like Published Date, but what I need is using a Custom Field (which was the whole purpose of this topic).
    Using the script for a Joomla Field is not useful because for those the Date Format could already be done in PHP.
    I need to use this for a Custom Field (calendar field of course)

    Mo0nlight Moderator
    #1046176

    Hi.

    You could try this to show custom field value.

    edit the file:
    /plugins/jamegafilter/content/layouts/default/product-item.php

    Add the code

    {@formatDate val=attr.ct1.value formatName="short"/}

    ct1 : ct + id of custom field. you could see the id in the administrator.

    Look at attachment.


    1. Screen-Shot-2017-07-05-at-9.41.48-AM
    thesdhotel Friend
    #1046260

    Sorry but do you even read messages?

    I already knew that you can do that but it doesn’t work.

    In my message on June 28, 2017 at 3:06 pm, I clearly stated that I used that same exact code

    {@formatDate val=attr.ct1.value formatName="short"/}

    but it doesn’t work. Try it yourself and you will see that it doesn’t actually work.

    Mo0nlight Moderator
    #1047143

    Hi.

    The developer is currently making the display custom field functionally.

    You can wait for the new release or post your site link and ftp account so we will custom for you.

    thesdhotel Friend
    #1047260

    Hello, you can use the same site info you find here: https://www.joomlart.com/forums/topic/description-transition-sorting-by-date-avoid-resizing-big-image/page/2/ (which by the way, do you have any update on that too?)

    You can use that same site for testing.

    Thanks

    • This reply was modified 7 years, 5 months ago by  thesdhotel.
    thesdhotel Friend
    #1049071

    Hello,
    Do you have any update?
    Thank you

Viewing 15 posts - 1 through 15 (of 17 total)

This topic contains 17 replies, has 3 voices, and was last updated by  thesdhotel 7 years, 5 months ago.

The topic ‘Customize "Date Format" of a Date Custom Field in product-item layout’ is closed to new replies.