-
AuthorPosts
-
Luna Garden Moderator
Luna Garden
- Join date:
- July 2011
- Posts:
- 2617
- Downloads:
- 80
- Uploads:
- 96
- Thanks:
- 78
- Thanked:
- 453 times in 425 posts
June 21, 2017 at 10:26 am #10432541 user says Thank You to Luna Garden for this useful post
thesdhotel Friendthesdhotel
- Join date:
- March 2017
- Posts:
- 90
- Downloads:
- 25
- Uploads:
- 1
- Thanks:
- 31
- Thanked:
- 22 times in 20 posts
June 21, 2017 at 12:51 pm #1043289Hello, 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 ModeratorLuna Garden
- Join date:
- July 2011
- Posts:
- 2617
- Downloads:
- 80
- Uploads:
- 96
- Thanks:
- 78
- Thanked:
- 453 times in 425 posts
June 23, 2017 at 3:31 am #1043697Hi,
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.
1 user says Thank You to Luna Garden for this useful post
thesdhotel Friendthesdhotel
- Join date:
- March 2017
- Posts:
- 90
- Downloads:
- 25
- Uploads:
- 1
- Thanks:
- 31
- Thanked:
- 22 times in 20 posts
June 23, 2017 at 10:11 am #1043787Thanks! 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 ModeratorLuna Garden
- Join date:
- July 2011
- Posts:
- 2617
- Downloads:
- 80
- Uploads:
- 96
- Thanks:
- 78
- Thanked:
- 453 times in 425 posts
June 23, 2017 at 10:16 am #1043792thesdhotel Friendthesdhotel
- Join date:
- March 2017
- Posts:
- 90
- Downloads:
- 25
- Uploads:
- 1
- Thanks:
- 31
- Thanked:
- 22 times in 20 posts
June 23, 2017 at 11:16 am #1043822Ok sure! Let me know when you have the customization in the meanwhile, thanks 😀
Mo0nlight ModeratorMo0nlight
- Join date:
- September 2014
- Posts:
- 707
- Downloads:
- 38
- Uploads:
- 107
- Thanked:
- 99 times in 97 posts
June 28, 2017 at 7:51 am #1044667Hi.
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.mapTo 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.phpAdd 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.
- thesdhotel Friend
thesdhotel
- Join date:
- March 2017
- Posts:
- 90
- Downloads:
- 25
- Uploads:
- 1
- Thanks:
- 31
- Thanked:
- 22 times in 20 posts
June 28, 2017 at 3:06 pm #1044785Hello, 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 ModeratorMo0nlight
- Join date:
- September 2014
- Posts:
- 707
- Downloads:
- 38
- Uploads:
- 107
- Thanked:
- 99 times in 97 posts
June 30, 2017 at 2:39 am #1045152Hi.
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 Friendthesdhotel
- Join date:
- March 2017
- Posts:
- 90
- Downloads:
- 25
- Uploads:
- 1
- Thanks:
- 31
- Thanked:
- 22 times in 20 posts
July 3, 2017 at 6:42 am #1045609Hello, 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 ModeratorMo0nlight
- Join date:
- September 2014
- Posts:
- 707
- Downloads:
- 38
- Uploads:
- 107
- Thanked:
- 99 times in 97 posts
July 5, 2017 at 2:42 am #1046176Hi.
You could try this to show custom field value.
edit the file:
/plugins/jamegafilter/content/layouts/default/product-item.phpAdd 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.
thesdhotel Friendthesdhotel
- Join date:
- March 2017
- Posts:
- 90
- Downloads:
- 25
- Uploads:
- 1
- Thanks:
- 31
- Thanked:
- 22 times in 20 posts
July 5, 2017 at 8:13 am #1046260Sorry 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 ModeratorMo0nlight
- Join date:
- September 2014
- Posts:
- 707
- Downloads:
- 38
- Uploads:
- 107
- Thanked:
- 99 times in 97 posts
July 10, 2017 at 4:16 am #1047143Hi.
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 Friendthesdhotel
- Join date:
- March 2017
- Posts:
- 90
- Downloads:
- 25
- Uploads:
- 1
- Thanks:
- 31
- Thanked:
- 22 times in 20 posts
July 10, 2017 at 9:53 am #1047260Hello, 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 Friendthesdhotel
- Join date:
- March 2017
- Posts:
- 90
- Downloads:
- 25
- Uploads:
- 1
- Thanks:
- 31
- Thanked:
- 22 times in 20 posts
July 17, 2017 at 8:42 am #1049071Hello,
Do you have any update?
Thank youAuthorPostsThis 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.
Jump to forum