當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FieldSet::exists方法代碼示例

本文整理匯總了PHP中FieldSet::exists方法的典型用法代碼示例。如果您正苦於以下問題:PHP FieldSet::exists方法的具體用法?PHP FieldSet::exists怎麽用?PHP FieldSet::exists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FieldSet的用法示例。


在下文中一共展示了FieldSet::exists方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getFormFields

 /**
  * Form fields for displaying on the Checkout form, a {@link FlatFeeTaxField} that has
  * a hidden field with an ID for the {@link FlatFeeTaxRate} and a description of 
  * how much the calculated tax amounts to for the current {@link Order}.
  * 
  * @see FlatFeeShippingRate
  * @see Modifier::combined_form_fields()
  * @param Order $order
  * @return FieldSet
  */
 public function getFormFields($order)
 {
     //TODO use SiteConfig object to get the countries back, but at the moment
     //SiteConfig ID not being set correctly on country db rows
     $fields = new FieldSet();
     //Get tax rate based on shipping address
     $shippingCountryID = null;
     if ($order && $order->exists()) {
         $shippingAddress = $order->ShippingAddress();
         if ($shippingAddress) {
             $shippingCountryID = $shippingAddress->CountryID;
         }
     }
     if ($shippingCountryID) {
         $flatFeeTaxRate = DataObject::get_one('FlatFeeTaxRate', "CountryID = '{$shippingCountryID}'");
         if ($flatFeeTaxRate && $flatFeeTaxRate->exists()) {
             $flatFeeTaxField = new FlatFeeTaxField($this, $flatFeeTaxRate->Label(), $flatFeeTaxRate->ID);
             //Set the amount for display on the Order form
             $flatFeeTaxField->setAmount($this->Amount($order, $flatFeeTaxField->Value()));
             $fields->push($flatFeeTaxField);
         }
     }
     //Include the js for tax fields in either case
     if (!$fields->exists()) {
         Requirements::javascript('swipestripe/javascript/FlatFeeTaxField.js');
     }
     return $fields;
 }
開發者ID:helpfulrobot,項目名稱:swipestripe-swipestripe,代碼行數:38,代碼來源:FlatFeeTax.php


注:本文中的FieldSet::exists方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。