How to display Date Attribute?
Permalink 4 users found helpful
After creating a custom attribute of the type Date/Time........
how do you get it to show on a page??
getAttributeValue??
DisplayValue???
I am trying to arrive at something of this sort:
$cobj->getCollectionDatePublic('F j, Y');
but for a custom attribute of a page and not for the Date Public of the page.....
thanks
how do you get it to show on a page??
getAttributeValue??
DisplayValue???
I am trying to arrive at something of this sort:
$cobj->getCollectionDatePublic('F j, Y');
but for a custom attribute of a page and not for the Date Public of the page.....
thanks
+1
I am also looking something like this....
Any help will be appreciated.
I am also looking something like this....
Any help will be appreciated.
You could try this.
Are you trying to display a custom attribute in a template file?
$c->getCollectionAttributeValue('attribute_name')
Are you trying to display a custom attribute in a template file?
Hello MrKDilkington,
Thanks for reply, i have create date attribute and i want that when i select this attribute via custome attributes i want to alert selected date in this format " YYYY,MM,DD" but below code only alert "year"
Thanks for reply, i have create date attribute and i want that when i select this attribute via custome attributes i want to alert selected date in this format " YYYY,MM,DD" but below code only alert "year"
The problem is you are missing a set of quotes in the alert.
As a side note - type="text/javascript" is not required in <script> tags, by default the type will be JavaScript.
As a side note - type="text/javascript" is not required in <script> tags, by default the type will be JavaScript.
Hello MrKDilkington,
Thanks a lottt. It works for me.
Thanks a lottt. It works for me.
Hi MrKDilkington,
One more question hope you can help me....
I have place below code to add attribute via controller...actually i only require "Date " field not Hour,Min, AM-PM field so is this possible only i can add "Date" Field...
One more question hope you can help me....
I have place below code to add attribute via controller...actually i only require "Date " field not Hour,Min, AM-PM field so is this possible only i can add "Date" Field...
$mydate = CollectionAttributeKey::getByHandle('mydate1'); if (!$commingdate instanceof CollectionAttributeKey) { $commingdate = CollectionAttributeKey::add("date", array( 'akHandle' => 'mydate1', 'akName' => t('Date1')), $pkg); }
Sorry, i have change my code...
$mydate = CollectionAttributeKey::getByHandle('mydate1'); if (!$mydate instanceof CollectionAttributeKey) { $mydate = CollectionAttributeKey::add("date", array( 'akHandle' => 'mydate1', 'akName' => t('Date1')), $pkg); }
I am afraid I don't have experience doing this.
Maybe someone else will know.
Maybe someone else will know.
Hi ,
Don't be afraid :), thanks for the reply...
Don't be afraid :), thanks for the reply...
Hello MrKDilkington,
I got the answer, here it is, hope it will help someone too...
Just adding below array, we can get only date picker instead or date and time...
I got the answer, here it is, hope it will help someone too...
Just adding below array, we can get only date picker instead or date and time...
'akDateDisplayMode' => 'date'
$mydate = CollectionAttributeKey::getByHandle('mydate1'); if (!$mydate instanceof CollectionAttributeKey) { $mydate = CollectionAttributeKey::add("date", array( 'akHandle' => 'mydate1', 'akName' => t('Date1'), 'akDateDisplayMode' => 'date'), $pkg); }
?