当前位置: 首页>>代码示例>>PHP>>正文


PHP CurrencyField::create方法代码示例

本文整理汇总了PHP中CurrencyField::create方法的典型用法代码示例。如果您正苦于以下问题:PHP CurrencyField::create方法的具体用法?PHP CurrencyField::create怎么用?PHP CurrencyField::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CurrencyField的用法示例。


在下文中一共展示了CurrencyField::create方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCMSFields

 public function getCMSFields($params = null)
 {
     //fields that shouldn't be changed once coupon is used
     $fields = new FieldList(array($tabset = new TabSet("Root", $maintab = new Tab("Main", TextField::create("Title"), CheckboxField::create("Active", "Active")->setDescription("Enable/disable all use of this discount."), HeaderField::create("ActionTitle", "Action", 3), $typefield = SelectionGroup::create("Type", array(new SelectionGroup_Item("Percent", $percentgroup = FieldGroup::create($percentfield = NumericField::create("Percent", "Percentage", "0.00")->setDescription("e.g. 0.05 = 5%, 0.5 = 50%, and 5 = 500%"), $maxamountfield = CurrencyField::create("MaxAmount", _t("MaxAmount", "Maximum Amount"))->setDescription("The total allowable discount. 0 means unlimited.")), "Discount by percentage"), new SelectionGroup_Item("Amount", $amountfield = CurrencyField::create("Amount", "Amount", "\$0.00"), "Discount by fixed amount")))->setTitle("Type"), OptionSetField::create("For", "Applies to", array("Order" => "Entire Order", "Cart" => "Cart Subtotal", "Shipping" => "Shipping Subtotal", "Items" => "Each Individual Item")), new Tab("Main", HeaderField::create("ConstraintsTitle", "Constraints", 3), LabelField::create("ConstraintsDescription", "Configure the requirements an order must meet for this discount to be valid:")), new TabSet("Constraints")))));
     if (!$this->isInDB()) {
         $fields->addFieldToTab("Root.Main", LiteralField::create("SaveNote", "<p class=\"message good\">More constraints will show up after you save for the first time.</p>"), "Constraints");
     }
     $this->extend("updateCMSFields", $fields, $params);
     if ($count = $this->getUseCount()) {
         $fields->addFieldsToTab("Root.Usage", array(HeaderField::create("UseCount", sprintf("This discount has been used {$count} time%s.", $count > 1 ? "s" : "")), HeaderField::create("TotalSavings", sprintf("A total of %s has been saved by customers using this discount.", $this->SavingsTotal), "3"), GridField::create("Orders", "Orders", $this->getAppliedOrders(), GridFieldConfig_RecordViewer::create()->removeComponentsByType("GridFieldViewButton"))));
     }
     if ($params && isset($params['forcetype'])) {
         $valuefield = $params['forcetype'] == "Percent" ? $percentfield : $amountfield;
         $fields->insertAfter($valuefield, "Type");
         $fields->removeByName("Type");
     } elseif ($this->Type && (double) $this->{$this->Type}) {
         $valuefield = $this->Type == "Percent" ? $percentfield : $amountfield;
         $fields->removeByName("Type");
         $fields->insertAfter($valuefield, "ActionTitle");
         $fields->replaceField($this->Type, $valuefield->performReadonlyTransformation());
         if ($this->Type == "Percent") {
             $fields->insertAfter($maxamountfield, "Percent");
         }
     }
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:silvershop-discounts,代码行数:26,代码来源:Discount.php

示例2: TypoForm

 function TypoForm()
 {
     $array = array('green', 'yellow', 'blue', 'pink', 'orange');
     $form = new Form($this, 'TestForm', $fields = FieldList::create(HeaderField::create('HeaderField1', 'HeaderField Level 1', 1), LiteralField::create('LiteralField', '<p>All fields up to EmailField are required and should be marked as such</p>'), TextField::create('TextField1', 'Text Field Example 1'), TextField::create('TextField2', 'Text Field Example 2'), TextField::create('TextField3', 'Text Field Example 3'), TextField::create('TextField4', ''), HeaderField::create('HeaderField2b', 'Field with right title', 2), $textAreaField = new TextareaField('TextareaField', 'Textarea Field'), EmailField::create('EmailField', 'Email address'), HeaderField::create('HeaderField2c', 'HeaderField Level 2', 2), DropdownField::create('DropdownField', 'Dropdown Field', array(0 => '-- please select --', 1 => 'test AAAA', 2 => 'test BBBB')), OptionsetField::create('OptionSF', 'Optionset Field', $array), CheckboxSetField::create('CheckboxSF', 'Checkbox Set Field', $array), CountryDropdownField::create('CountryDropdownField', 'Countries'), CurrencyField::create('CurrencyField', 'Bling bling', '$123.45'), HeaderField::create('HeaderField3', 'Other Fields', 3), NumericField::create('NumericField', 'Numeric Field '), DateField::create('DateField', 'Date Field'), DateField::create('DateTimeField', 'Date and Time Field'), CheckboxField::create('CheckboxField', 'Checkbox Field')), $actions = FieldList::create(FormAction::create('submit', 'Submit Button')), $requiredFields = RequiredFields::create('TextField1', 'TextField2', 'TextField3', 'ErrorField1', 'ErrorField2', 'EmailField', 'TextField3', 'RightTitleField', 'CheckboxField', 'CheckboxSetField'));
     $textAreaField->setColumns(45);
     $form->setMessage('warning message', 'warning');
     return $form;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-typography,代码行数:8,代码来源:Typography.php

示例3: getCMSFields

 public function getCMSFields()
 {
     $fields = FieldList::create(TabSet::create('Root'));
     $fields->addFieldsToTab('Root.Main', array(TextField::create('Title'), TextareaField::create('Description'), CurrencyField::create('PricePerNight', 'Price (per night)'), DropdownField::create('Bedrooms')->setSource(ArrayLib::valuekey(range(1, 10))), DropdownField::create('Bathrooms')->setSource(ArrayLib::valuekey(range(1, 10))), DropdownField::create('RegionID', 'Region')->setSource(Region::get()->map('ID', 'Title'))->setEmptyString('-- Select a region --'), CheckboxField::create('FeaturedOnHomepage', 'Feature on homepage')));
     $fields->addFieldToTab('Root.Photos', $upload = UploadField::create('PrimaryPhoto', 'Primary photo'));
     $upload->getValidator()->setAllowedExtensions(array('png', 'jpeg', 'jpg', 'gif'));
     $upload->setFolderName('property-photos');
     return $fields;
 }
开发者ID:sachithranuwan,项目名称:one-ring-rentals,代码行数:9,代码来源:Property.php

示例4: getCMSFields

 public function getCMSFields()
 {
     $fields = FieldList::create(new Tabset('Root', new Tab('Main'), new Tab('Modifiers')));
     // set variables from Product
     $productID = $this->ProductID != 0 ? $this->ProductID : Session::get('CMSMain.currentPage');
     $product = ProductPage::get()->byID($productID);
     $parentPrice = $product->obj('Price')->Nice();
     $parentWeight = $product->Weight;
     $parentCode = $product->Code;
     // ProductOptionGroup Dropdown field w/ add new
     $groups = function () {
         return OptionGroup::get()->map()->toArray();
     };
     $groupFields = singleton('OptionGroup')->getCMSFields();
     $groupField = DropdownField::create('ProductOptionGroupID', _t("OptionItem.Group", "Group"), $groups())->setEmptyString('')->setDescription(_t('OptionItem.GroupDescription', 'Name of this group of options. Managed in <a href="admin/settings">Settings > FoxyStripe > Option Groups</a>'));
     if (class_exists('QuickAddNewExtension')) {
         $groupField->useAddNew('OptionGroup', $groups, $groupFields);
     }
     $fields->addFieldsToTab('Root.Main', array(HeaderField::create('DetailsHD', _t("OptionItem.DetailsHD", "Product Option Details"), 2), Textfield::create('Title')->setTitle(_t("OptionItem.Title", "Product Option Name")), CheckboxField::create('Available')->setTitle(_t("OptionItem.Available", "Available for purchase"))->setDescription(_t('OptionItem.AvailableDescription', "If unchecked, will disable this option in the drop down menu")), $groupField));
     $fields->addFieldsToTab('Root.Modifiers', array(HeaderField::create('ModifyHD', _t('OptionItem.ModifyHD', 'Product Option Modifiers'), 2), HeaderField::create('WeightHD', _t('OptionItem.WeightHD', 'Modify Weight'), 3), NumericField::create('WeightModifier')->setTitle(_t('OptionItem.WeightModifier', 'Weight')), DropdownField::create('WeightModifierAction', _t('OptionItem.WeightModifierAction', 'Weight Modification'), array('Add' => _t('OptionItem.WeightAdd', "Add to Base Weight ({weight})", 'Add to weight', array('weight' => $parentWeight)), 'Subtract' => _t('OptionItem.WeightSubtract', "Subtract from Base Weight ({weight})", 'Subtract from weight', array('weight' => $parentWeight)), 'Set' => _t('OptionItem.WeightSet', 'Set as a new Weight')))->setEmptyString('')->setDescription(_t('OptionItem.WeightDescription', 'Does weight modify or replace base weight?')), HeaderField::create('PriceHD', _t('OptionItem.PriceHD', 'Modify Price'), 3), CurrencyField::create('PriceModifier')->setTitle(_t('OptionItem.PriceModifier', 'Price')), DropdownField::create('PriceModifierAction', _t('OptionItem.PriceModifierAction', 'Price Modification'), array('Add' => _t('OptionItem.PriceAdd', "Add to Base Price ({price})", 'Add to price', array('price' => $parentPrice)), 'Subtract' => _t('OptionItem.PriceSubtract', "Subtract from Base Price ({price})", 'Subtract from price', array('price' => $parentPrice)), 'Set' => _t('OptionItem.PriceSet', 'Set as a new Price')))->setEmptyString('')->setDescription(_t('OptionItem.PriceDescription', 'Does price modify or replace base price?')), HeaderField::create('CodeHD', _t('OptionItem.CodeHD', 'Modify Code'), 3), TextField::create('CodeModifier')->setTitle(_t('OptionItem.CodeModifier', 'Code')), DropdownField::create('CodeModifierAction', _t('OptionItem.CodeModifierAction', 'Code Modification'), array('Add' => _t('OptionItem.CodeAdd', "Add to Base Code ({code})", 'Add to code', array('code' => $parentCode)), 'Subtract' => _t('OptionItem.CodeSubtract', 'Subtract from Base Code ({code})', 'Subtract from code', array('code' => $parentCode)), 'Set' => _t('OptionItem.CodeSet', 'Set as a new Code')))->setEmptyString('')->setDescription(_t('OptionItem.CodeDescription', 'Does code modify or replace base code?'))));
     /*
     // Cateogry Dropdown field w/ add new
     // removed until relevance determined
     $categories = function(){
         return ProductCategory::get()->map()->toArray();
     };
     
     // to do - have OptionItem category override set ProductPage category if selected: issue #155
     $categoryField = DropdownField::create('CategoryID', 'Category', $categories())
         ->setEmptyString('')
         ->setDescription('Categories can be managed in <a href="admin/settings">Settings > FoxyStripe > Categories</a>');
     if (class_exists('QuickAddNewExtension')) $categoryField->useAddNew('ProductCategory', $categories);
     
     $fields->insertAfter($categoryField, 'ProductOptionGroupID');
     */
     // allow CMS fields to be extended
     $this->extend('getCMSFields', $fields);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:dynamic-foxystripe,代码行数:39,代码来源:OptionItem.php

示例5: Form

 public function Form()
 {
     return new PaymentForm($this, "Form", new FieldList(CurrencyField::create("Amount", "Amount", 20), DropdownField::create("Gateway", "Gateway", Payment::get_supported_gateways())), new FieldList(FormAction::create("submit")));
 }
开发者ID:helpfulrobot,项目名称:burnbright-silverstripe-payme,代码行数:4,代码来源:PayMePage.php

示例6: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     $fields->addFieldToTab("Root.Main.Constraints.Main", CurrencyField::create("MinOrderValue", "Minimum Order Value"));
 }
开发者ID:helpfulrobot,项目名称:silvershop-discounts,代码行数:4,代码来源:ValueDiscountConstraint.php

示例7: getCMSFields

 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     // allow extensions of ProductPage to override the PreviewImage field description
     $previewDescription = $this->stat('customPreviewDescription') ? $this->stat('customPreviewDescription') : _t('ProductPage.PreviewImageDescription', 'Image used throughout site to represent this product');
     // Cateogry Dropdown field w/ add new
     $source = function () {
         return ProductCategory::get()->map()->toArray();
     };
     $catField = DropdownField::create('CategoryID', _t('ProductPage.Category', 'FoxyCart Category'), $source())->setEmptyString('')->setDescription(_t('ProductPage.CategoryDescription', 'Required, must also exist in
                 <a href="https://admin.foxycart.com/admin.php?ThisAction=ManageProductCategories" target="_blank">
                     FoxyCart Categories
                 </a>.
                 Used to set category specific options like shipping and taxes. Managed in
                     <a href="admin/settings">
                         Settings > FoxyStripe > Categories
                     </a>'));
     if (class_exists('QuickAddNewExtension')) {
         $catField->useAddNew('ProductCategory', $source);
     }
     // Product Images gridfield
     $config = GridFieldConfig_RelationEditor::create();
     if (class_exists('GridFieldSortableRows')) {
         $config->addComponent(new GridFieldSortableRows('SortOrder'));
     }
     if (class_exists('GridFieldBulkImageUpload')) {
         $config->addComponent(new GridFieldBulkUpload());
         $config->getComponentByType('GridFieldBulkUpload')->setUfConfig('folderName', 'Uploads/ProductImages');
     }
     $prodImagesField = GridField::create('ProductImages', _t('ProductPage.ProductImages', 'Images'), $this->ProductImages(), $config);
     // Product Options field
     $config = GridFieldConfig_RelationEditor::create();
     if (class_exists('GridFieldBulkManager')) {
         $config->addComponent(new GridFieldBulkManager());
     }
     if (class_exists('GridFieldSortableRows')) {
         $config->addComponent(new GridFieldSortableRows('SortOrder'));
         $products = $this->ProductOptions()->sort('SortOrder');
     } else {
         $products = $this->ProductOptions();
     }
     $config->removeComponentsByType('GridFieldAddExistingAutocompleter');
     $prodOptField = GridField::create('ProductOptions', _t('ProductPage.ProductOptions', 'Options'), $products, $config);
     // Details tab
     $fields->addFieldsToTab('Root.Details', array(HeaderField::create('DetailHD', 'Product Details', 2), CheckboxField::create('Available')->setTitle(_t('ProductPage.Available', 'Available for purchase'))->setDescription(_t('ProductPage.AvailableDescription', 'If unchecked, will remove "Add to Cart" form and instead display "Currently unavailable"')), TextField::create('Code')->setTitle(_t('ProductPage.Code', 'Product Code'))->setDescription(_t('ProductPage.CodeDescription', 'Required, must be unique. Product identifier used by FoxyCart in transactions')), $catField, CurrencyField::create('Price')->setTitle(_t('ProductPage.Price', 'Price'))->setDescription(_t('ProductPage.PriceDescription', 'Base price for this product. Can be modified using Product Options')), NumericField::create('Weight')->setTitle(_t('ProductPage.Weight', 'Weight'))->setDescription(_t('ProductPage.WeightDescription', 'Base weight for this product in lbs. Can be modified using Product Options')), CheckboxField::create('Featured')->setTitle(_t('ProductPage.Featured', 'Featured Product')), TextField::create('ReceiptTitle')->setTitle(_t('ProductPage.ReceiptTitle', 'Product Title for Receipt'))->setDescription(_t('ProductPage.ReceiptTitleDescription', 'Optional'))));
     // Images tab
     $fields->addFieldsToTab('Root.Images', array(HeaderField::create('MainImageHD', _t('ProductPage.MainImageHD', 'Product Image'), 2), UploadField::create('PreviewImage', '')->setDescription($previewDescription)->setFolderName('Uploads/Products')->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'))->setAllowedMaxFileNumber(1), HeaderField::create('ProductImagesHD', _t('ProductPage.ProductImagesHD' . 'Product Image Gallery'), 2), $prodImagesField->setDescription(_t('ProductPage.ProductImagesDescription', 'Additional Product Images, shown in gallery on Product page'))));
     // Options Tab
     $fields->addFieldsToTab('Root.Options', array(HeaderField::create('OptionsHD', _t('ProductPage.OptionsHD', 'Product Options'), 2), LiteralField::create('OptionsDescrip', _t('Page.OptionsDescrip', '<p>Product Options allow products to be customized by attributes such as size or color.
                 Options can also modify the product\'s price, weight or code.</p>')), $prodOptField));
     if (!$this->DiscountTitle && $this->ProductDiscountTiers()->exists()) {
         $fields->addFieldTotab('Root.Discounts', new LiteralField("ProductDiscountHeaderWarning", "<p class=\"message warning\">A discount title is required for FoxyCart to properly parse the value. The discounts will not be applied until a title is entered.</p>"));
     }
     $fields->addFieldToTab('Root.Discounts', TextField::create('DiscountTitle')->setTitle(_t('Product.DiscountTitle', 'Discount Title')));
     $discountsConfig = GridFieldConfig_RelationEditor::create();
     $discountsConfig->removeComponentsByType('GridFieldAddExistingAutocompleter');
     $discountsConfig->removeComponentsByType('GridFieldDeleteAction');
     $discountsConfig->addComponent(new GridFieldDeleteAction(false));
     $discountGrid = GridField::create('ProductDiscountTiers', 'Product Discounts', $this->ProductDiscountTiers(), $discountsConfig);
     $fields->addFieldToTab('Root.Discounts', $discountGrid);
     if (FoxyCart::store_name_warning() !== null) {
         $fields->addFieldToTab('Root.Main', LiteralField::create("StoreSubDomainHeaderWarning", _t('ProductPage.StoreSubDomainHeaderWarning', "<p class=\"message error\">Store sub-domain must be entered in the <a href=\"/admin/settings/\">site settings</a></p>")), 'Title');
     }
     // allows CMS fields to be extended
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
开发者ID:dynamic,项目名称:foxystripe,代码行数:67,代码来源:ProductPage.php


注:本文中的CurrencyField::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。