Start and end date for catalog item
Hi,
I want to set up a menu system for a restaurant and want to use the catalog module over pages as i can customise the required fields for the site admin so he only has certain sections to edit. This will make it a lot simpler to add and edit food menus.
Is there any way you can set a start and end date for a catalog item? maybe using the date field and then filtering it or something in the module?
Thanks
Ben
Re: Start and end date for catalog item
you just enter them as two fields and then you can create your own filtering based on that in the CONDITION area, e.g.
startdate<NOW() AND stopdate>NOW()
This is all SQL (not PHP). This will automatically PRE-filter your list for items between start and stop dates.
Re: Start and end date for catalog item
Thanks for the quick responce. will give that a go.
Cheers
Ben
Re: Start and end date for catalog item
Seems like today is my big catalog questions day!
And it also seems like I´m following ben´s path.
Tosca, did you get this running?
In the condition field I´ve entered:
but when I save it automatically deletes the "<NOW".
I want to display all Items with a startdate of today or later.
http://idisk.me.com/ruhry/Public/Pic...223-114310.jpg
Re: Start and end date for catalog item
A condition has an = sign in it, eg.
event_date<=NOW()
Re: Start and end date for catalog item
Quote:
Originally Posted by thyon
event_date<=NOW()
If tried this already and now again. Whenever I enter this line in the "Condition Field" and click on "Save", this line turns into
Any clue why?
Re: Start and end date for catalog item
I managed to get it working by using this:
FROM_UNIXTIME(service_date_date) > NOW()
will try the new way Thyon has just posted
Re: Start and end date for catalog item
okay, with this line it worked. thanks.
do you also now, how i can highlight an event with that is today?
something like
Code:
FROM_UNIXTIME(event_date) = NOW()
didn´t work for me.
Re: Start and end date for catalog item
You could try doing a not before today and not after tomorrow condition. This would just events happening today.
these definitions may help: http://dev.mysql.com/doc/refman/5.1/...functions.html
I'm not an expert in PHP or MySQL but through trial and error and some help usually get somethign working.
Ben
Re: Start and end date for catalog item
You can try CURDATE() as it returns this: '2009-12-23' insted of NOW() which also returns the time, causing the problem you have.
Re: Start and end date for catalog item
you could have also created your events using the TL event calendar and used this as a reference link to your DJs, etc. by adding fields for them to the events calendar. Creating your own catalog is really a toss-up between making your own app for TL or using catalog, because if it gets complex, you were better off making your own app, than trying to pigeon-hole the catalog to work for all occasions.
Re: Start and end date for catalog item
I´m having a similar problem right now and tried a few things - but without success.
I have a List of Catalog - Items (Simple Table) - Every Item has a Date Field.
Now I want to create a Condition which tells my Modul in the Front End to show only the Items of the present month.
How do I do that?
I tried things like that in the Condition Field:
FROM_UNIXTIME(event_date) = CURMONTH()
(event_date) = CURMONTH()
(event_date) = MONTH()
nothing worked for me. Probably a small thing - maybe somebody knows the right piece of code.
Re: Start and end date for catalog item
Try something like
Code:
MONTH(FROM_UNIXTIME(event_date)) = MONTH(NOW()) AND YEAR(FROM_UNIXTIME(event_date)) = YEAR(NOW())
Although I think that calculating timestamp of the first day in month and first day of the following month and using BETWEEN would be much more efficient :)
Re: Start and end date for catalog item
thanks scare, works like a charme.
Just one question. Does this also show passed event´s of a month?
e.g.: today is the 5th april and there was an event yesterday. will it be displayed? the problem is i´d have to wait untill tomorrow to see what happens - since it´s the frist of march now! ;-)
Re: Start and end date for catalog item
It should display all events from the current month, it ignores the day completely, so only month and year matter. Of course you need to test it :) You may try to substitute NOW() with tomorrow's date to see if today's events are displayed.
Re: Start and end date for catalog item
okay, this works great.
have a look here:
http://grazjazz.at.dd14304.kasserver.co ... sicht.html
can i bother you with another question?
how would i make a list fot the next month? I´m thinking about presenting the present and the coming month...
best regards,
valentin
Re: Start and end date for catalog item
OK, I'm writing this from my head so don't complain if it doesn't work :) Test every step below in some phpmyadmin or similar program to see if it gives correct results.
We need to find the first day of the next month (should return something like 2010-04-01):
Code:
select DATE_ADD(LAST_DAY(NOW()), INTERVAL 1 DAY)
And the first day of the month following the next month (2010-05-01):
Code:
select DATE_ADD(DATE_ADD(LAST_DAY(NOW()), INTERVAL 1 DAY), INTERVAL 1 MONTH)
Now we just need to select dates between those two dates (+ convert it to unix timestamp), so the result should be something like this:
Code:
event_date >= UNIX_TIMESTAMP(DATE_ADD(LAST_DAY(NOW()), INTERVAL 1 DAY)) AND event_date < DATE_ADD(DATE_ADD(LAST_DAY(NOW()), INTERVAL 1 DAY), INTERVAL 1 MONTH))
Re: Start and end date for catalog item
thanks, I´ll give it a try - but first I have to solve the problem here:
viewtopic.php?f=27&t=1325