Order Prducts by custom date field

  • Posts: 40
  • Thank you received: 0
11 years 9 months ago #123805

Hi,

I'm working with Joomla 2.5 and the latest version of hikahsop business.

The shop sells places on courses. I have a custom field for the start date and an optional custom field for the end date. On the listing page I would like to display them in date order. I have set the ordering up to use that field, however it's treating it as a text string, rather than as a date or datetime field, for exmaple, I have 3 events taking place on 03-04-2014, 05-05-2014 and 04-06-2014 tey will be displayed in the following order: (ordering set to ascending)

03-04-2014
04-06-2014
05-05-2014

As you would expect from a text string.

Is there a way that the date field type in custom fields can be made to behave as a date field, perhaps with a strtotime() and strfrtime() either site of the queries?

If I've missed something, please point me in the right direction.

Thanks :)

Last edit: 11 years 9 months ago by simonbornhoft.

Please Log in or Create an account to join the conversation.

  • Posts: 26253
  • Thank you received: 4040
  • MODERATOR
11 years 9 months ago #123860

Hi,

The "date" custom field has been added in HikaShop 1.0 and in this version we didn't have all feature that we have now.
That's why this field store the date in text mode.
We are thinking about create a new "date" custom field and keep this old for retro-compatibility.
But this is not a very small development and we want to make it in the good way.

For the moment, if you want to sort by this field, you have to change the date display in order to have year-month-day.
At this moment, HikaShop will be able to sort dates correctly.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: simonbornhoft

Please Log in or Create an account to join the conversation.

  • Posts: 40
  • Thank you received: 0
11 years 9 months ago #123861

Hi Jerome,

Thanks for coming back to me.

That might work, and I can simply explode the string and flip the order to keep it looking the same to visitors.

Definitely a +1 from me for a new 'proper' date field though. :)

Cheers

Please Log in or Create an account to join the conversation.

Time to create page: 0.055 seconds
Powered by Kunena Forum