Catalog List display in FE not sorting
I've defined in the Catalog BE Module the sort "Order by" as FROM_UNIXTIME(date_spotted) DESC
[attachment=1:evsy9vnv]Catalog sort BE.jpg[/attachment:evsy9vnv]
but in the FE the order is not sorted
[attachment=0:evsy9vnv]Catalog sort FE.jpg[/attachment:evsy9vnv]
I did initially define just date_spotted DESC but that didn't work either. All dates are being displayed correctly in Lists and Edit screens.
Does the Order By only effect the BE? If so, how do I sort the FE?
Re: Catalog List display in FE not sorting
Solved!
Initially the dates were stored as numeric values but after I implement the calendarfield extension (which provides a calendar picker widget) the dates have been stored as characters yyyy-mm-dd. So I had a mix of formats.
[attachment=0:127pllbc]date created.jpg[/attachment:127pllbc]
I have now converted all the dates to character form and the "order by date_spotted DESC" is working fine.
Luckily I only had a few test records, but this would be a nasty extension to implement if the database had substantial number of records.
Re: [SOLVED] Catalog List display in FE not sorting
Hi Alan_uk,
i don't know the extension you use for that.. but the extension must be fixed for that.. it is not normal that the date is saved normal. Normaly it will be saved in unix time stamp.
regards
Re: [SOLVED] Catalog List display in FE not sorting
Hi MacKP
You're right. It's not solved. I uploaded to my ISP and then discovered that once again I had mixed dates: some numeric (12334457) and some text (2010-06-09).
The problem is I am using a mix of solutions: Form Generator / Add for creating and Catalog / Edit for updating. Add stores the dates as text and Edit as numeric (I think that is the right way round). The reason for mix solutions is the Add sets some hidden fields like user id using tags.
I'm also using calendarfield with a format of Y-m-d. A note against the form field says it "The date format string will be parsed with the PHP date() function"
The date fields are varchar(10) - I would think they should be int(10).
I need to experiment some more. Maybe change the schema to int(10)
Thanks for your help and patience.
Re: [SOLVED] Catalog List display in FE not sorting
can't you just change the Catalog Edit Module and enter the hidden fields directly into the template, since Templates honour inserttags, instead of having to resort another solution just to do that...
Re: [SOLVED] Catalog List display in FE not sorting
I did try that thyon and it didn't work but as it was some months ago I cannot remember what I tried. But I will give it another go ........
The 3 hidden fields are set in the Form Generator Add form as
creator {{user::firstname}}
user id {{user::id}}
created date {{date::U}}
I now recall what I tried. In Catalog I set the Catalog / Field / Advance / Default value to the above tags. Then added a record but none of the fields were set - all blank or null.
I also tried the Edit Module and presumed I need to set the Restricted Fields. I set the to the tags above. As the fields are not user editable they are not selected in the Editable Fields list. But as soon as I saved the BE form the Created date in the BE form was changed to 1999-11-30.
I then added a record and found the database fields had the values {{user::firstname}} , 0 (zero) and {{date::U}
I then made the fields Editable (thinking if this worked I could make them hidden using CSS)
I then added a record and found the database fields had the values <blank>, 0 (zero) and 1278979200
As you see I did try ;) I've just repeated all this again and got the same result.
Please advise where I am going wrong.
Re: Catalog List display in FE not sorting
Hi thyon
have you had a chance to see where I'm going wrong? - see previous post
Many thanks
Re: Catalog List display in FE not sorting
I didn't write the Catalog Edit module, so you'll have to ask xtra...