/** * Add shipping region code dropdown to form. * @return FieldList */ public function getFormFields() { $fields = new FieldList(); if ($shippingRegion = $this->Region()) { $field = new StreakRegionShippingModifierField($this, $this->Description, $shippingRegion->ID); /** @var Price $price */ $price = Price::create(); $price->setAmount($this->Price); $field->setAmount($price); $fields->push($field); } if (!$fields->exists()) { Requirements::javascript('swipestreak-regionalshipping/javascript/RegionalShippingModifierField.js'); } return $fields; }
/** * Get the form fields for the OrderForm. * * @return FieldList List of fields */ public function getFormFields() { $fields = new FieldList(); $field = new XeroTaxModifierField($this, _t('Xero.TAX', 'Tax')); $shopConfig = ShopConfig::current_shop_config(); $amount = new Price(); $amount->setAmount($this->Price); $amount->setCurrency($shopConfig->BaseCurrency); $amount->setSymbol($shopConfig->BaseCurrencySymbol); $field->setAmount($amount); $fields->push($field); if (!$fields->exists()) { Requirements::javascript('swipestripe-flatfeetax/javascript/FlatFeeTaxModifierField.js'); } return $fields; }
public function getFormFields() { $fields = new FieldList(); $rate = $this->FlatFeeTaxRate(); $countryID = $rate && $rate->exists() ? $rate->CountryID : null; $rates = $countryID ? $rates = FlatFeeTaxRate::get()->where("\"CountryID\" = '{$countryID}'") : null; if ($rates && $rates->exists()) { $field = new FlatFeeTaxModifierField($this, $rate->Label(), $rate->ID); //Set the amount for display on the Order form $field->setAmount($rate->Price($this->Order())); $fields->push($field); } if (!$fields->exists()) { Requirements::javascript('swipestripe-flatfeetax/javascript/FlatFeeTaxModifierField.js'); } return $fields; }
public function getFormFields() { $fields = new FieldList(); $rate = $this->FlatFeeShippingRate(); $rates = $this->getFlatShippingRates($rate->Country()); if ($rates && $rates->exists()) { if ($rates->count() > 1) { $field = FlatFeeShippingModifierField_Multiple::create($this, _t('FlatFeeShippingModification.FIELD_LABEL', 'Shipping'), $rates->map('ID', 'Label')->toArray())->setValue($rate->ID); } else { $newRate = $rates->first(); $field = FlatFeeShippingModifierField::create($this, $newRate->Title, $newRate->ID)->setAmount($newRate->Price()); } $fields->push($field); } if (!$fields->exists()) { Requirements::javascript('swipestripe-flatfeeshipping/javascript/FlatFeeShippingModifierField.js'); } return $fields; }