Results 1 to 18 of 18

Thread: Start and end date for catalog item

  1. #1
    User
    Join Date
    06-20-09.
    Location
    Middlesbrough, UK
    Posts
    246

    Default 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
    360fusion: Virtual Tours - Web Design
    Social Media: Twitter - Facebook Page

  2. #2
    Experienced user
    Join Date
    06-11-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default 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.

  3. #3
    User
    Join Date
    06-20-09.
    Location
    Middlesbrough, UK
    Posts
    246

    Default Re: Start and end date for catalog item

    Thanks for the quick responce. will give that a go.

    Cheers
    Ben
    360fusion: Virtual Tours - Web Design
    Social Media: Twitter - Facebook Page

  4. #4
    User
    Join Date
    07-13-09.
    Posts
    83

    Default 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:

    Code:
    event_date<NOW()
    but when I save it automatically deletes the "<NOW".
    I want to display all Items with a startdate of today or later.


  5. #5
    Experienced user
    Join Date
    06-11-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Start and end date for catalog item

    A condition has an = sign in it, eg.

    event_date<=NOW()

  6. #6
    User
    Join Date
    07-13-09.
    Posts
    83

    Default 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
    Code:
    event_date<=NOW()
    Any clue why?

  7. #7
    User
    Join Date
    06-20-09.
    Location
    Middlesbrough, UK
    Posts
    246

    Default 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
    360fusion: Virtual Tours - Web Design
    Social Media: Twitter - Facebook Page

  8. #8
    User
    Join Date
    07-13-09.
    Posts
    83

    Default 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.

  9. #9
    User
    Join Date
    06-20-09.
    Location
    Middlesbrough, UK
    Posts
    246

    Default 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
    360fusion: Virtual Tours - Web Design
    Social Media: Twitter - Facebook Page

  10. #10
    Experienced user
    Join Date
    06-11-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default 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.

  11. #11
    Experienced user
    Join Date
    06-11-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default 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.

  12. #12
    User
    Join Date
    07-13-09.
    Posts
    83

    Default 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.

  13. #13
    User
    Join Date
    06-19-09.
    Location
    Kosice, Slovakia
    Posts
    61

    Default 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
    S.C.A.R.E

  14. #14
    User
    Join Date
    07-13-09.
    Posts
    83

    Default 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! ;-)

  15. #15
    User
    Join Date
    06-19-09.
    Location
    Kosice, Slovakia
    Posts
    61

    Default 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.
    S.C.A.R.E

  16. #16
    User
    Join Date
    07-13-09.
    Posts
    83

    Default 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

  17. #17
    User
    Join Date
    06-19-09.
    Location
    Kosice, Slovakia
    Posts
    61

    Default 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))
    S.C.A.R.E

  18. #18
    User
    Join Date
    07-13-09.
    Posts
    83

    Default 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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •