Product of the Month box.

2 posts by 2 authors in: Forums > CMS Builder
Last Post: June 26, 2008   (RSS)

By steve_e - June 26, 2008

Hi -
Rather than produce a list page from which each record can be linked to, I would like to have a regularly changing record displayed in a box on a page as a 'product of the month'.

So for example, various fields in a new record will describe the product, have an image of it and provide links to the vendor's website. It will also have start and end dates (eg 1st to 31st July). A number of these may be set up in advance, but only the one for that particular month should show up as the 'current' item. Does that make sense? I'm not sure if that's really easy and I'm just not looking at the problem correctly, or if it's a more substantial challenge?

You can see the kind of thing in the box on the right hand side of this page:

http://www.foundation-stage.info/newfsf/articles/ReviewIndex.php

The content of the box is taken from a CMS builder section record, but I can't figure out how to set it up so that it changes at the end of every month. Hope that all makes sense!

[:)]

Re: [steve_e] Product of the Month box.

By Dave - June 26, 2008

Hi Steve,

There's a few features you can put together to make this work.

You can automatically have records show and be hidden with the special fields 'publishDate' and 'removeDate'. Create date fields for those. You can read more about special fields here: http://www.interactivetools.com/docs/cmsbuilder/special_fieldnames.html

Once that's done, your list should only show records within the date range, but you only want to show one, so add this to your viewer code (in red):

list($yourRecords, $yourDetails) = getRecords(array(
'tableName' => 'yourTable',
'limit' => '1',
));


And that will only show the first result. So in the event that you do have more than one product setup for a date range it will just show one.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com