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


PHP State::getStates方法代码示例

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


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

示例1: _getDefaultFieldsContent

 private function _getDefaultFieldsContent()
 {
     global $cookie;
     $countryList = array();
     $countryList[] = array('id' => '0', 'name' => $this->l('Choose your country'));
     foreach (Country::getCountries(intval($cookie->id_lang)) as $country) {
         $countryList[] = array('id' => $country['id_country'], 'name' => $country['name']);
     }
     $stateList = array();
     $stateList[] = array('id' => '0', 'name' => $this->l('Choose your state (if applicable)'));
     foreach (State::getStates(intval($cookie->id_lang)) as $state) {
         $stateList[] = array('id' => $state['id_state'], 'name' => $state['name']);
     }
     $formFields = array('PS_SHOP_NAME' => array('title' => $this->l('Shop name:'), 'desc' => $this->l('Displayed in e-mails and page titles'), 'validation' => 'isGenericName', 'required' => true, 'size' => 30, 'type' => 'text'), 'PS_SHOP_EMAIL' => array('title' => $this->l('Shop e-mail:'), 'desc' => $this->l('Displayed in e-mails sent to customers'), 'validation' => 'isEmail', 'required' => true, 'size' => 30, 'type' => 'text'), 'PS_SHOP_DETAILS' => array('title' => $this->l('Registration:'), 'desc' => $this->l('Shop registration information (e.g., SIRET or RCS)'), 'validation' => 'isGenericName', 'size' => 30, 'type' => 'textarea', 'cols' => 30, 'rows' => 5), 'PS_SHOP_ADDR1' => array('title' => $this->l('Shop address line 1:'), 'validation' => 'isAddress', 'size' => 30, 'type' => 'text'), 'PS_SHOP_ADDR2' => array('title' => $this->l('Address line 2'), 'validation' => 'isAddress', 'size' => 30, 'type' => 'text'), 'PS_SHOP_CODE' => array('title' => $this->l('Post/Zip code:'), 'validation' => 'isGenericName', 'size' => 6, 'type' => 'text'), 'PS_SHOP_CITY' => array('title' => $this->l('City:'), 'validation' => 'isGenericName', 'size' => 30, 'type' => 'text'), 'PS_SHOP_COUNTRY_ID' => array('title' => $this->l('Country:'), 'validation' => 'isInt', 'size' => 30, 'type' => 'select', 'list' => $countryList, 'identifier' => 'id', 'cast' => 'intval'), 'PS_SHOP_STATE_ID' => array('title' => $this->l('State:'), 'validation' => 'isInt', 'size' => 30, 'type' => 'select', 'list' => $stateList, 'identifier' => 'id', 'cast' => 'intval'), 'PS_SHOP_PHONE' => array('title' => $this->l('Phone:'), 'validation' => 'isGenericName', 'size' => 30, 'type' => 'text'), 'PS_SHOP_FAX' => array('title' => $this->l('Fax:'), 'validation' => 'isGenericName', 'size' => 30, 'type' => 'text'));
     return $formFields;
 }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:16,代码来源:AdminContact.php

示例2: displayForm

    public function displayForm($isMainTab = true)
    {
        global $currentIndex, $cookie;
        parent::displayForm();
        if (!($obj = $this->loadObject(true))) {
            return;
        }
        $zones = Zone::getZones(true);
        $states = State::getStates((int) $cookie->id_lang);
        echo '
		<form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" method="post">
		' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . '
			<fieldset><legend><img src="../img/admin/dollar.gif" />' . $this->l('Taxes') . '</legend>
				<label>' . $this->l('Name:') . ' </label>
				<div class="margin-form">';
        foreach ($this->_languages as $language) {
            echo '
					<div id="name_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;">
						<input size="33" type="text" name="name_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'name', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" /><sup> *</sup>
						<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
					</div>';
        }
        $this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name', 'name');
        echo '	<p class="clear">' . $this->l('Tax name to display in cart and on invoice, e.g., VAT') . '</p>
				</div>
				<label>' . $this->l('Rate:') . ' </label>
				<div class="margin-form">
					<input type="text" size="4" maxlength="6" name="rate" value="' . htmlentities($this->getFieldValue($obj, 'rate'), ENT_COMPAT, 'UTF-8') . '" /> <sup>*</sup>
					<p class="clear">' . $this->l('Format: XX.XX or XX.XXX (e.g., 19.60 or 13.925)') . '</p>
				</div>
				<label>' . $this->l('Enable:') . ' </label>
				<div class="margin-form">
					<input type="radio" name="active" id="active_on" value="1" ' . ($this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/>
					<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" /></label>
					<input type="radio" name="active" id="active_off" value="0" ' . (!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/>
					<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" /></label>
				</div>
				<div class="margin-form">
					<input type="submit" value="' . $this->l('   Save   ') . '" name="submitAdd' . $this->table . '" class="button" />
				</div>
				<div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div>
			</fieldset>
		</form>';
    }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:44,代码来源:AdminTaxes.php

示例3: __construct

    public function __construct()
    {
        global $cookie;
        $this->table = 'address';
        $this->className = 'Address';
        $this->lang = false;
        $this->edit = true;
        $this->delete = true;
        $this->addressType = 'customer';
        if (!Tools::getValue('realedit')) {
            $this->deleted = true;
        }
        $this->_select = 'cl.`name` as country';
        $this->_join = 'LEFT JOIN `' . _DB_PREFIX_ . 'country_lang` cl ON 
		(cl.`id_country` = a.`id_country` AND cl.`id_lang` = ' . intval($cookie->id_lang) . ')';
        $countries = Country::getCountries(intval($cookie->id_lang));
        foreach ($countries as $country) {
            $this->countriesArray[$country['id_country']] = $country['name'];
        }
        $this->stateList = State::getStates(intval($cookie->id_lang));
        $this->fieldsDisplay = array('id_address' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'firstname' => array('title' => $this->l('First name'), 'width' => 80, 'filter_key' => 'a!firstname'), 'lastname' => array('title' => $this->l('Last name'), 'width' => 100, 'filter_key' => 'a!lastname'), 'address1' => array('title' => $this->l('Address'), 'width' => 200), 'postcode' => array('title' => $this->l('Post/Zip code'), 'align' => 'right', 'width' => 50), 'city' => array('title' => $this->l('City'), 'width' => 150), 'country' => array('title' => $this->l('Country'), 'width' => 100, 'type' => 'select', 'select' => $this->countriesArray, 'filter_key' => 'cl!id_country'));
        parent::__construct();
    }
开发者ID:sealence,项目名称:local,代码行数:23,代码来源:AdminAddresses.php

示例4: _getDefaultFieldsContent

 protected function _getDefaultFieldsContent()
 {
     $this->context = Context::getContext();
     $countryList = array();
     $countryList[] = array('id' => '0', 'name' => $this->l('Choose your country'));
     foreach (Country::getCountries($this->context->language->id) as $country) {
         $countryList[] = array('id' => $country['id_country'], 'name' => $country['name']);
     }
     $stateList = array();
     $stateList[] = array('id' => '0', 'name' => $this->l('Choose your state (if applicable)'));
     foreach (State::getStates($this->context->language->id) as $state) {
         $stateList[] = array('id' => $state['id_state'], 'name' => $state['name']);
     }
     $formFields = array('PS_SHOP_NAME' => array('title' => $this->l('Shop name'), 'hint' => $this->l('Displayed in emails and page titles.'), 'validation' => 'isGenericName', 'required' => true, 'type' => 'text', 'no_escape' => true), 'PS_SHOP_EMAIL' => array('title' => $this->l('Shop email'), 'hint' => $this->l('Displayed in emails sent to customers.'), 'validation' => 'isEmail', 'required' => true, 'type' => 'text'), 'PS_SHOP_DETAILS' => array('title' => $this->l('Registration number'), 'hint' => $this->l('Shop registration information (e.g. SIRET or RCS).'), 'validation' => 'isGenericName', 'type' => 'textarea', 'cols' => 30, 'rows' => 5), 'PS_SHOP_ADDR1' => array('title' => $this->l('Shop address line 1'), 'validation' => 'isAddress', 'type' => 'text'), 'PS_SHOP_ADDR2' => array('title' => $this->l('Shop address line 2'), 'validation' => 'isAddress', 'type' => 'text'), 'PS_SHOP_CODE' => array('title' => $this->l('Zip/postal code'), 'validation' => 'isGenericName', 'type' => 'text'), 'PS_SHOP_CITY' => array('title' => $this->l('City'), 'validation' => 'isGenericName', 'type' => 'text'), 'PS_SHOP_COUNTRY_ID' => array('title' => $this->l('Country'), 'validation' => 'isInt', 'type' => 'select', 'list' => $countryList, 'identifier' => 'id', 'cast' => 'intval', 'defaultValue' => (int) $this->context->country->id), 'PS_SHOP_STATE_ID' => array('title' => $this->l('State'), 'validation' => 'isInt', 'type' => 'select', 'list' => $stateList, 'identifier' => 'id', 'cast' => 'intval'), 'PS_SHOP_PHONE' => array('title' => $this->l('Phone'), 'validation' => 'isGenericName', 'type' => 'text'), 'PS_SHOP_FAX' => array('title' => $this->l('Fax'), 'validation' => 'isGenericName', 'type' => 'text'));
     return $formFields;
 }
开发者ID:ortegon000,项目名称:tienda,代码行数:16,代码来源:AdminStoresController.php

示例5: generateStateData

 protected function generateStateData()
 {
     $delimiter = ';';
     $line = array();
     $titles = array();
     $id_lang = $this->use_lang;
     $new_path = new Sampledatainstall();
     $f = fopen($new_path->sendPath() . 'output/states.vsc', 'w');
     foreach ($this->states_fields as $field => $array) {
         $titles[] = $array['label'];
     }
     fputcsv($f, $titles, $delimiter, '"');
     $states = State::getStates($id_lang);
     if ($states) {
         foreach ($states as $state) {
             foreach ($this->states_fields as $field => $array) {
                 $line[$field] = !Tools::isEmpty($state[$field]) ? $state[$field] : '';
             }
             if (!$line[$field]) {
                 $line[$field] = '';
             }
             fputcsv($f, $line, $delimiter, '"');
         }
     }
     fclose($f);
 }
开发者ID:evgrishin,项目名称:se1614,代码行数:26,代码来源:AdminSampleDataInstallExport.php

示例6: _getAddress

 /**
  * @param int    $addressId
  * @param string $addressType
  *
  * @return ShopgateAddress
  */
 protected function _getAddress($addressId, $addressType)
 {
     $addressItem = new ShopgateAddress();
     /** @var AddressCore $addressCore */
     $addressCore = new Address($addressId);
     $addressItem->setId($addressCore->id);
     switch ($addressType) {
         case ShopgateCustomerPrestashop::DEFAULT_CUSTOMER_ADDRESS_IDENTIFIER_DELIVERY:
             $addressItem->setIsDeliveryAddress(true);
             break;
         case ShopgateCustomerPrestashop::DEFAULT_CUSTOMER_ADDRESS_IDENTIFIER_INVOICE:
             $addressItem->setIsInvoiceAddress(true);
             break;
     }
     $addressItem->setFirstName($addressCore->firstname);
     $addressItem->setLastName($addressCore->lastname);
     $addressItem->setCompany($addressCore->company);
     $addressItem->setStreet1($addressCore->address1);
     $addressItem->setStreet2($addressCore->address2);
     $addressItem->setZipcode($addressCore->postcode);
     $addressItem->setCity($addressCore->city);
     $addressItem->setCountry(Country::getIsoById($addressCore->id_country));
     $states = State::getStates($this->getPlugin()->getLanguageId());
     foreach ($states as $state) {
         /** @var StateCore $state */
         if ($state['id_country'] == $addressCore->id_state) {
             $addressItem->setState($state->iso_code);
         }
     }
     return $addressItem;
 }
开发者ID:pankajshoffex,项目名称:shoffex_prestashop,代码行数:37,代码来源:Json.php

示例7: getPreviewAddress

 public function getPreviewAddress($log = false)
 {
     // for compatibility
     /** NO LONGER NECESSARY */
     /*
     if($this->name == 'localizedshipping')
     	$name = 'shp';
     else
     */
     $name = $this->name;
     if ($this->context->cookie->postcode && $this->context->cookie->id_country && $this->context->cookie->id_state) {
         $cookie_state = $this->context->cookie->id_state;
     } else {
         $cookie_state = $this->context->cookie->pc_dest_state;
     }
     $cookie_zip = $this->context->cookie->postcode ? $this->context->cookie->postcode : $this->context->cookie->pc_dest_zip;
     $cookie_country = $this->context->cookie->id_country ? $this->context->cookie->id_country : $this->context->cookie->pc_dest_country;
     if ($this->context->customer->logged) {
         if (isset($_POST[$name . '_dest_zip']) && $_POST[$name . '_dest_zip'] != "" || isset($_POST[$name . '_dest_country']) && $_POST[$name . '_dest_country'] != "" || isset($_POST[$name . '_dest_state']) && $_POST[$name . '_dest_state'] != "") {
             $dest_zip = Tools::getValue($name . '_dest_zip');
             $dest_state = Tools::getValue($name . '_dest_state');
             $dest_country = Tools::getValue($name . '_dest_country');
             $dest_city = Tools::getValue($name . '_dest_city') != $this->l('City') ? Tools::getValue($name . '_dest_city') : "";
             if ((int) $this->context->cart->id_address_delivery > 0) {
                 $address = new Address(intval($this->context->cart->id_address_delivery));
                 $address->postcode = $dest_zip;
                 $address->id_country = $dest_country;
                 $address->city = ($dest_city and strlen($dest_city)) ? $dest_city : 0;
                 if ((int) $dest_state > 0) {
                     $address->id_state = $dest_state;
                 }
                 $country = new Country($dest_country);
                 if (!$address->id_state && $country->contains_states) {
                     $id_state = 0;
                     $states = State::getStates($this->context->language->id, true);
                     foreach ($states as $state) {
                         $id_state = $state['id_state'];
                     }
                     $address->id_state = $id_state;
                 } else {
                     if ($address->id_state && !$country->contains_states) {
                         $address->id_state = 0;
                     }
                 }
                 $override_address_name = '_' . $name . '_override_address';
                 if ($this->{$override_address_name}) {
                     $address->update();
                 }
             }
             $state = new State($dest_state);
             $country = new Country($dest_country);
             $id_zone = $state->id_zone > 0 ? $state->id_zone : $country->id_zone;
             $dest_country = $country->iso_code;
         } else {
             if ((int) $this->context->cart->id_address_delivery > 0) {
                 $address = new Address(intval($this->context->cart->id_address_delivery));
                 $dest_zip = $address->postcode;
                 $country = new Country($address->id_country);
                 $dest_country = $country->iso_code;
                 $dest_state = $address->id_state;
                 $dest_city = $address->city;
                 $state = new State($dest_state);
                 $id_zone = $state->id_zone > 0 ? $state->id_zone : $country->id_zone;
             } else {
                 $dest_zip = $cookie_zip;
                 $dest_state = $cookie_state;
                 $dest_country = $cookie_country;
                 $dest_city = $this->context->cookie->pc_dest_city;
                 $country = new Country($dest_country);
                 $state = new State($dest_state);
                 $id_zone = $state->id_zone > 0 ? $state->id_zone : $country->id_zone;
                 $dest_country = $country->iso_code;
             }
         }
     } else {
         /** IF CARRIER IS NOT ROYAL MAIL CARRIER */
         if ($this->name != 'royalmail') {
             if (isset($_POST[$name . '_dest_zip']) && $_POST[$name . '_dest_zip'] || isset($_POST[$name . '_dest_country']) && $_POST[$name . '_dest_country'] || isset($_POST[$name . '_dest_state']) && $_POST[$name . '_dest_state']) {
                 $dest_zip = Tools::getValue($name . '_dest_zip');
                 $dest_state = Tools::getValue($name . '_dest_state');
                 $dest_country = Tools::getValue($name . '_dest_country');
                 $dest_city = isset($_POST[$name . '_dest_city']) && $_POST[$name . '_dest_city'] != $this->l('City') ? $_POST[$name . '_dest_city'] : "";
             } else {
                 $dest_zip = $cookie_zip;
                 $dest_state = $cookie_state;
                 $dest_country = $cookie_country;
                 $dest_city = $this->context->cookie->pc_dest_city;
             }
         } else {
             if (isset($_POST[$name . '_dest_country']) && $_POST[$name . '_dest_country']) {
                 $dest_zip = Tools::getValue($name . '_dest_zip');
                 $dest_state = Tools::getValue($name . '_dest_state');
                 $dest_country = Tools::getValue($name . '_dest_country');
                 $dest_city = isset($_POST[$name . '_dest_city']) && $_POST[$name . '_dest_city'] != $this->l('City') ? $_POST[$name . '_dest_city'] : "";
             } else {
                 $dest_zip = $cookie_zip;
                 $dest_state = $cookie_state;
                 $dest_country = $cookie_country;
                 $dest_city = $this->context->cookie->pc_dest_city;
             }
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例8: renderForm

 public function renderForm()
 {
     $this->fields_form = array('legend' => array('title' => 'Legend'), 'input' => array(array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'options' => array('query' => Country::getCountries($this->context->language->id, true, true), 'id' => 'id_country', 'name' => 'name'), 'required' => true), array('type' => 'select', 'label' => $this->l('State'), 'name' => 'id_state', 'required' => true, 'options' => array('query' => State::getStates(), 'id' => 'id_state', 'name' => 'name')), array('type' => 'select', 'label' => 'Tariff Zone', 'name' => 'id_post_zone', 'options' => array('query' => array(array('id' => 1, 'value' => 'Zone 1'), array('id' => 2, 'value' => 'Zone 2'), array('id' => 3, 'value' => 'Zone 3'), array('id' => 4, 'value' => 'Zone 4'), array('id' => 5, 'value' => 'Zone 5')), 'id' => 'id', 'name' => 'value'), 'required' => true), array('type' => 'radio', 'label' => $this->l('Status'), 'name' => 'active', 'required' => false, 'is_bool' => true, 'class' => 't', 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'desc' => $this->l('Enable delivery to this Country/State'))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
     return parent::renderForm();
 }
开发者ID:qant,项目名称:russianpostcarrier,代码行数:5,代码来源:adminrussianpost.php

示例9: getContent

    public function getContent()
    {
        $buffer = '';
        if (Tools::isSubmit('SubmitAvalaraTaxSettings')) {
            Configuration::updateValue('AVALARATAX_ACCOUNT_NUMBER', Tools::getValue('avalaratax_account_number'));
            Configuration::updateValue('AVALARATAX_LICENSE_KEY', Tools::getValue('avalaratax_license_key'));
            Configuration::updateValue('AVALARATAX_URL', Tools::getValue('avalaratax_url'));
            Configuration::updateValue('AVALARATAX_COMPANY_CODE', Tools::getValue('avalaratax_company_code'));
            $buffer .= $this->_displayConfirmation();
        } elseif (Tools::isSubmit('SubmitAvalaraTaxOptions')) {
            Configuration::updateValue('AVALARATAX_ADDRESS_VALIDATION', Tools::getValue('avalaratax_address_validation'));
            Configuration::updateValue('AVALARATAX_TAX_CALCULATION', Tools::getValue('avalaratax_tax_calculation'));
            Configuration::updateValue('AVALARATAX_TIMEOUT', (int) Tools::getValue('avalaratax_timeout'));
            Configuration::updateValue('AVALARATAX_ADDRESS_NORMALIZATION', Tools::getValue('avalaratax_address_normalization'));
            Configuration::updateValue('AVALARATAX_TAX_OUTSIDE', Tools::getValue('avalaratax_tax_outside'));
            Configuration::updateValue('AVALARA_CACHE_MAX_LIMIT', Tools::getValue('avalara_cache_max_limit') < 1 ? 1 : Tools::getValue('avalara_cache_max_limit') > 23 ? 23 : Tools::getValue('avalara_cache_max_limit'));
            $buffer .= $this->_displayConfirmation();
        } elseif (Tools::isSubmit('SubmitAvalaraTestConnection')) {
            $connectionTestResult = $this->_testConnection();
        } elseif (Tools::isSubmit('SubmitAvalaraAddressOptions')) {
            /* Validate address*/
            $address = new Address();
            $address->address1 = Tools::getValue('avalaratax_address_line1');
            $address->address2 = Tools::getValue('avalaratax_address_line2');
            $address->city = Tools::getValue('avalaratax_city');
            $address->id_state = State::getIdByIso(Tools::getValue('avalaratax_state'));
            $address->id_country = Tools::getValue('avalaratax_country');
            $address->postcode = Tools::getValue('avalaratax_zip_code');
            $normalizedAddress = $this->validateAddress($address);
            if (isset($normalizedAddress['ResultCode']) && $normalizedAddress['ResultCode'] == 'Success') {
                $buffer .= $this->_displayConfirmation($this->l('The address you submitted has been validated.'));
                Configuration::updateValue('AVALARATAX_ADDRESS_LINE1', $normalizedAddress['Normalized']['Line1']);
                Configuration::updateValue('AVALARATAX_ADDRESS_LINE2', $normalizedAddress['Normalized']['Line2']);
                Configuration::updateValue('AVALARATAX_CITY', $normalizedAddress['Normalized']['City']);
                Configuration::updateValue('AVALARATAX_STATE', $normalizedAddress['Normalized']['Region']);
                Configuration::updateValue('AVALARATAX_COUNTRY', $normalizedAddress['Normalized']['Country']);
                Configuration::updateValue('AVALARATAX_ZIP_CODE', $normalizedAddress['Normalized']['PostalCode']);
            } else {
                $message = $this->l('The following error was generated while validating your address:');
                if (isset($normalizedAddress['Exception']['FaultString'])) {
                    $message .= '<br /> - ' . Tools::safeOutput($normalizedAddress['Exception']['FaultString']);
                }
                if (isset($normalizedAddress['Messages']['Summary'])) {
                    foreach ($normalizedAddress['Messages']['Summary'] as $summary) {
                        $message .= '<br /> - ' . Tools::safeOutput($summary);
                    }
                }
                $buffer .= $this->_displayConfirmation($message, 'error');
                Configuration::updateValue('AVALARATAX_ADDRESS_LINE1', Tools::getValue('avalaratax_address_line1'));
                Configuration::updateValue('AVALARATAX_ADDRESS_LINE2', Tools::getValue('avalaratax_address_line2'));
                Configuration::updateValue('AVALARATAX_CITY', Tools::getValue('avalaratax_city'));
                Configuration::updateValue('AVALARATAX_STATE', Tools::getValue('avalaratax_state'));
                Configuration::updateValue('AVALARATAX_ZIP_CODE', Tools::getValue('avalaratax_zip_code'));
            }
        } elseif (Tools::isSubmit('SubmitAvalaraTaxClearCache')) {
            Db::getInstance()->Execute('TRUNCATE TABLE `' . _DB_PREFIX_ . 'avalara_product_cache`');
            Db::getInstance()->Execute('TRUNCATE TABLE `' . _DB_PREFIX_ . 'avalara_carrier_cache`');
            $buffer .= $this->_displayConfirmation('Cache cleared!');
        }
        $confValues = Configuration::getMultiple(array('AVALARATAX_ACCOUNT_NUMBER', 'AVALARATAX_LICENSE_KEY', 'AVALARATAX_URL', 'AVALARATAX_COMPANY_CODE', 'AVALARATAX_ADDRESS_VALIDATION', 'AVALARATAX_TAX_CALCULATION', 'AVALARATAX_TIMEOUT', 'AVALARATAX_ADDRESS_NORMALIZATION', 'AVALARATAX_TAX_OUTSIDE', 'AVALARATAX_COMMIT_ID', 'AVALARATAX_CANCEL_ID', 'AVALARATAX_REFUND_ID', 'AVALARATAX_POST_ID', 'AVALARA_CACHE_MAX_LIMIT', 'AVALARATAX_ADDRESS_LINE1', 'AVALARATAX_ADDRESS_LINE2', 'AVALARATAX_CITY', 'AVALARATAX_STATE', 'AVALARATAX_ZIP_CODE', 'AVALARATAX_COUNTRY'));
        $stateList = array();
        $stateList[] = array('id' => '0', 'name' => $this->l('Choose your state (if applicable)'), 'iso_code' => '--');
        foreach (State::getStates((int) $this->context->cookie->id_lang) as $state) {
            $stateList[] = array('id' => $state['id_state'], 'name' => $state['name'], 'iso_code' => $state['iso_code']);
        }
        $countryList = array();
        $countryList[] = array('id' => '0', 'name' => $this->l('Choose your country'), 'iso_code' => '--');
        foreach (Country::getCountries((int) $this->context->cookie->id_lang, false, null, false) as $country) {
            $countryList[] = array('id' => $country['id_country'], 'name' => $country['name'], 'iso_code' => $country['iso_code']);
        }
        $buffer .= '<style type="text/css">
			fieldset.avalaratax_fieldset td.avalaratax_column { padding: 0 18px; text-align: right; vertical-align: top;}
			fieldset.avalaratax_fieldset input[type=text] { width: 250px; }
			fieldset.avalaratax_fieldset input.avalaratax_button { margin-top: 10px; }
			fieldset.avalaratax_fieldset div#test_connection { margin-left: 18px; border: 1px solid #DFD5C3; padding: 5px; font-size: 11px; margin-bottom: 10px; width: 90%; }
			fieldset.avalaratax_fieldset a { color: #0000CC; font-weight: bold; text-decoration: underline; }
			.avalara-pagination {display: inline-block; float: right; }
			.avalara-pagination ul {list-style: none; display: inline-block; margin: 0; padding: 0;}
			.avalara-pagination ul li {margin-left: 10px; display: inline-block;}
			.clear {clear: both; margin: 0 auto;}
			.current-page {border: 1px solid #000; padding: 3px;}
			.orders-table {border-collapse:collapse;}
			.orders-table tr { vertical-align: top;}
			.orders-table tr td { border-top: 1px solid #000;}
		</style>
		<script type="text/javascript">
			$(function() {
				/* Add video */
				$(\'<div style="left: 567px; top: 11px; position: relative; width: 361px; height: 0px"><iframe width="360" height="215" src="http://www.youtube.com/embed/tm1tENVdcQ8" frameborder="0" allowfullscreen></iframe></div>\').prependTo(\'#content form:eq(0)\');
			});
		</script>

		<h2>' . Tools::safeOutput($this->displayName) . '</h2>
		<div class="hint clear" style="display:block;">
				<a style="float: right;" target="_blank" href="http://www.prestashop.com/en/industry-partners/management/avalara"><img alt="" src="../modules/avalaratax/avalaratax_logo.png"></a>
				<div style="width: 700px; margin: 0 auto; text-align: center"><h3 style="color: red">' . $this->l('This module is intended to work ONLY in United States of America and Canada') . '</h3></div>
				<h3>' . $this->l('How to configure Avalara Tax Module:') . '</h3>
				- ' . $this->l('Fill the Account Number, License Key, and Company Code fields with those provided by Avalara.') . ' <br />
				- ' . $this->l('Specify your origin address. This is FROM where you are shipping the products (It has to be a ') . '<b>' . $this->l('VALID UNITED STATES ADDRESS') . '</b>)<br /><br />
				<h3>' . $this->l('Module goal:') . '</h3>
//.........这里部分代码省略.........
开发者ID:rtajmahal,项目名称:PrestaShop-modules,代码行数:101,代码来源:avalaratax.php

示例10: getContent

    public function getContent()
    {
        $buffer = '';
        if (version_compare(_PS_VERSION_, '1.5', '>')) {
            $this->context->controller->addJQueryPlugin('fancybox');
        } else {
            $buffer .= '<script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/jquery/jquery.fancybox-1.3.4.js"></script>
		  	<link type="text/css" rel="stylesheet" href="' . __PS_BASE_URI__ . 'css/jquery.fancybox-1.3.4.css" />';
        }
        if (Tools::isSubmit('SubmitAvalaraTaxSettings')) {
            Configuration::updateValue('AVALARATAX_ACCOUNT_NUMBER', Tools::getValue('avalaratax_account_number'));
            Configuration::updateValue('AVALARATAX_LICENSE_KEY', Tools::getValue('avalaratax_license_key'));
            Configuration::updateValue('AVALARATAX_URL', Tools::getValue('avalaratax_url'));
            Configuration::updateValue('AVALARATAX_COMPANY_CODE', Tools::getValue('avalaratax_company_code'));
            $buffer .= $this->_displayConfirmation();
        } elseif (Tools::isSubmit('SubmitAvalaraTaxOptions')) {
            Configuration::updateValue('AVALARATAX_ADDRESS_VALIDATION', Tools::getValue('avalaratax_address_validation'));
            Configuration::updateValue('AVALARATAX_TAX_CALCULATION', Tools::getValue('avalaratax_tax_calculation'));
            Configuration::updateValue('AVALARATAX_TIMEOUT', (int) Tools::getValue('avalaratax_timeout'));
            Configuration::updateValue('AVALARATAX_ADDRESS_NORMALIZATION', Tools::getValue('avalaratax_address_normalization'));
            Configuration::updateValue('AVALARATAX_TAX_OUTSIDE', Tools::getValue('avalaratax_tax_outside'));
            Configuration::updateValue('AVALARA_CACHE_MAX_LIMIT', Tools::getValue('avalara_cache_max_limit') < 1 ? 1 : Tools::getValue('avalara_cache_max_limit') > 23 ? 23 : Tools::getValue('avalara_cache_max_limit'));
            $buffer .= $this->_displayConfirmation();
        } elseif (Tools::isSubmit('SubmitAvalaraTestConnection')) {
            $connectionTestResult = $this->_testConnection();
        } elseif (Tools::isSubmit('SubmitAvalaraAddressOptions')) {
            /* Validate address*/
            $address = new Address();
            $address->address1 = Tools::getValue('avalaratax_address_line1');
            $address->address2 = Tools::getValue('avalaratax_address_line2');
            $address->city = Tools::getValue('avalaratax_city');
            $address->id_state = State::getIdByIso(Tools::getValue('avalaratax_state'));
            $address->id_country = Tools::getValue('avalaratax_country');
            $address->postcode = Tools::getValue('avalaratax_zip_code');
            $normalizedAddress = $this->validateAddress($address);
            if (isset($normalizedAddress['ResultCode']) && $normalizedAddress['ResultCode'] == 'Success') {
                $buffer .= $this->_displayConfirmation($this->l('The address you submitted has been validated.'));
                Configuration::updateValue('AVALARATAX_ADDRESS_LINE1', $normalizedAddress['Normalized']['Line1']);
                Configuration::updateValue('AVALARATAX_ADDRESS_LINE2', $normalizedAddress['Normalized']['Line2']);
                Configuration::updateValue('AVALARATAX_CITY', $normalizedAddress['Normalized']['City']);
                Configuration::updateValue('AVALARATAX_STATE', $normalizedAddress['Normalized']['Region']);
                Configuration::updateValue('AVALARATAX_COUNTRY', $normalizedAddress['Normalized']['Country']);
                Configuration::updateValue('AVALARATAX_ZIP_CODE', $normalizedAddress['Normalized']['PostalCode']);
            } else {
                $message = $this->l('The following error was generated while validating your address:');
                if (isset($normalizedAddress['Exception']['FaultString'])) {
                    $message .= '<br /> - ' . Tools::safeOutput($normalizedAddress['Exception']['FaultString']);
                }
                if (isset($normalizedAddress['Messages']['Summary'])) {
                    foreach ($normalizedAddress['Messages']['Summary'] as $summary) {
                        $message .= '<br /> - ' . Tools::safeOutput($summary);
                    }
                }
                $buffer .= $this->_displayConfirmation($message, 'error');
                Configuration::updateValue('AVALARATAX_ADDRESS_LINE1', Tools::getValue('avalaratax_address_line1'));
                Configuration::updateValue('AVALARATAX_ADDRESS_LINE2', Tools::getValue('avalaratax_address_line2'));
                Configuration::updateValue('AVALARATAX_CITY', Tools::getValue('avalaratax_city'));
                Configuration::updateValue('AVALARATAX_STATE', Tools::getValue('avalaratax_state'));
                Configuration::updateValue('AVALARATAX_ZIP_CODE', Tools::getValue('avalaratax_zip_code'));
            }
        } elseif (Tools::isSubmit('SubmitAvalaraTaxClearCache')) {
            Db::getInstance()->Execute('TRUNCATE TABLE `' . _DB_PREFIX_ . 'avalara_product_cache`');
            Db::getInstance()->Execute('TRUNCATE TABLE `' . _DB_PREFIX_ . 'avalara_carrier_cache`');
            $buffer .= $this->_displayConfirmation('Cache cleared!');
        }
        $confValues = Configuration::getMultiple(array('AVALARATAX_ACCOUNT_NUMBER', 'AVALARATAX_LICENSE_KEY', 'AVALARATAX_URL', 'AVALARATAX_COMPANY_CODE', 'AVALARATAX_ADDRESS_VALIDATION', 'AVALARATAX_TAX_CALCULATION', 'AVALARATAX_TIMEOUT', 'AVALARATAX_ADDRESS_NORMALIZATION', 'AVALARATAX_TAX_OUTSIDE', 'AVALARATAX_COMMIT_ID', 'AVALARATAX_CANCEL_ID', 'AVALARATAX_REFUND_ID', 'AVALARATAX_POST_ID', 'AVALARA_CACHE_MAX_LIMIT', 'AVALARATAX_ADDRESS_LINE1', 'AVALARATAX_ADDRESS_LINE2', 'AVALARATAX_CITY', 'AVALARATAX_STATE', 'AVALARATAX_ZIP_CODE', 'AVALARATAX_COUNTRY'));
        $stateList = array();
        $stateList[] = array('id' => '0', 'name' => $this->l('Choose your state (if applicable)'), 'iso_code' => '--');
        foreach (State::getStates((int) $this->context->cookie->id_lang) as $state) {
            $stateList[] = array('id' => $state['id_state'], 'name' => $state['name'], 'iso_code' => $state['iso_code']);
        }
        $countryList = array();
        $countryList[] = array('id' => '0', 'name' => $this->l('Choose your country'), 'iso_code' => '--');
        foreach (Country::getCountries((int) $this->context->cookie->id_lang, false, null, false) as $country) {
            $countryList[] = array('id' => $country['id_country'], 'name' => $country['name'], 'iso_code' => $country['iso_code']);
        }
        $buffer .= '<link href="' . $this->_path . 'css/avalara.css" rel="stylesheet" type="text/css">
		<script type="text/javascript">
			/* Fancybox */
			$(\'a.avalara-video-btn\').live(\'click\', function(){
			    $.fancybox({
			        \'type\' : \'iframe\',
			        \'href\' : this.href.replace(new RegExp("watch\\?v=", "i"), \'embed\') + \'?rel=0&autoplay=1\',
			        \'swf\': {\'allowfullscreen\':\'true\', \'wmode\':\'transparent\'},
			        \'overlayShow\' : true,
			        \'centerOnScroll\' : true,
			        \'speedIn\' : 100,
			        \'speedOut\' : 50,
			        \'width\' : 853,
			        \'height\' : 480
			    });
			    return false;
			});
		</script>
		<script type="text/javascript">
			$(document).ready(function(){
			    var height1 = 0;
			    var height = 0;
			     $(\'.field-height1\').each(function(){
				if (height1 < $(this).height())
//.........这里部分代码省略.........
开发者ID:juniorhq88,项目名称:PrestaShop-modules,代码行数:101,代码来源:avalaratax.php

示例11: fetchCountries

 private function fetchCountries()
 {
     // $countryList = array();
     // $countryList[] = array('id' => '0', 'name' => $this->l('Choose your country'));
     // foreach (Country::getCountries($this->context->language->id) as $country) {
     //     $countryList[] = array('id' => $country['id_country'], 'name' => $country['name']);
     // }
     // $this->context->smarty->assign( array('countries' => $countryList));
     $cityList = array();
     $cityList[] = array('id' => '0', 'name' => $this->l('Scegli il comune'));
     foreach (AphCity::getCities() as $city) {
         if ($city['id_country'] == $this->id_country) {
             $cityList[] = array('id' => $city['id_city'], 'name' => $city['name']);
         }
     }
     $this->context->smarty->assign(array('cities' => $cityList));
     $statesList = array();
     $statesList[] = array('id' => '0', 'name' => $this->l('Scegli la provincia'));
     foreach (State::getStates($this->context->language->id) as $state) {
         if ($state['id_country'] == $this->id_country) {
             $statesList[] = array('id' => $state['id_state'], 'name' => $state['name']);
         }
     }
     $this->context->smarty->assign(array('states' => $statesList));
 }
开发者ID:paolobattistella,项目名称:aphro,代码行数:25,代码来源:AdminAphStoresController.php

示例12: changeStates

 function changeStates($id)
 {
     global $cookie;
     $tax = new $this->className($id);
     if (!Validate::isLoadedObject($tax)) {
         die(Tools::displayError('object cannot be loaded'));
     }
     $states = State::getStates(intval($cookie->id_lang), true);
     foreach ($states as $state) {
         if ($tax->getState($state['id_state'])) {
             if (!isset($_POST['state_' . $state['id_state']]) or !$_POST['state_' . $state['id_state']]) {
                 $tax->deleteState($state['id_state']);
             }
         } elseif (isset($_POST['state_' . $state['id_state']]) and $_POST['state_' . $state['id_state']]) {
             $tax->addState($state['id_state']);
         }
     }
 }
开发者ID:sealence,项目名称:local,代码行数:18,代码来源:AdminTaxes.php


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