Source of file FlatFeeShippingModifierField.php
Size: 3,267 Bytes - Last Modified: 2021-12-23T10:48:05+00:00
/var/www/docs.ssmods.com/process/src/code/FlatFeeShippingModifierField.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 | <?php /** * Form field that represents {@link FlatFeeShippingRate}s in the Checkout form. * * @author Frank Mullenger <frankmullenger@gmail.com> * @copyright Copyright (c) 2011, Frank Mullenger * @package swipestripe * @subpackage shipping */ class FlatFeeShippingModifierField extends ModificationField_Hidden { /** * The amount this field represents e.g: 15% * order subtotal * * @var Money */ protected $amount; /** * Render field with the appropriate template. * * @see FormField::FieldHolder() * @return String */ public function FieldHolder($properties = array()) { Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript('swipestripe-flatfeeshipping/javascript/FlatFeeShippingModifierField.js'); return $this->renderWith($this->template); } /** * Set the amount that this field represents. * * @param Money $amount */ public function setAmount(Price $amount) { $this->amount = $amount; return $this; } /** * Return the amount for this tax rate for displaying in the {@link CheckoutForm} * * @return String */ public function Description() { return $this->amount->Nice(); } /** * Shipping field modifies {@link Order} sub total by default. * * @return Boolean True */ public function modifiesSubTotal() { return true; } } class FlatFeeShippingModifierField_Multiple extends ModificationField_Dropdown { /** * The amount this field represents e.g: 15% * order subtotal * * @var Money */ protected $amount; /** * Render field with the appropriate template. * * @see FormField::FieldHolder() * @return String */ public function FieldHolder($properties = array()) { Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript('swipestripe-flatfeeshipping/javascript/FlatFeeShippingModifierField.js'); return $this->renderWith($this->template); } /** * Set the amount that this field represents. * * @param Money $amount */ public function setAmount(Price $amount) { $this->amount = $amount; return $this; } /** * Return the amount for this tax rate for displaying in the {@link CheckoutForm} * * @return String */ public function Description() { return $this->amount->Nice(); } /** * Shipping field modifies {@link Order} sub total by default. * * @see ModificationField_Dropdown::modifiesSubTotal() * @return Boolean True */ public function modifiesSubTotal() { return true; } } class FlatFeeShippingModifierField_Extension extends Extension { public function updateFields($fields) { Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript(THIRDPARTY_DIR . '/jquery-entwine/dist/jquery.entwine-dist.js'); Requirements::javascript('swipestripe-flatfeeshipping/javascript/FlatFeeShippingModifierField.js'); } } |