Difference between revisions of "Timed Cascade Rules"

From TMM Wiki
Jump to navigationJump to search
m
 
Line 6: Line 6:
 
}}
 
}}
  
[[NATS3]] and [[NATS4]] both offer the option to have specific [[ct#Cascade|cascades]] only be displayed at certain times of the day, which can be set by Timed Cascade Rules.
+
[[NATS3]] and [[NATS4]] both offer the option to have specific [[ct#Cascade|cascades]] only be displayed at certain times of the day, which can be set by Timed Cascade [[NATS4 Rules|Rules]].
  
 
== NATS4 ==
 
== NATS4 ==
  
To set up a Timed Cascade rule in [[NATS4]], go to the [[NATS4 Billers Admin|Billers Admin]], configure your cascades to your liking, and click the Edit Cascade [[NATS4 Rules|Rules]] icon.  
+
To set up a Timed Cascade rule in [[NATS4]], go to the [[NATS4 Billers Admin|Billers Admin]], configure your [[Ct#Cascade|cascades]] to your liking, and click the Edit Cascade [[NATS4 Rules|Rules]] icon.  
  
 
On the "Edit Cascade Rule" page, click the "Advanced Form Link" next to the "Add Cascade Rule" section to edit your rule's time-based parameters (Start Time and End Time).
 
On the "Edit Cascade Rule" page, click the "Advanced Form Link" next to the "Add Cascade Rule" section to edit your rule's time-based parameters (Start Time and End Time).
  
In the Advanced Form fields, you can use ENABLE (Show) rules and DISABLE (Hide) rules to only display this cascade during a specific time period. For example, you can offer a specific cascade only from July 10th to August 10th by entering ''2010-07-10'' in the "Start Time" field and entering ''2010-08-10'' in the "End Time" field. Enter a [[NATS4 Freeform Date|freeform date]] or time in the ''Start Time'' and ''End Time'' fields to define the start and end times for your Timed Cascade(s). When you are finished configuring your new rule, click Save New Cascade Rule to create/finish editing your rule.
+
In the Advanced Form fields, you can use ENABLE (Show) rules and DISABLE (Hide) rules to only display this [[Ct#Cascade|cascade]] during a specific time period. For example, you can offer a specific cascade only from July 10th to August 10th by entering ''2010-07-10'' in the "Start Time" field and entering ''2010-08-10'' in the "End Time" field. Enter a [[NATS4 Freeform Date|freeform date]] or time in the ''Start Time'' and ''End Time'' fields to define the start and end times for your Timed [[Ct#Cascade|Cascade(s)]]. When you are finished configuring your new [[NATS4 Rules|rule]], click Save New Cascade Rule to create/finish editing it.
  
 
[[File:Add timed cascade rule.PNG|450px|Adding a Timed Cascade Rule in NATS4]]
 
[[File:Add timed cascade rule.PNG|450px|Adding a Timed Cascade Rule in NATS4]]
Line 22: Line 22:
 
== NATS3 ==
 
== NATS3 ==
  
If you are using [[NATS3]], you can use the following PHP Code to implement a Timed Cascade Rule. This code will return a different cascade shortname at different times of the day, allowing you to switch between different Timed Cascades.
+
If you are using [[NATS3]], you can use the following PHP Code to implement a Timed Cascade Rule. This code will return a different [[Ct#Cascade|cascade]] [[Ct#Shortname|shortname]] at different times of the day, allowing you to switch between different Timed Cascades.
  
 
To use it, install the code in your [[Smarty Plugins#File_Naming_Convention|Smarty plugins directory]], create or enable two [[Hidden Cascades]], set the ''$defaultCascadeName'' and ''$specialCascadeName'' to the shortnames of your two hidden cascades, and [[Hidden Cascades#manually_Adding_a_Cascade_to_a_Join_Form|Manually add a cascade to your join form]].   
 
To use it, install the code in your [[Smarty Plugins#File_Naming_Convention|Smarty plugins directory]], create or enable two [[Hidden Cascades]], set the ''$defaultCascadeName'' and ''$specialCascadeName'' to the shortnames of your two hidden cascades, and [[Hidden Cascades#manually_Adding_a_Cascade_to_a_Join_Form|Manually add a cascade to your join form]].   
  
Use this Smarty function to set the ''value'' parameter in your cascade form.  For example:
+
Use this [[Smarty]] function to set the ''value'' parameter in your cascade form.  For example:
  
 
<pre>
 
<pre>
Line 59: Line 59:
 
[[Category:Also NATS4 Article]]
 
[[Category:Also NATS4 Article]]
 
[[Category:Credits]]
 
[[Category:Credits]]
 +
[[Category:NATS4 Billers Admin]]

Latest revision as of 10:22, 19 May 2011

NATS 4
Members Admin
The Members Admin
View Member Details
Add Member
MySQL Auth
Mod Authn DB
Multisite Access
Member Logging
Member Password Retrieval
OpenID Connect
Mod Auth OpenIDC
ID Numbers
Billers Admin
The Billers Admin
Biller
Biller Fees
Taxes
NATS Cascades
Add Cascade
Cascade Weight
Autocascade
Hidden Cascades
Geo-Targeting Cascades
Post-Biller Templates
HTTPS Gateways
Timed Cascade Rules
Upgrade Plus
Token Plus
Gateway One Step Join
Extra Biller Fields
Send Information To Special Biller
Setting Rules
Cross Sell Supported Billers
Upsell Supported Billers
Packageplus Supported Billers
Tokenplus Supported Billers
NATS 3
Billers Admin
Biller
Cascade
NATS Cascades
Adding Cascades
Biller Cancel Promotions
Cascade Weight
Autocascade
Hidden Cascades
Geo-Targeting Cascades
Type-In Cascade
Post-Biller Templates
Extra Biller Fields
HTTPS Gateways
Payment Deduction
Timed Cascade Rules
Multiple Biller Accounts
Upgrade Plus
Adding a Biller

NATS3 and NATS4 both offer the option to have specific cascades only be displayed at certain times of the day, which can be set by Timed Cascade Rules.

NATS4

To set up a Timed Cascade rule in NATS4, go to the Billers Admin, configure your cascades to your liking, and click the Edit Cascade Rules icon.

On the "Edit Cascade Rule" page, click the "Advanced Form Link" next to the "Add Cascade Rule" section to edit your rule's time-based parameters (Start Time and End Time).

In the Advanced Form fields, you can use ENABLE (Show) rules and DISABLE (Hide) rules to only display this cascade during a specific time period. For example, you can offer a specific cascade only from July 10th to August 10th by entering 2010-07-10 in the "Start Time" field and entering 2010-08-10 in the "End Time" field. Enter a freeform date or time in the Start Time and End Time fields to define the start and end times for your Timed Cascade(s). When you are finished configuring your new rule, click Save New Cascade Rule to create/finish editing it.

Adding a Timed Cascade Rule in NATS4

Note: If a disable rule and an enable rule exist at the same time, the disable rule will take precedence over the enable rule.

NATS3

If you are using NATS3, you can use the following PHP Code to implement a Timed Cascade Rule. This code will return a different cascade shortname at different times of the day, allowing you to switch between different Timed Cascades.

To use it, install the code in your Smarty plugins directory, create or enable two Hidden Cascades, set the $defaultCascadeName and $specialCascadeName to the shortnames of your two hidden cascades, and Manually add a cascade to your join form.

Use this Smarty function to set the value parameter in your cascade form. For example:

<input type="radio" name="cascade" checked="checked" value="{smarty_function_output_this_hours_cascade_name}"} />


Code

<?php
/* change the cascade based on hour of the day */
/* For more details, please see http://wiki.toomuchmedia.com/index.php/Timed_Cascade_Rules
/* NOTE : this does not check whether or not your cascades are setup properly */
/* USE AT YOUR OWN RISK -- NO WARRANTY PROVIDED */
function smarty_function_output_this_hours_cascade_name() {

    $startHour = 10;
    $endHour = 13;

    $defaultCascadeName = 'default';
    $specialCascadeName = 'default2';

    $currentTime = localtime( mktime() , 1);
    return $currentTime['tm_hour'] >= $startHour && $currentTime['tm_hour'] < $endHour ? $specialCascadeName : $defaultCascadeName;
}
?>

Credits

  • Special thanks to Nick Hahn for assistance with this article.