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


PHP Country::shipping_countries方法代码示例

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


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

示例1: getCMSFields_forPopup

 /**
  * Field for editing a {@link FlatFeeTaxRate}.
  * 
  * @return FieldSet
  */
 public function getCMSFields_forPopup()
 {
     $fields = new FieldSet();
     $fields->push(new TextField('Title', _t('FlatFeeTaxRate.LABEL', 'Label')));
     $fields->push(new TextField('Description', _t('FlatFeeTaxRate.DESCRIPTION', 'Description')));
     $countryField = new DropdownField('CountryID', _t('FlatFeeTaxRate.COUNTRY', 'Country'), Country::shipping_countries());
     $fields->push($countryField);
     $rateField = new NumericField('Rate', _t('FlatFeeTaxRate.TAX_RATE', 'Tax rate as a percentage'));
     $fields->push($rateField);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:swipestripe-swipestripe,代码行数:16,代码来源:FlatFeeTaxRate.php

示例2: getCMSFields_forPopup

 /**
  * Field for editing a {@link FlatFeeShippingRate}.
  * 
  * @return FieldSet
  */
 public function getCMSFields_forPopup()
 {
     $fields = new FieldSet();
     $fields->push(new TextField('Title', _t('FlatFeeShippingRate.LABEL', 'Label')));
     $fields->push(new TextField('Description', _t('FlatFeeShippingRate.DESCRIPTION', 'Description')));
     $amountField = new MoneyField(_t('FlatFeeShippingRate.AMOUNT', 'Amount'));
     $amountField->setAllowedCurrencies(Product::$allowed_currency);
     $fields->push($amountField);
     $countryField = new DropdownField('CountryID', _t('FlatFeeShippingRate.COUNTRY', 'Country'), Country::shipping_countries());
     $fields->push($countryField);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:swipestripe-swipestripe,代码行数:17,代码来源:FlatFeeShippingRate.php

示例3: addShippingAddressFields

 /**
  * Add fields for shipping address and required fields to the validator.
  * 
  * @param Array $fields Array of fields
  * @param OrderFormValidator $validator Checkout form validator
  */
 private function addShippingAddressFields(&$fields, &$validator)
 {
     $firstNameField = new TextField('Shipping[FirstName]', _t('CheckoutPage.FIRSTNAME', "First Name"));
     $firstNameField->addExtraClass('shipping-firstname');
     $firstNameField->setCustomValidationMessage(_t('CheckoutPage.PLEASE_ENTER_FIRSTNAME', "Please enter a first name."));
     $surnameField = new TextField('Shipping[Surname]', _t('CheckoutPage.SURNAME', "Surname"));
     $surnameField->setCustomValidationMessage(_t('CheckoutPage.PLEASE_ENTER_SURNAME', "Please enter a surname."));
     $addressField = new TextField('Shipping[Address]', _t('CheckoutPage.ADDRESS1', "Address 1"));
     $addressField->setCustomValidationMessage(_t('CheckoutPage.PLEASE_ENTER_ADDRESS', "Please enter an address."));
     $cityField = new TextField('Shipping[City]', _t('CheckoutPage.CITY', "City"));
     $cityField->setCustomValidationMessage(_t('CheckoutPage.PLEASE_ENTER_CITY', "Please enter a city."));
     $countryField = new DropdownField('Shipping[Country]', _t('CheckoutPage.COUNTRY', "Country"), Country::shipping_countries());
     $countryField->setCustomValidationMessage(_t('CheckoutPage.PLEASE_ENTER_COUNTRY', "Please enter a country."));
     if (!Member::currentUserID() && Geoip::$default_country_code) {
         $countryField->setValue(Geoip::$default_country_code);
     }
     $regions = Region::shipping_regions();
     $regionField = null;
     if (!empty($regions)) {
         $regionField = new RegionField('Shipping[Region]', _t('CheckoutPage.REGION', "Region"));
         $regionField->setCustomValidationMessage(_t('CheckoutPage.PLEASE_ENTER_REGION', "Please enter a country."));
     }
     $sameAddressField = new CheckboxField('ShipToBillingAddress', _t('CheckoutPage.SAME_ADDRESS', "to same address?"));
     $sameAddressField->addExtraClass('shipping-same-address');
     $shippingAddressFields = new CompositeField(new HeaderField(_t('CheckoutPage.SHIPPING_ADDRESS', "Shipping Address"), 3), $sameAddressField, $firstNameField, $surnameField, new TextField('Shipping[Company]', _t('CheckoutPage.COMPANY', "Company")), $addressField, new TextField('Shipping[AddressLine2]', _t('CheckoutPage.ADDRESS2', "Address 2")), $cityField, new TextField('Shipping[PostalCode]', _t('CheckoutPage.POSTAL_CODE', "Postal Code")), new TextField('Shipping[State]', _t('CheckoutPage.STATE', "State")), $countryField);
     if ($regionField) {
         $shippingAddressFields->push($regionField);
     }
     $shippingAddressFields->setID('ShippingAddress');
     $fields['ShippingAddress'][] = $shippingAddressFields;
     $validator->addRequiredField('Shipping[FirstName]');
     $validator->addRequiredField('Shipping[Surname]');
     $validator->addRequiredField('Shipping[Address]');
     $validator->addRequiredField('Shipping[City]');
     $validator->addRequiredField('Shipping[Country]');
 }
开发者ID:helpfulrobot,项目名称:swipestripe-swipestripe,代码行数:42,代码来源:CheckoutPage.php

示例4: getCMSFields

 /**
  * Fields for CRUD of shipping regions
  * 
  * @see DataObject::getCMSFields()
  */
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $countryField = new DropdownField('CountryID', 'Country', Country::shipping_countries());
     $fields->replaceField('CountryID', $countryField);
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:swipestripe-swipestripe,代码行数:12,代码来源:Region.php

示例5: addAddressesAtCheckout

 /**
  * Add addresses to this Order at the checkout.
  * 
  * @param Array $data
  */
 function addAddressesAtCheckout(array $data)
 {
     $member = Customer::currentUser() ? Customer::currentUser() : singleton('Customer');
     $order = CartControllerExtension::get_current_order();
     $billingCountries = Country::billing_countries();
     $shippingCountries = Country::shipping_countries();
     $shippingRegions = Region::shipping_regions();
     //If there is a current billing and shipping address, update them, otherwise create new ones
     $existingBillingAddress = $this->BillingAddress();
     $existingShippingAddress = $this->ShippingAddress();
     if ($existingBillingAddress && $existingBillingAddress->exists()) {
         $newData = array();
         if (isset($data['Billing']) && is_array($data['Billing'])) {
             foreach ($data['Billing'] as $fieldName => $value) {
                 $newData[$fieldName] = $value;
             }
         }
         $newData['CountryID'] = $data['Billing']['Country'];
         $newData['CountryName'] = in_array($newData['CountryID'], array_keys($billingCountries)) ? $billingCountries[$newData['CountryID']] : null;
         if ($member->ID) {
             $newData['MemberID'] = $member->ID;
         }
         $existingBillingAddress->update($newData);
         $existingBillingAddress->write();
     } else {
         $billingAddress = new Address();
         $billingAddress->OrderID = $order->ID;
         if ($member->ID) {
             $billingAddress->MemberID = $member->ID;
         }
         $billingAddress->FirstName = $data['Billing']['FirstName'];
         $billingAddress->Surname = $data['Billing']['Surname'];
         $billingAddress->Company = $data['Billing']['Company'];
         $billingAddress->Address = $data['Billing']['Address'];
         $billingAddress->AddressLine2 = $data['Billing']['AddressLine2'];
         $billingAddress->City = $data['Billing']['City'];
         $billingAddress->PostalCode = $data['Billing']['PostalCode'];
         $billingAddress->State = $data['Billing']['State'];
         $billingAddress->CountryID = $data['Billing']['Country'];
         $billingAddress->CountryName = in_array($data['Billing']['Country'], array_keys($billingCountries)) ? $billingCountries[$data['Billing']['Country']] : null;
         $billingAddress->Type = 'Billing';
         $billingAddress->write();
     }
     if ($existingShippingAddress && $existingShippingAddress->exists()) {
         $newData = array();
         if (isset($data['Shipping']) && is_array($data['Shipping'])) {
             foreach ($data['Shipping'] as $fieldName => $value) {
                 $newData[$fieldName] = $value;
             }
         }
         $newData['CountryID'] = $data['Shipping']['Country'];
         $newData['CountryName'] = in_array($newData['CountryID'], array_keys($shippingCountries)) ? $shippingCountries[$newData['CountryID']] : null;
         if (isset($newData['Region']) && isset($shippingRegions[$newData['Country']])) {
             if (in_array($newData['Region'], array_keys($shippingRegions[$newData['Country']]))) {
                 $newData['RegionName'] = $shippingRegions[$newData['Country']][$newData['Region']];
             }
         } else {
             $newData['RegionName'] = null;
         }
         if ($member->ID) {
             $newData['MemberID'] = $member->ID;
         }
         $existingShippingAddress->update($newData);
         $existingShippingAddress->write();
     } else {
         $shippingAddress = new Address();
         $shippingAddress->OrderID = $order->ID;
         if ($member->ID) {
             $shippingAddress->MemberID = $member->ID;
         }
         $shippingAddress->FirstName = $data['Shipping']['FirstName'];
         $shippingAddress->Surname = $data['Shipping']['Surname'];
         $shippingAddress->Company = $data['Shipping']['Company'];
         $shippingAddress->Address = $data['Shipping']['Address'];
         $shippingAddress->AddressLine2 = $data['Shipping']['AddressLine2'];
         $shippingAddress->City = $data['Shipping']['City'];
         $shippingAddress->PostalCode = $data['Shipping']['PostalCode'];
         $shippingAddress->State = $data['Shipping']['State'];
         $shippingAddress->CountryID = $data['Shipping']['Country'];
         $shippingAddress->Region = isset($data['Shipping']['Region']) ? $data['Shipping']['Region'] : null;
         $shippingAddress->CountryName = in_array($data['Shipping']['Country'], array_keys($shippingCountries)) ? $shippingCountries[$data['Shipping']['Country']] : null;
         $shippingAddress->RegionName = isset($data['Shipping']['Region']) && isset($shippingRegions[$data['Shipping']['Country']]) && in_array($data['Shipping']['Region'], array_keys($shippingRegions[$data['Shipping']['Country']])) ? $shippingRegions[$data['Shipping']['Country']][$data['Shipping']['Region']] : null;
         $shippingAddress->Type = 'Shipping';
         $shippingAddress->write();
     }
 }
开发者ID:helpfulrobot,项目名称:swipestripe-swipestripe,代码行数:91,代码来源:Order.php


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