Carousel 210.2. Setting a Go-Live date for an image Carousel Slide

Index of carousel articles

Index of articles on Image Carousels

Purpose

@markb of ModelRailwaysDirect set up their sales in advance. These sales are highlighted using the home page slider. Rather than having to get up in the middle of the night to add a special carousel image linking to the sale items it was suggested that it be made possible to set a go-live time on image carousel slides.

How to Implement

Clicking on the little clock icon in an image carousel will bring up a modal window allowing you to set the date and time that you want your image to go live.

Each slide can be set independently. If you want to see something where the slider is going to be ensure you have at least one slide set to be visible. If you don’t set a time then the store assumes you want the slide to be visible.

Go-Dead

It is also possible to set a time after which you no longer want the slide to show. If this is not set then the slide will remain visible.

Timezone

By default your store is set to UTC, also known as Greenwich Mean Time. There is an option that allows you to change this to something more suitable if your store only serves a local area. The date and time interface take this into account and will give an estimate till the slide will become visible on your store.

Be careful changing your timezone, this option is already used for various shipping options.

Caching

To speed up your store we cache elements that require a lot of calculation to build. Carousels are one of these elements. This cache is reset every time your store syncs. You will find that this caching will upset any attempt a setting your go-live or go-dead slide too precisely. You will find that your triggers will only operate after the sync that comes after your trigger.

Hi James,

It would be great to see a time option offered as Nitroscript variable much like what you have done here. Ideally we would be able to query the time, date (or both), or set intervals to activate/deactivate entire blocks of code based on the day, month, time etc.

I for one am tired of waking at all hours of the morning to change banners etc which are no longer on special.

If you wanted to take it a step further you should also consider keeping track of sale items within the WMS so that these too could be reverted to the standard price after a set date or time.

cheers.
Andy.

Andy

have you had a look at this post? The part about {printStoreTimeComponent()} should do what you are looking for.

If you need the unix timestamp let me know and I should be able to make a handy NitroScript that does that.

As for the sales price, RMS provides a way of specifying a start date and end date to a sale. With a little creative mapping you should be able to set the price of a product to modify. Digging through old KB articles I found this:

CASE WHEN (SaleType=1 AND GETDATE() BETWEEN ISNULL(SaleStartDate,GETDATE()) AND ISNULL(SaleEndDate+1,GETDATE()) AND SalePrice > 0) THEN SalePrice WHEN PAM_websaleprice > 0 and PAM_websaleprice<Price THEN PAM_websaleprice ELSE Price end

Caveat emptor as I didn’t try it out :slight_smile:

James

Hi Andy and James

We use the code as given by James, however we also add “WHEN(quantity-quantitycommitted>0) and” at the beginning of the case so that prices increase when we have sold out of the item. Has been working well for several years.

Mark