Sunnysideup\EcommerceAnyPriceProduct\Modifiers\AnyPriceRoundUpDonationModifier
add a donation rounding up to the next round number.
- Author: Nicolaas [at] sunnysideup.co.nz
Synopsis
class AnyPriceRoundUpDonationModifier
extends OrderModifier
{
- // members
- private static array $db = ;
- private static string $singular_name = "Round Up Donation";
- private static string $plural_name = "Round Up Donations";
- private static Int $precision = 1;
- private static Int $maximum_round_up = 5;
- private static boolean $round_up_even_if_there_is_nothing_to_round = true;
- private static boolean $include_form_in_order_table = true;
- private static $table_sub_title;
- // methods
- public void getCMSFields()
- public void i18n_singular_name()
- public void i18n_plural_name()
- public void runUpdate()
- public void updateAddDonation()
- public void updateOtherValue()
- public void ShowForm()
- public Boolean ShowFormInEditableOrderTable()
- public Object getModifierForm()
- public Boolean ShowInTable()
- public Boolean CanBeRemoved()
- protected Boolean hasDonation()
- protected Float workOutRoundUpAmount()
- protected void LiveName()
- protected Boolean LiveAddDonation()
- protected Float LiveOtherValue()
- protected float LiveSubTotal()
- protected float LiveModifierTotalExcludingDonation()
- protected void LiveCalculatedTotal()
- public void LiveTableValue()
- public void getTableSubTitle()
- public void onBeforeWrite()
- public Boolean HideInAjaxUpdate()
Hierarchy
Extends
- Sunnysideup\Ecommerce\Model\OrderModifier
Members
private
-
$db
add extra fields as you need them. - $include_form_in_order_table
- $maximum_round_up
—
Sunnysideup\EcommerceAnyPriceProduct\Modifiers\Int
Maximum Round Up - modifier will ensure that the round up is no more than the number specified here. - $plural_name
- $precision
—
Sunnysideup\EcommerceAnyPriceProduct\Modifiers\Int
Maximum Round Up to which the donation should round. - $round_up_even_if_there_is_nothing_to_round
- $singular_name
- $table_sub_title
Methods
protected
- LiveAddDonation()
- LiveCalculatedTotal()
- LiveModifierTotalExcludingDonation() — Work out modifier total excluding donation
- 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.
- LiveOtherValue()
- LiveSubTotal() — Work out sub total amount for order
- hasDonation() — Works out if there is a donation at all.
- workOutRoundUpAmount() — Works out the total round up amount, using both the sub-total and the modifier total.
public
- CanBeRemoved() — Removed via form instead.
- 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?
- ShowInTable() — This has to be set to true, because it can be added by form using AJAX.
- getCMSFields()
- getModifierForm() — standard OrderModifier Method This method returns the form for the checkout page.
- getTableSubTitle()
- i18n_plural_name()
- i18n_singular_name()
- onBeforeWrite()
- runUpdate() — For all modifers with their own database fields, we need to include this...
- updateAddDonation() — allows you to save a new value AddDonation
- updateOtherValue() — allows you to save a new value OtherValue