\ModifierExample
as a starting point for writing their own modifiers.
- Author: Nicolaas [at] sunnysideup.co.nz
Synopsis
class ModifierExample
extends OrderModifier
{
- // members
- public static array $db = ;
- public static string $singular_name = "Modifier Example";
- public static string $plural_name = "Modifier Examples";
- // methods
- public void getCMSFields()
- public void i18n_singular_name()
- public void i18n_plural_name()
- public void runUpdate()
- public void updateMyField()
- public void updateMyReduction()
- public void ShowForm()
- public Boolean ShowFormInEditableOrderTable()
- public Boolean ShowFormOutsideEditableOrderTable()
- public Object getModifierForm()
- public Boolean ShowInTable()
- public Boolean CanBeRemoved()
- protected void LiveName()
- protected void LiveMyField()
- protected void LiveMyReduction()
- protected void LiveCalculatedTotal()
- public void LiveTableValue()
- public void onBeforeWrite()
- public void onBeforeRemove()
- public Boolean HideInAjaxUpdate()
Hierarchy
Extends
- OrderModifier
Members
public
-
$db
add extra fields as you need them. - $plural_name
- $singular_name
Methods
protected
- LiveCalculatedTotal()
- LiveMyField()
- LiveMyReduction()
- LiveName() — if we want to change the default value for the Name field (defined in the OrderModifer class) then we can do this as shown in the method below.
public
- CanBeRemoved() — standard OrderModifer Method Tells us if the modifier can be removed (hidden / turned off) from the order.
- HideInAjaxUpdate() — some modifiers can be hidden after an ajax update (e.g. if someone enters a discount coupon and it does not exist).
- LiveTableValue()
- ShowForm() — standard OrderModifier Method Should we show a form in the checkout page for this modifier?
- ShowFormInEditableOrderTable() — Should the form be included in the editable form on the checkout page?
- ShowFormOutsideEditableOrderTable() — Should the form be included in the editable form on the checkout page?
- ShowInTable() — standard OrderModifer Method Tells us if the modifier should take up a row in the table on the checkout page.
- getCMSFields() — standard SS method
- getModifierForm() — standard OrderModifier Method This method returns the form for the checkout page.
- i18n_plural_name()
- i18n_singular_name()
- onBeforeRemove()
- onBeforeWrite()
- runUpdate() — For all modifers with their own database fields, we need to include this...
- updateMyField() — allows you to save a new value to MyField
- updateMyReduction() — allows you to save a new value to MyReduction