Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Create two pages titled “deal-of-the-week” and “deal-of-the-week-sold”

  2. On “deal-of-the-week”, add a promotion snippet with the following values:

    1. SoldPage – “deal-of-the-week-sold”

    2. ItemTemplate – “UnitPromotion.cshtml” or a custom template if the dealer has one set up.

    3. PromotionTypeId – Place the ID of the Deal of the Week promotion listed in the “Promotions” tab of ICC.

  3. On “deal-of-the-week” add the following scripts to the footer.

    1. Code Block
      <script src="https://assets-cdn.interactcp.com/interactrv/js/common_netcore/countdown.js" type="text/javascript"></script>

      b.

      Code Block
      <script type="text/javascript">$('.dow-unit-content.hidden').removeClass('hidden');</script>

      c.

      Code Block
      <script>// <!--CDATAOPENTAG--> $(function () {
      
      $('.dow-countdown-large').each(function() {
      
      var endDay = new Date($(this).attr('data-end-date'));
      
      $(this).countdown({until: endDay});
      
      });
      
      });
      
      // <!--CDATACLOSETAG--></script>

Variations

Deal of the Week - Synced Version

The variation of the above script makes an AJAX call to /deal-of-the-week to get the countdown end date value. If the value cannot be found, the countdown will default to manually specified parameter. Place this script on the page that hosts the countdown element linking to /deal-of-the-week.

Code Block
<script>
    $(function () {
        function getNextDayOfWeek(date, dayOfWeek) {
            var resultDate = new Date(date.getTime());
            resultDate.setDate(date.getDate() + (7 + dayOfWeek - date.getDay() - 1) % 7 +1);
            resultDate.setHours(0,0,0,0);
            return resultDate;
        }
        var date = new Date();
        var dayOfWeek = 2;
        var until = getNextDayOfWeek(date, dayOfWeek);
        console.log(until);
        $(document).ready(function () {
            const xhttp = new XMLHttpRequest();
            const ajaxURL = "/deal-of-the-week"
            xhttp.onload = function () {
                var unitCountdown = $($.parseHTML(this.responseText)).find(".dow-unit-countdown")
                var unitCountdownVal
                if (unitCountdown.length > 0) {
                    unitCountdownVal = new Date(unitCountdown.data("end-date"));
                    console.log("Found Countdown end value on " + ajaxURL + ": " + unitCountdownVal);
                    $('#defaultCountdown').countdown({ until: unitCountdownVal, format: 'dHMS' });
                }
                else {
                    console.log("Countdown value not found. Defaulting to " + unitCountdownVal);
                    $('#defaultCountdown').countdown({ until: until, format: 'dHMS' });
                }

            }
            xhttp.open("GET", ajaxURL, true);
            xhttp.send();
        })
    });
</script>

We can also do a Deal of the Month. See Chesaco RV for an example.

Deal of the Month

Place this script on the page that holds the countdown and link to the /deals-of-the-month page.
Note that this version needs to be manually synced with the dates on /deals-of-the-month.

Code Block
<!-- Deal of the Month Modification -->
<script>
    $(function () {
        function getEndOfMonthDay() {
            var date = new Date();
            var month_offset = 1; //Number of month to offset the current month by
            var days_offset = 8; //Number of days to offset the first date of the month
            var hours_offset = 1; //Number of hours to offset from midnight
            date = new Date(date.getFullYear(), date.getMonth() + month_offset, days_offset, hours_offset);
            return date
        }
        
        var newMonth = getEndOfMonthDay();
        $('#defaultCountdown').countdown({until: newMonth, format: 'dHMS'});
    });

</script>

Deal of the Month - Synced Version

The variation of the above script makes an AJAX call to /deals-of-the-month to get the countdown end date value. If the value cannot be found, the countdown will default to manually specified parameter. Place this script on the page that hosts the countdown element linking to /deals-of-the-month.

...