• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Helper\Data类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Magento\Directory\Helper\Data的典型用法代码示例。如果您正苦于以下问题:PHP Data类的具体用法?PHP Data怎么用?PHP Data使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: testGetConfigurationCountryCodeFromDefault

 /**
  * @param string|null $request
  * @param string|null|false $config
  * @param string|null $default
  * @dataProvider getConfigurationCountryCodeFromDefaultDataProvider
  */
 public function testGetConfigurationCountryCodeFromDefault($request, $config, $default)
 {
     $this->_configurationCountryCodePrepareRequest($request);
     $this->_configurationCountryCodePrepareConfig($config);
     $this->directoryHelperMock->expects($this->once())->method('getDefaultCountry')->will($this->returnValue($default));
     $this->_configurationCountryCodeAssertResult($default);
 }
开发者ID:nja78,项目名称:magento2,代码行数:13,代码来源:BackendTest.php


示例2: render

 /**
  * Output the region element and javasctipt that makes it dependent from country element
  *
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
  * @return string
  *
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     if ($country = $element->getForm()->getElement('country_id')) {
         $countryId = $country->getValue();
     } else {
         return $element->getDefaultHtml();
     }
     $regionId = $element->getForm()->getElement('region_id')->getValue();
     $html = '<div class="field field-state required">';
     $element->setClass('input-text');
     $element->setRequired(true);
     $html .= $element->getLabelHtml() . '<div class="control">';
     $html .= $element->getElementHtml();
     $selectName = str_replace('region', 'region_id', $element->getName());
     $selectId = $element->getHtmlId() . '_id';
     $html .= '<select id="' . $selectId . '" name="' . $selectName . '" class="select required-entry" style="display:none">';
     $html .= '<option value="">' . __('Please select') . '</option>';
     $html .= '</select>';
     $html .= '<script>' . "\n";
     $html .= 'require(["prototype", "mage/adminhtml/form"], function(){';
     $html .= '$("' . $selectId . '").setAttribute("defaultValue", "' . $regionId . '");' . "\n";
     $html .= 'new regionUpdater("' . $country->getHtmlId() . '", "' . $element->getHtmlId() . '", "' . $selectId . '", ' . $this->_directoryHelper->getRegionJson() . ');' . "\n";
     $html .= '});';
     $html .= '</script>' . "\n";
     $html .= '</div></div>' . "\n";
     return $html;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:35,代码来源:Region.php


示例3: install

 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /**
      * Fill table directory/country
      */
     $data = [['AD', 'AD', 'AND'], ['AE', 'AE', 'ARE'], ['AF', 'AF', 'AFG'], ['AG', 'AG', 'ATG'], ['AI', 'AI', 'AIA'], ['AL', 'AL', 'ALB'], ['AM', 'AM', 'ARM'], ['AN', 'AN', 'ANT'], ['AO', 'AO', 'AGO'], ['AQ', 'AQ', 'ATA'], ['AR', 'AR', 'ARG'], ['AS', 'AS', 'ASM'], ['AT', 'AT', 'AUT'], ['AU', 'AU', 'AUS'], ['AW', 'AW', 'ABW'], ['AX', 'AX', 'ALA'], ['AZ', 'AZ', 'AZE'], ['BA', 'BA', 'BIH'], ['BB', 'BB', 'BRB'], ['BD', 'BD', 'BGD'], ['BE', 'BE', 'BEL'], ['BF', 'BF', 'BFA'], ['BG', 'BG', 'BGR'], ['BH', 'BH', 'BHR'], ['BI', 'BI', 'BDI'], ['BJ', 'BJ', 'BEN'], ['BL', 'BL', 'BLM'], ['BM', 'BM', 'BMU'], ['BN', 'BN', 'BRN'], ['BO', 'BO', 'BOL'], ['BR', 'BR', 'BRA'], ['BS', 'BS', 'BHS'], ['BT', 'BT', 'BTN'], ['BV', 'BV', 'BVT'], ['BW', 'BW', 'BWA'], ['BY', 'BY', 'BLR'], ['BZ', 'BZ', 'BLZ'], ['CA', 'CA', 'CAN'], ['CC', 'CC', 'CCK'], ['CD', 'CD', 'COD'], ['CF', 'CF', 'CAF'], ['CG', 'CG', 'COG'], ['CH', 'CH', 'CHE'], ['CI', 'CI', 'CIV'], ['CK', 'CK', 'COK'], ['CL', 'CL', 'CHL'], ['CM', 'CM', 'CMR'], ['CN', 'CN', 'CHN'], ['CO', 'CO', 'COL'], ['CR', 'CR', 'CRI'], ['CU', 'CU', 'CUB'], ['CV', 'CV', 'CPV'], ['CX', 'CX', 'CXR'], ['CY', 'CY', 'CYP'], ['CZ', 'CZ', 'CZE'], ['DE', 'DE', 'DEU'], ['DJ', 'DJ', 'DJI'], ['DK', 'DK', 'DNK'], ['DM', 'DM', 'DMA'], ['DO', 'DO', 'DOM'], ['DZ', 'DZ', 'DZA'], ['EC', 'EC', 'ECU'], ['EE', 'EE', 'EST'], ['EG', 'EG', 'EGY'], ['EH', 'EH', 'ESH'], ['ER', 'ER', 'ERI'], ['ES', 'ES', 'ESP'], ['ET', 'ET', 'ETH'], ['FI', 'FI', 'FIN'], ['FJ', 'FJ', 'FJI'], ['FK', 'FK', 'FLK'], ['FM', 'FM', 'FSM'], ['FO', 'FO', 'FRO'], ['FR', 'FR', 'FRA'], ['GA', 'GA', 'GAB'], ['GB', 'GB', 'GBR'], ['GD', 'GD', 'GRD'], ['GE', 'GE', 'GEO'], ['GF', 'GF', 'GUF'], ['GG', 'GG', 'GGY'], ['GH', 'GH', 'GHA'], ['GI', 'GI', 'GIB'], ['GL', 'GL', 'GRL'], ['GM', 'GM', 'GMB'], ['GN', 'GN', 'GIN'], ['GP', 'GP', 'GLP'], ['GQ', 'GQ', 'GNQ'], ['GR', 'GR', 'GRC'], ['GS', 'GS', 'SGS'], ['GT', 'GT', 'GTM'], ['GU', 'GU', 'GUM'], ['GW', 'GW', 'GNB'], ['GY', 'GY', 'GUY'], ['HK', 'HK', 'HKG'], ['HM', 'HM', 'HMD'], ['HN', 'HN', 'HND'], ['HR', 'HR', 'HRV'], ['HT', 'HT', 'HTI'], ['HU', 'HU', 'HUN'], ['ID', 'ID', 'IDN'], ['IE', 'IE', 'IRL'], ['IL', 'IL', 'ISR'], ['IM', 'IM', 'IMN'], ['IN', 'IN', 'IND'], ['IO', 'IO', 'IOT'], ['IQ', 'IQ', 'IRQ'], ['IR', 'IR', 'IRN'], ['IS', 'IS', 'ISL'], ['IT', 'IT', 'ITA'], ['JE', 'JE', 'JEY'], ['JM', 'JM', 'JAM'], ['JO', 'JO', 'JOR'], ['JP', 'JP', 'JPN'], ['KE', 'KE', 'KEN'], ['KG', 'KG', 'KGZ'], ['KH', 'KH', 'KHM'], ['KI', 'KI', 'KIR'], ['KM', 'KM', 'COM'], ['KN', 'KN', 'KNA'], ['KP', 'KP', 'PRK'], ['KR', 'KR', 'KOR'], ['KW', 'KW', 'KWT'], ['KY', 'KY', 'CYM'], ['KZ', 'KZ', 'KAZ'], ['LA', 'LA', 'LAO'], ['LB', 'LB', 'LBN'], ['LC', 'LC', 'LCA'], ['LI', 'LI', 'LIE'], ['LK', 'LK', 'LKA'], ['LR', 'LR', 'LBR'], ['LS', 'LS', 'LSO'], ['LT', 'LT', 'LTU'], ['LU', 'LU', 'LUX'], ['LV', 'LV', 'LVA'], ['LY', 'LY', 'LBY'], ['MA', 'MA', 'MAR'], ['MC', 'MC', 'MCO'], ['MD', 'MD', 'MDA'], ['ME', 'ME', 'MNE'], ['MF', 'MF', 'MAF'], ['MG', 'MG', 'MDG'], ['MH', 'MH', 'MHL'], ['MK', 'MK', 'MKD'], ['ML', 'ML', 'MLI'], ['MM', 'MM', 'MMR'], ['MN', 'MN', 'MNG'], ['MO', 'MO', 'MAC'], ['MP', 'MP', 'MNP'], ['MQ', 'MQ', 'MTQ'], ['MR', 'MR', 'MRT'], ['MS', 'MS', 'MSR'], ['MT', 'MT', 'MLT'], ['MU', 'MU', 'MUS'], ['MV', 'MV', 'MDV'], ['MW', 'MW', 'MWI'], ['MX', 'MX', 'MEX'], ['MY', 'MY', 'MYS'], ['MZ', 'MZ', 'MOZ'], ['NA', 'NA', 'NAM'], ['NC', 'NC', 'NCL'], ['NE', 'NE', 'NER'], ['NF', 'NF', 'NFK'], ['NG', 'NG', 'NGA'], ['NI', 'NI', 'NIC'], ['NL', 'NL', 'NLD'], ['NO', 'NO', 'NOR'], ['NP', 'NP', 'NPL'], ['NR', 'NR', 'NRU'], ['NU', 'NU', 'NIU'], ['NZ', 'NZ', 'NZL'], ['OM', 'OM', 'OMN'], ['PA', 'PA', 'PAN'], ['PE', 'PE', 'PER'], ['PF', 'PF', 'PYF'], ['PG', 'PG', 'PNG'], ['PH', 'PH', 'PHL'], ['PK', 'PK', 'PAK'], ['PL', 'PL', 'POL'], ['PM', 'PM', 'SPM'], ['PN', 'PN', 'PCN'], ['PS', 'PS', 'PSE'], ['PT', 'PT', 'PRT'], ['PW', 'PW', 'PLW'], ['PY', 'PY', 'PRY'], ['QA', 'QA', 'QAT'], ['RE', 'RE', 'REU'], ['RO', 'RO', 'ROU'], ['RS', 'RS', 'SRB'], ['RU', 'RU', 'RUS'], ['RW', 'RW', 'RWA'], ['SA', 'SA', 'SAU'], ['SB', 'SB', 'SLB'], ['SC', 'SC', 'SYC'], ['SD', 'SD', 'SDN'], ['SE', 'SE', 'SWE'], ['SG', 'SG', 'SGP'], ['SH', 'SH', 'SHN'], ['SI', 'SI', 'SVN'], ['SJ', 'SJ', 'SJM'], ['SK', 'SK', 'SVK'], ['SL', 'SL', 'SLE'], ['SM', 'SM', 'SMR'], ['SN', 'SN', 'SEN'], ['SO', 'SO', 'SOM'], ['SR', 'SR', 'SUR'], ['ST', 'ST', 'STP'], ['SV', 'SV', 'SLV'], ['SY', 'SY', 'SYR'], ['SZ', 'SZ', 'SWZ'], ['TC', 'TC', 'TCA'], ['TD', 'TD', 'TCD'], ['TF', 'TF', 'ATF'], ['TG', 'TG', 'TGO'], ['TH', 'TH', 'THA'], ['TJ', 'TJ', 'TJK'], ['TK', 'TK', 'TKL'], ['TL', 'TL', 'TLS'], ['TM', 'TM', 'TKM'], ['TN', 'TN', 'TUN'], ['TO', 'TO', 'TON'], ['TR', 'TR', 'TUR'], ['TT', 'TT', 'TTO'], ['TV', 'TV', 'TUV'], ['TW', 'TW', 'TWN'], ['TZ', 'TZ', 'TZA'], ['UA', 'UA', 'UKR'], ['UG', 'UG', 'UGA'], ['UM', 'UM', 'UMI'], ['US', 'US', 'USA'], ['UY', 'UY', 'URY'], ['UZ', 'UZ', 'UZB'], ['VA', 'VA', 'VAT'], ['VC', 'VC', 'VCT'], ['VE', 'VE', 'VEN'], ['VG', 'VG', 'VGB'], ['VI', 'VI', 'VIR'], ['VN', 'VN', 'VNM'], ['VU', 'VU', 'VUT'], ['WF', 'WF', 'WLF'], ['WS', 'WS', 'WSM'], ['YE', 'YE', 'YEM'], ['YT', 'YT', 'MYT'], ['ZA', 'ZA', 'ZAF'], ['ZM', 'ZM', 'ZMB'], ['ZW', 'ZW', 'ZWE']];
     $columns = ['country_id', 'iso2_code', 'iso3_code'];
     $setup->getConnection()->insertArray($setup->getTable('directory_country'), $columns, $data);
     /**
      * Fill table directory/country_region
      * Fill table directory/country_region_name for en_US locale
      */
     $data = [['US', 'AL', 'Alabama'], ['US', 'AK', 'Alaska'], ['US', 'AS', 'American Samoa'], ['US', 'AZ', 'Arizona'], ['US', 'AR', 'Arkansas'], ['US', 'AE', 'Armed Forces Africa'], ['US', 'AA', 'Armed Forces Americas'], ['US', 'AE', 'Armed Forces Canada'], ['US', 'AE', 'Armed Forces Europe'], ['US', 'AE', 'Armed Forces Middle East'], ['US', 'AP', 'Armed Forces Pacific'], ['US', 'CA', 'California'], ['US', 'CO', 'Colorado'], ['US', 'CT', 'Connecticut'], ['US', 'DE', 'Delaware'], ['US', 'DC', 'District of Columbia'], ['US', 'FM', 'Federated States Of Micronesia'], ['US', 'FL', 'Florida'], ['US', 'GA', 'Georgia'], ['US', 'GU', 'Guam'], ['US', 'HI', 'Hawaii'], ['US', 'ID', 'Idaho'], ['US', 'IL', 'Illinois'], ['US', 'IN', 'Indiana'], ['US', 'IA', 'Iowa'], ['US', 'KS', 'Kansas'], ['US', 'KY', 'Kentucky'], ['US', 'LA', 'Louisiana'], ['US', 'ME', 'Maine'], ['US', 'MH', 'Marshall Islands'], ['US', 'MD', 'Maryland'], ['US', 'MA', 'Massachusetts'], ['US', 'MI', 'Michigan'], ['US', 'MN', 'Minnesota'], ['US', 'MS', 'Mississippi'], ['US', 'MO', 'Missouri'], ['US', 'MT', 'Montana'], ['US', 'NE', 'Nebraska'], ['US', 'NV', 'Nevada'], ['US', 'NH', 'New Hampshire'], ['US', 'NJ', 'New Jersey'], ['US', 'NM', 'New Mexico'], ['US', 'NY', 'New York'], ['US', 'NC', 'North Carolina'], ['US', 'ND', 'North Dakota'], ['US', 'MP', 'Northern Mariana Islands'], ['US', 'OH', 'Ohio'], ['US', 'OK', 'Oklahoma'], ['US', 'OR', 'Oregon'], ['US', 'PW', 'Palau'], ['US', 'PA', 'Pennsylvania'], ['US', 'PR', 'Puerto Rico'], ['US', 'RI', 'Rhode Island'], ['US', 'SC', 'South Carolina'], ['US', 'SD', 'South Dakota'], ['US', 'TN', 'Tennessee'], ['US', 'TX', 'Texas'], ['US', 'UT', 'Utah'], ['US', 'VT', 'Vermont'], ['US', 'VI', 'Virgin Islands'], ['US', 'VA', 'Virginia'], ['US', 'WA', 'Washington'], ['US', 'WV', 'West Virginia'], ['US', 'WI', 'Wisconsin'], ['US', 'WY', 'Wyoming'], ['CA', 'AB', 'Alberta'], ['CA', 'BC', 'British Columbia'], ['CA', 'MB', 'Manitoba'], ['CA', 'NL', 'Newfoundland and Labrador'], ['CA', 'NB', 'New Brunswick'], ['CA', 'NS', 'Nova Scotia'], ['CA', 'NT', 'Northwest Territories'], ['CA', 'NU', 'Nunavut'], ['CA', 'ON', 'Ontario'], ['CA', 'PE', 'Prince Edward Island'], ['CA', 'QC', 'Quebec'], ['CA', 'SK', 'Saskatchewan'], ['CA', 'YT', 'Yukon Territory'], ['DE', 'NDS', 'Niedersachsen'], ['DE', 'BAW', 'Baden-Württemberg'], ['DE', 'BAY', 'Bayern'], ['DE', 'BER', 'Berlin'], ['DE', 'BRG', 'Brandenburg'], ['DE', 'BRE', 'Bremen'], ['DE', 'HAM', 'Hamburg'], ['DE', 'HES', 'Hessen'], ['DE', 'MEC', 'Mecklenburg-Vorpommern'], ['DE', 'NRW', 'Nordrhein-Westfalen'], ['DE', 'RHE', 'Rheinland-Pfalz'], ['DE', 'SAR', 'Saarland'], ['DE', 'SAS', 'Sachsen'], ['DE', 'SAC', 'Sachsen-Anhalt'], ['DE', 'SCN', 'Schleswig-Holstein'], ['DE', 'THE', 'Thüringen'], ['AT', 'WI', 'Wien'], ['AT', 'NO', 'Niederösterreich'], ['AT', 'OO', 'Oberösterreich'], ['AT', 'SB', 'Salzburg'], ['AT', 'KN', 'Kärnten'], ['AT', 'ST', 'Steiermark'], ['AT', 'TI', 'Tirol'], ['AT', 'BL', 'Burgenland'], ['AT', 'VB', 'Vorarlberg'], ['CH', 'AG', 'Aargau'], ['CH', 'AI', 'Appenzell Innerrhoden'], ['CH', 'AR', 'Appenzell Ausserrhoden'], ['CH', 'BE', 'Bern'], ['CH', 'BL', 'Basel-Landschaft'], ['CH', 'BS', 'Basel-Stadt'], ['CH', 'FR', 'Freiburg'], ['CH', 'GE', 'Genf'], ['CH', 'GL', 'Glarus'], ['CH', 'GR', 'Graubünden'], ['CH', 'JU', 'Jura'], ['CH', 'LU', 'Luzern'], ['CH', 'NE', 'Neuenburg'], ['CH', 'NW', 'Nidwalden'], ['CH', 'OW', 'Obwalden'], ['CH', 'SG', 'St. Gallen'], ['CH', 'SH', 'Schaffhausen'], ['CH', 'SO', 'Solothurn'], ['CH', 'SZ', 'Schwyz'], ['CH', 'TG', 'Thurgau'], ['CH', 'TI', 'Tessin'], ['CH', 'UR', 'Uri'], ['CH', 'VD', 'Waadt'], ['CH', 'VS', 'Wallis'], ['CH', 'ZG', 'Zug'], ['CH', 'ZH', 'Zürich'], ['ES', 'A Coruсa', 'A Coruña'], ['ES', 'Alava', 'Alava'], ['ES', 'Albacete', 'Albacete'], ['ES', 'Alicante', 'Alicante'], ['ES', 'Almeria', 'Almeria'], ['ES', 'Asturias', 'Asturias'], ['ES', 'Avila', 'Avila'], ['ES', 'Badajoz', 'Badajoz'], ['ES', 'Baleares', 'Baleares'], ['ES', 'Barcelona', 'Barcelona'], ['ES', 'Burgos', 'Burgos'], ['ES', 'Caceres', 'Caceres'], ['ES', 'Cadiz', 'Cadiz'], ['ES', 'Cantabria', 'Cantabria'], ['ES', 'Castellon', 'Castellon'], ['ES', 'Ceuta', 'Ceuta'], ['ES', 'Ciudad Real', 'Ciudad Real'], ['ES', 'Cordoba', 'Cordoba'], ['ES', 'Cuenca', 'Cuenca'], ['ES', 'Girona', 'Girona'], ['ES', 'Granada', 'Granada'], ['ES', 'Guadalajara', 'Guadalajara'], ['ES', 'Guipuzcoa', 'Guipuzcoa'], ['ES', 'Huelva', 'Huelva'], ['ES', 'Huesca', 'Huesca'], ['ES', 'Jaen', 'Jaen'], ['ES', 'La Rioja', 'La Rioja'], ['ES', 'Las Palmas', 'Las Palmas'], ['ES', 'Leon', 'Leon'], ['ES', 'Lleida', 'Lleida'], ['ES', 'Lugo', 'Lugo'], ['ES', 'Madrid', 'Madrid'], ['ES', 'Malaga', 'Malaga'], ['ES', 'Melilla', 'Melilla'], ['ES', 'Murcia', 'Murcia'], ['ES', 'Navarra', 'Navarra'], ['ES', 'Ourense', 'Ourense'], ['ES', 'Palencia', 'Palencia'], ['ES', 'Pontevedra', 'Pontevedra'], ['ES', 'Salamanca', 'Salamanca'], ['ES', 'Santa Cruz de Tenerife', 'Santa Cruz de Tenerife'], ['ES', 'Segovia', 'Segovia'], ['ES', 'Sevilla', 'Sevilla'], ['ES', 'Soria', 'Soria'], ['ES', 'Tarragona', 'Tarragona'], ['ES', 'Teruel', 'Teruel'], ['ES', 'Toledo', 'Toledo'], ['ES', 'Valencia', 'Valencia'], ['ES', 'Valladolid', 'Valladolid'], ['ES', 'Vizcaya', 'Vizcaya'], ['ES', 'Zamora', 'Zamora'], ['ES', 'Zaragoza', 'Zaragoza'], ['FR', 1, 'Ain'], ['FR', 2, 'Aisne'], ['FR', 3, 'Allier'], ['FR', 4, 'Alpes-de-Haute-Provence'], ['FR', 5, 'Hautes-Alpes'], ['FR', 6, 'Alpes-Maritimes'], ['FR', 7, 'Ardèche'], ['FR', 8, 'Ardennes'], ['FR', 9, 'Ariège'], ['FR', 10, 'Aube'], ['FR', 11, 'Aude'], ['FR', 12, 'Aveyron'], ['FR', 13, 'Bouches-du-Rhône'], ['FR', 14, 'Calvados'], ['FR', 15, 'Cantal'], ['FR', 16, 'Charente'], ['FR', 17, 'Charente-Maritime'], ['FR', 18, 'Cher'], ['FR', 19, 'Corrèze'], ['FR', '2A', 'Corse-du-Sud'], ['FR', '2B', 'Haute-Corse'], ['FR', 21, 'Côte-d\'Or'], ['FR', 22, 'Côtes-d\'Armor'], ['FR', 23, 'Creuse'], ['FR', 24, 'Dordogne'], ['FR', 25, 'Doubs'], ['FR', 26, 'Drôme'], ['FR', 27, 'Eure'], ['FR', 28, 'Eure-et-Loir'], ['FR', 29, 'Finistère'], ['FR', 30, 'Gard'], ['FR', 31, 'Haute-Garonne'], ['FR', 32, 'Gers'], ['FR', 33, 'Gironde'], ['FR', 34, 'Hérault'], ['FR', 35, 'Ille-et-Vilaine'], ['FR', 36, 'Indre'], ['FR', 37, 'Indre-et-Loire'], ['FR', 38, 'Isère'], ['FR', 39, 'Jura'], ['FR', 40, 'Landes'], ['FR', 41, 'Loir-et-Cher'], ['FR', 42, 'Loire'], ['FR', 43, 'Haute-Loire'], ['FR', 44, 'Loire-Atlantique'], ['FR', 45, 'Loiret'], ['FR', 46, 'Lot'], ['FR', 47, 'Lot-et-Garonne'], ['FR', 48, 'Lozère'], ['FR', 49, 'Maine-et-Loire'], ['FR', 50, 'Manche'], ['FR', 51, 'Marne'], ['FR', 52, 'Haute-Marne'], ['FR', 53, 'Mayenne'], ['FR', 54, 'Meurthe-et-Moselle'], ['FR', 55, 'Meuse'], ['FR', 56, 'Morbihan'], ['FR', 57, 'Moselle'], ['FR', 58, 'Nièvre'], ['FR', 59, 'Nord'], ['FR', 60, 'Oise'], ['FR', 61, 'Orne'], ['FR', 62, 'Pas-de-Calais'], ['FR', 63, 'Puy-de-Dôme'], ['FR', 64, 'Pyrénées-Atlantiques'], ['FR', 65, 'Hautes-Pyrénées'], ['FR', 66, 'Pyrénées-Orientales'], ['FR', 67, 'Bas-Rhin'], ['FR', 68, 'Haut-Rhin'], ['FR', 69, 'Rhône'], ['FR', 70, 'Haute-Saône'], ['FR', 71, 'Saône-et-Loire'], ['FR', 72, 'Sarthe'], ['FR', 73, 'Savoie'], ['FR', 74, 'Haute-Savoie'], ['FR', 75, 'Paris'], ['FR', 76, 'Seine-Maritime'], ['FR', 77, 'Seine-et-Marne'], ['FR', 78, 'Yvelines'], ['FR', 79, 'Deux-Sèvres'], ['FR', 80, 'Somme'], ['FR', 81, 'Tarn'], ['FR', 82, 'Tarn-et-Garonne'], ['FR', 83, 'Var'], ['FR', 84, 'Vaucluse'], ['FR', 85, 'Vendée'], ['FR', 86, 'Vienne'], ['FR', 87, 'Haute-Vienne'], ['FR', 88, 'Vosges'], ['FR', 89, 'Yonne'], ['FR', 90, 'Territoire-de-Belfort'], ['FR', 91, 'Essonne'], ['FR', 92, 'Hauts-de-Seine'], ['FR', 93, 'Seine-Saint-Denis'], ['FR', 94, 'Val-de-Marne'], ['FR', 95, 'Val-d\'Oise'], ['RO', 'AB', 'Alba'], ['RO', 'AR', 'Arad'], ['RO', 'AG', 'Argeş'], ['RO', 'BC', 'Bacău'], ['RO', 'BH', 'Bihor'], ['RO', 'BN', 'Bistriţa-Năsăud'], ['RO', 'BT', 'Botoşani'], ['RO', 'BV', 'Braşov'], ['RO', 'BR', 'Brăila'], ['RO', 'B', 'Bucureşti'], ['RO', 'BZ', 'Buzău'], ['RO', 'CS', 'Caraş-Severin'], ['RO', 'CL', 'Călăraşi'], ['RO', 'CJ', 'Cluj'], ['RO', 'CT', 'Constanţa'], ['RO', 'CV', 'Covasna'], ['RO', 'DB', 'Dâmboviţa'], ['RO', 'DJ', 'Dolj'], ['RO', 'GL', 'Galaţi'], ['RO', 'GR', 'Giurgiu'], ['RO', 'GJ', 'Gorj'], ['RO', 'HR', 'Harghita'], ['RO', 'HD', 'Hunedoara'], ['RO', 'IL', 'Ialomiţa'], ['RO', 'IS', 'Iaşi'], ['RO', 'IF', 'Ilfov'], ['RO', 'MM', 'Maramureş'], ['RO', 'MH', 'Mehedinţi'], ['RO', 'MS', 'Mureş'], ['RO', 'NT', 'Neamţ'], ['RO', 'OT', 'Olt'], ['RO', 'PH', 'Prahova'], ['RO', 'SM', 'Satu-Mare'], ['RO', 'SJ', 'Sălaj'], ['RO', 'SB', 'Sibiu'], ['RO', 'SV', 'Suceava'], ['RO', 'TR', 'Teleorman'], ['RO', 'TM', 'Timiş'], ['RO', 'TL', 'Tulcea'], ['RO', 'VS', 'Vaslui'], ['RO', 'VL', 'Vâlcea'], ['RO', 'VN', 'Vrancea'], ['FI', 'Lappi', 'Lappi'], ['FI', 'Pohjois-Pohjanmaa', 'Pohjois-Pohjanmaa'], ['FI', 'Kainuu', 'Kainuu'], ['FI', 'Pohjois-Karjala', 'Pohjois-Karjala'], ['FI', 'Pohjois-Savo', 'Pohjois-Savo'], ['FI', 'Etelä-Savo', 'Etelä-Savo'], ['FI', 'Etelä-Pohjanmaa', 'Etelä-Pohjanmaa'], ['FI', 'Pohjanmaa', 'Pohjanmaa'], ['FI', 'Pirkanmaa', 'Pirkanmaa'], ['FI', 'Satakunta', 'Satakunta'], ['FI', 'Keski-Pohjanmaa', 'Keski-Pohjanmaa'], ['FI', 'Keski-Suomi', 'Keski-Suomi'], ['FI', 'Varsinais-Suomi', 'Varsinais-Suomi'], ['FI', 'Etelä-Karjala', 'Etelä-Karjala'], ['FI', 'Päijät-Häme', 'Päijät-Häme'], ['FI', 'Kanta-Häme', 'Kanta-Häme'], ['FI', 'Uusimaa', 'Uusimaa'], ['FI', 'Itä-Uusimaa', 'Itä-Uusimaa'], ['FI', 'Kymenlaakso', 'Kymenlaakso'], ['FI', 'Ahvenanmaa', 'Ahvenanmaa'], ['EE', 'EE-37', 'Harjumaa'], ['EE', 'EE-39', 'Hiiumaa'], ['EE', 'EE-44', 'Ida-Virumaa'], ['EE', 'EE-49', 'Jõgevamaa'], ['EE', 'EE-51', 'Järvamaa'], ['EE', 'EE-57', 'Läänemaa'], ['EE', 'EE-59', 'Lääne-Virumaa'], ['EE', 'EE-65', 'Põlvamaa'], ['EE', 'EE-67', 'Pärnumaa'], ['EE', 'EE-70', 'Raplamaa'], ['EE', 'EE-74', 'Saaremaa'], ['EE', 'EE-78', 'Tartumaa'], ['EE', 'EE-82', 'Valgamaa'], ['EE', 'EE-84', 'Viljandimaa'], ['EE', 'EE-86', 'Võrumaa'], ['LV', 'LV-DGV', 'Daugavpils'], ['LV', 'LV-JEL', 'Jelgava'], ['LV', 'Jēkabpils', 'Jēkabpils'], ['LV', 'LV-JUR', 'Jūrmala'], ['LV', 'LV-LPX', 'Liepāja'], ['LV', 'LV-LE', 'Liepājas novads'], ['LV', 'LV-REZ', 'Rēzekne'], ['LV', 'LV-RIX', 'Rīga'], ['LV', 'LV-RI', 'Rīgas novads'], ['LV', 'Valmiera', 'Valmiera'], ['LV', 'LV-VEN', 'Ventspils'], ['LV', 'Aglonas novads', 'Aglonas novads'], ['LV', 'LV-AI', 'Aizkraukles novads'], ['LV', 'Aizputes novads', 'Aizputes novads'], ['LV', 'Aknīstes novads', 'Aknīstes novads'], ['LV', 'Alojas novads', 'Alojas novads'], ['LV', 'Alsungas novads', 'Alsungas novads'], ['LV', 'LV-AL', 'Alūksnes novads'], ['LV', 'Amatas novads', 'Amatas novads'], ['LV', 'Apes novads', 'Apes novads'], ['LV', 'Auces novads', 'Auces novads'], ['LV', 'Babītes novads', 'Babītes novads'], ['LV', 'Baldones novads', 'Baldones novads'], ['LV', 'Baltinavas novads', 'Baltinavas novads'], ['LV', 'LV-BL', 'Balvu novads'], ['LV', 'LV-BU', 'Bauskas novads'], ['LV', 'Beverīnas novads', 'Beverīnas novads'], ['LV', 'Brocēnu novads', 'Brocēnu novads'], ['LV', 'Burtnieku novads', 'Burtnieku novads'], ['LV', 'Carnikavas novads', 'Carnikavas novads'], ['LV', 'Cesvaines novads', 'Cesvaines novads'], ['LV', 'Ciblas novads', 'Ciblas novads'], ['LV', 'LV-CE', 'Cēsu novads'], ['LV', 'Dagdas novads', 'Dagdas novads'], ['LV', 'LV-DA', 'Daugavpils novads'], ['LV', 'LV-DO', 'Dobeles novads'], ['LV', 'Dundagas novads', 'Dundagas novads'], ['LV', 'Durbes novads', 'Durbes novads'], ['LV', 'Engures novads', 'Engures novads'], ['LV', 'Garkalnes novads', 'Garkalnes novads'], ['LV', 'Grobiņas novads', 'Grobiņas novads'], ['LV', 'LV-GU', 'Gulbenes novads'], ['LV', 'Iecavas novads', 'Iecavas novads'], ['LV', 'Ikšķiles novads', 'Ikšķiles novads'], ['LV', 'Ilūkstes novads', 'Ilūkstes novads'], ['LV', 'Inčukalna novads', 'Inčukalna novads'], ['LV', 'Jaunjelgavas novads', 'Jaunjelgavas novads'], ['LV', 'Jaunpiebalgas novads', 'Jaunpiebalgas novads'], ['LV', 'Jaunpils novads', 'Jaunpils novads'], ['LV', 'LV-JL', 'Jelgavas novads'], ['LV', 'LV-JK', 'Jēkabpils novads'], ['LV', 'Kandavas novads', 'Kandavas novads'], ['LV', 'Kokneses novads', 'Kokneses novads'], ['LV', 'Krimuldas novads', 'Krimuldas novads'], ['LV', 'Krustpils novads', 'Krustpils novads'], ['LV', 'LV-KR', 'Krāslavas novads'], ['LV', 'LV-KU', 'Kuldīgas novads'], ['LV', 'Kārsavas novads', 'Kārsavas novads'], ['LV', 'Lielvārdes novads', 'Lielvārdes novads'], ['LV', 'LV-LM', 'Limbažu novads'], ['LV', 'Lubānas novads', 'Lubānas novads'], ['LV', 'LV-LU', 'Ludzas novads'], ['LV', 'Līgatnes novads', 'Līgatnes novads'], ['LV', 'Līvānu novads', 'Līvānu novads'], ['LV', 'LV-MA', 'Madonas novads'], ['LV', 'Mazsalacas novads', 'Mazsalacas novads'], ['LV', 'Mālpils novads', 'Mālpils novads'], ['LV', 'Mārupes novads', 'Mārupes novads'], ['LV', 'Naukšēnu novads', 'Naukšēnu novads'], ['LV', 'Neretas novads', 'Neretas novads'], ['LV', 'Nīcas novads', 'Nīcas novads'], ['LV', 'LV-OG', 'Ogres novads'], ['LV', 'Olaines novads', 'Olaines novads'], ['LV', 'Ozolnieku novads', 'Ozolnieku novads'], ['LV', 'LV-PR', 'Preiļu novads'], ['LV', 'Priekules novads', 'Priekules novads'], ['LV', 'Priekuļu novads', 'Priekuļu novads'], ['LV', 'Pārgaujas novads', 'Pārgaujas novads'], ['LV', 'Pāvilostas novads', 'Pāvilostas novads'], ['LV', 'Pļaviņu novads', 'Pļaviņu novads'], ['LV', 'Raunas novads', 'Raunas novads'], ['LV', 'Riebiņu novads', 'Riebiņu novads'], ['LV', 'Rojas novads', 'Rojas novads'], ['LV', 'Ropažu novads', 'Ropažu novads'], ['LV', 'Rucavas novads', 'Rucavas novads'], ['LV', 'Rugāju novads', 'Rugāju novads'], ['LV', 'Rundāles novads', 'Rundāles novads'], ['LV', 'LV-RE', 'Rēzeknes novads'], ['LV', 'Rūjienas novads', 'Rūjienas novads'], ['LV', 'Salacgrīvas novads', 'Salacgrīvas novads'], ['LV', 'Salas novads', 'Salas novads'], ['LV', 'Salaspils novads', 'Salaspils novads'], ['LV', 'LV-SA', 'Saldus novads'], ['LV', 'Saulkrastu novads', 'Saulkrastu novads'], ['LV', 'Siguldas novads', 'Siguldas novads'], ['LV', 'Skrundas novads', 'Skrundas novads'], ['LV', 'Skrīveru novads', 'Skrīveru novads'], ['LV', 'Smiltenes novads', 'Smiltenes novads'], ['LV', 'Stopiņu novads', 'Stopiņu novads'], ['LV', 'Strenču novads', 'Strenču novads'], ['LV', 'Sējas novads', 'Sējas novads'], ['LV', 'LV-TA', 'Talsu novads'], ['LV', 'LV-TU', 'Tukuma novads'], ['LV', 'Tērvetes novads', 'Tērvetes novads'], ['LV', 'Vaiņodes novads', 'Vaiņodes novads'], ['LV', 'LV-VK', 'Valkas novads'], ['LV', 'LV-VM', 'Valmieras novads'], ['LV', 'Varakļānu novads', 'Varakļānu novads'], ['LV', 'Vecpiebalgas novads', 'Vecpiebalgas novads'], ['LV', 'Vecumnieku novads', 'Vecumnieku novads'], ['LV', 'LV-VE', 'Ventspils novads'], ['LV', 'Viesītes novads', 'Viesītes novads'], ['LV', 'Viļakas novads', 'Viļakas novads'], ['LV', 'Viļānu novads', 'Viļānu novads'], ['LV', 'Vārkavas novads', 'Vārkavas novads'], ['LV', 'Zilupes novads', 'Zilupes novads'], ['LV', 'Ādažu novads', 'Ādažu novads'], ['LV', 'Ērgļu novads', 'Ērgļu novads'], ['LV', 'Ķeguma novads', 'Ķeguma novads'], ['LV', 'Ķekavas novads', 'Ķekavas novads'], ['LT', 'LT-AL', 'Alytaus Apskritis'], ['LT', 'LT-KU', 'Kauno Apskritis'], ['LT', 'LT-KL', 'Klaipėdos Apskritis'], ['LT', 'LT-MR', 'Marijampolės Apskritis'], ['LT', 'LT-PN', 'Panevėžio Apskritis'], ['LT', 'LT-SA', 'Šiaulių Apskritis'], ['LT', 'LT-TA', 'Tauragės Apskritis'], ['LT', 'LT-TE', 'Telšių Apskritis'], ['LT', 'LT-UT', 'Utenos Apskritis'], ['LT', 'LT-VL', 'Vilniaus Apskritis'], ['BR', 'AC', 'Acre'], ['BR', 'AL', 'Alagoas'], ['BR', 'AP', 'Amapá'], ['BR', 'AM', 'Amazonas'], ['BR', 'BA', 'Bahia'], ['BR', 'CE', 'Ceará'], ['BR', 'ES', 'Espírito Santo'], ['BR', 'GO', 'Goiás'], ['BR', 'MA', 'Maranhão'], ['BR', 'MT', 'Mato Grosso'], ['BR', 'MS', 'Mato Grosso do Sul'], ['BR', 'MG', 'Minas Gerais'], ['BR', 'PA', 'Pará'], ['BR', 'PB', 'Paraíba'], ['BR', 'PR', 'Paraná'], ['BR', 'PE', 'Pernambuco'], ['BR', 'PI', 'Piauí'], ['BR', 'RJ', 'Rio de Janeiro'], ['BR', 'RN', 'Rio Grande do Norte'], ['BR', 'RS', 'Rio Grande do Sul'], ['BR', 'RO', 'Rondônia'], ['BR', 'RR', 'Roraima'], ['BR', 'SC', 'Santa Catarina'], ['BR', 'SP', 'São Paulo'], ['BR', 'SE', 'Sergipe'], ['BR', 'TO', 'Tocantins'], ['BR', 'DF', 'Distrito Federal']];
     foreach ($data as $row) {
         $bind = ['country_id' => $row[0], 'code' => $row[1], 'default_name' => $row[2]];
         $setup->getConnection()->insert($setup->getTable('directory_country_region'), $bind);
         $regionId = $setup->getConnection()->lastInsertId($setup->getTable('directory_country_region'));
         $bind = ['locale' => 'en_US', 'region_id' => $regionId, 'name' => $row[2]];
         $setup->getConnection()->insert($setup->getTable('directory_country_region_name'), $bind);
     }
     /**
      * Fill table directory/currency_rate
      */
     $data = [['EUR', 'EUR', 1], ['EUR', 'USD', 1.415], ['USD', 'EUR', 0.7067], ['USD', 'USD', 1]];
     $columns = ['currency_from', 'currency_to', 'rate'];
     $setup->getConnection()->insertArray($setup->getTable('directory_currency_rate'), $columns, $data);
     $setup->getConnection()->insert($setup->getTable('core_config_data'), ['scope' => 'default', 'scope_id' => 0, 'path' => Data::XML_PATH_DISPLAY_ALL_STATES, 'value' => 1]);
     $countries = $this->directoryData->getCountryCollection()->getCountriesWithRequiredStates();
     $setup->getConnection()->insert($setup->getTable('core_config_data'), ['scope' => 'default', 'scope_id' => 0, 'path' => Data::XML_PATH_STATES_REQUIRED, 'value' => implode(',', array_keys($countries))]);
 }
开发者ID:rahulkumars,项目名称:magento2,代码行数:34,代码来源:InstallData.php


示例4: validateValue

 /**
  * @param string $value
  * @return true|string[]
  */
 public function validateValue($value)
 {
     $countryId = $this->getExtractedData('country_id');
     $optionalZip = $this->_directoryData->getCountriesWithOptionalZip();
     if (!in_array($countryId, $optionalZip)) {
         return parent::validateValue($value);
     }
     return true;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:13,代码来源:Postcode.php


示例5: getElementHtml

 /**
  * Add Weight Switcher radio-button element html to weight field
  *
  * @return string
  */
 public function getElementHtml()
 {
     if (!$this->getForm()->getDataObject()->getTypeInstance()->hasWeight()) {
         $this->weightSwitcher->setValue(WeightResolver::HAS_NO_WEIGHT);
     }
     if ($this->getDisabled()) {
         $this->weightSwitcher->setDisabled($this->getDisabled());
     }
     return '<div class="admin__field-control weight-switcher">' . '<div class="admin__control-switcher" data-role="weight-switcher">' . $this->weightSwitcher->getLabelHtml() . '<div class="admin__field-control-group">' . $this->weightSwitcher->getElementHtml() . '</div>' . '</div>' . '<div class="admin__control-addon">' . parent::getElementHtml() . '<label class="admin__addon-suffix" for="' . $this->getHtmlId() . '"><span>' . $this->directoryHelper->getWeightUnit() . '</span></label>' . '</div>' . '</div>';
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:Weight.php


示例6: testValidateValue

 /**
  * @param string $value to assign to boolean
  * @param bool $expected text output
  * @param string $countryId
  * @param bool $isOptional
  *
  * @dataProvider validateValueDataProvider
  */
 public function testValidateValue($value, $expected, $countryId, $isOptional)
 {
     $storeLabel = 'Zip/Postal Code';
     $this->attributeMetadataMock->expects($this->once())->method('getStoreLabel')->willReturn($storeLabel);
     $this->directoryHelper->expects($this->once())->method('isZipCodeOptional')->willReturnMap([[$countryId, $isOptional]]);
     $object = $this->getClass($value);
     $object->setExtractedData(['country_id' => $countryId]);
     $actual = $object->validateValue($value);
     $this->assertEquals($expected, $actual);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:18,代码来源:PostcodeTest.php


示例7: testValidateValue

 /**
  * @param string $value to assign to boolean
  * @param bool $expected text output
  * @param string $countryId
  * @param bool $isOptional
  *
  * @dataProvider validateValueDataProvider
  */
 public function testValidateValue($value, $expected, $countryId, $isOptional)
 {
     $storeLabel = 'Zip/Postal Code';
     $this->attributeMock->expects($this->once())->method('getStoreLabel')->willReturn($storeLabel);
     $this->directoryHelperMock->expects($this->once())->method('isZipCodeOptional')->willReturnMap([[$countryId, $isOptional]]);
     $object = new \Magento\Customer\Model\Attribute\Data\Postcode($this->localeMock, $this->loggerMock, $this->localeResolverMock, $this->directoryHelperMock);
     $object->setAttribute($this->attributeMock);
     $object->setExtractedData(['country_id' => $countryId]);
     $actual = $object->validateValue($value);
     $this->assertEquals($expected, $actual);
 }
开发者ID:IlyaGluschenko,项目名称:test001,代码行数:19,代码来源:PostcodeTest.php


示例8: getConfigurationCountryCode

 /**
  * Get selected merchant country code in system configuration
  *
  * @return string
  */
 public function getConfigurationCountryCode()
 {
     $countryCode = $this->_request->getParam(\Magento\Paypal\Model\Config\StructurePlugin::REQUEST_PARAM_COUNTRY);
     if ($countryCode === null || preg_match('/^[a-zA-Z]{2}$/', $countryCode) == 0) {
         $countryCode = $this->_backendConfig->getConfigDataValue(\Magento\Paypal\Block\Adminhtml\System\Config\Field\Country::FIELD_CONFIG_PATH);
     }
     if (empty($countryCode)) {
         $countryCode = $this->directoryHelper->getDefaultCountry();
     }
     return $countryCode;
 }
开发者ID:nja78,项目名称:magento2,代码行数:16,代码来源:Backend.php


示例9: _afterLoad

 /**
  * Substitute empty value with Default country.
  *
  * @return void
  */
 protected function _afterLoad()
 {
     $value = (string) $this->getValue();
     if (empty($value)) {
         if ($this->getWebsite()) {
             $defaultCountry = $this->_storeManager->getWebsite($this->getWebsite())->getConfig(\Magento\Directory\Helper\Data::XML_PATH_DEFAULT_COUNTRY);
         } else {
             $defaultCountry = $this->directoryHelper->getDefaultCountry($this->getStore());
         }
         $this->setValue($defaultCountry);
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:17,代码来源:MerchantCountry.php


示例10: getCountryInfo

 /**
  * {@inheritdoc}
  */
 public function getCountryInfo($countryId)
 {
     $store = $this->storeManager->getStore();
     $storeLocale = $this->scopeConfig->getValue('general/locale/code', \Magento\Store\Model\ScopeInterface::SCOPE_STORES, $store->getCode());
     $countries = $this->directoryHelper->getCountryCollection($store)->addCountryIdFilter($countryId)->load();
     if ($countries->count() == 0) {
         throw new NoSuchEntityException(__('Requested country is not available.'));
     }
     $regions = $this->directoryHelper->getRegionData();
     $country = $countries->getItemById($countryId);
     $countryInfo = $this->setCountryInfo($country, $regions, $storeLocale);
     return $countryInfo;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:CountryInformationAcquirer.php


示例11: isZipCodeRequired

 /**
  * Determine whether zip-code is required for the country of destination
  *
  * @param string|null $countryId
  * @return bool
  */
 public function isZipCodeRequired($countryId = null)
 {
     if ($countryId != null) {
         return !$this->_directoryData->isZipCodeOptional($countryId);
     }
     return true;
 }
开发者ID:Coplex,项目名称:magento2,代码行数:13,代码来源:AbstractCarrierOnline.php


示例12: _validate

 /**
  * Validate Customer Addresses attribute values.
  *
  * @param CustomerAddressModel $customerAddressModel the model to validate
  * @return InputException
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 private function _validate(CustomerAddressModel $customerAddressModel)
 {
     $exception = new InputException();
     if ($customerAddressModel->getShouldIgnoreValidation()) {
         return $exception;
     }
     if (!\Zend_Validate::is($customerAddressModel->getFirstname(), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'firstname']));
     }
     if (!\Zend_Validate::is($customerAddressModel->getLastname(), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'lastname']));
     }
     if (!\Zend_Validate::is($customerAddressModel->getStreetLine(1), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'street']));
     }
     if (!\Zend_Validate::is($customerAddressModel->getCity(), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'city']));
     }
     if (!\Zend_Validate::is($customerAddressModel->getTelephone(), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'telephone']));
     }
     $havingOptionalZip = $this->directoryData->getCountriesWithOptionalZip();
     if (!in_array($customerAddressModel->getCountryId(), $havingOptionalZip) && !\Zend_Validate::is($customerAddressModel->getPostcode(), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'postcode']));
     }
     if (!\Zend_Validate::is($customerAddressModel->getCountryId(), 'NotEmpty')) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'countryId']));
     }
     if ($customerAddressModel->getCountryModel()->getRegionCollection()->getSize() && !\Zend_Validate::is($customerAddressModel->getRegionId(), 'NotEmpty') && $this->directoryData->isRegionRequired($customerAddressModel->getCountryId())) {
         $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'regionId']));
     }
     return $exception;
 }
开发者ID:nja78,项目名称:magento2,代码行数:42,代码来源:AddressRepository.php


示例13: testGetDefaultCountry

 public function testGetDefaultCountry()
 {
     $storeId = 'storeId';
     $country = 'country';
     $this->scopeConfigMock->expects($this->once())->method('getValue')->with(Data::XML_PATH_DEFAULT_COUNTRY, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId)->will($this->returnValue($country));
     $this->assertEquals($country, $this->_object->getDefaultCountry($storeId));
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:7,代码来源:DataTest.php


示例14: toOptionArray

 /**
  * Convert collection items to select options array
  *
  * @param string|boolean $emptyLabel
  * @return array
  */
 public function toOptionArray($emptyLabel = ' ')
 {
     $options = $this->_toOptionArray('country_id', 'name', ['title' => 'iso2_code']);
     $sort = [];
     foreach ($options as $data) {
         $name = (string) $this->_localeLists->getCountryTranslation($data['value']);
         if (!empty($name)) {
             $sort[$name] = $data['value'];
         }
     }
     $this->_arrayUtils->ksortMultibyte($sort, $this->_localeResolver->getLocale());
     foreach (array_reverse($this->_foregroundCountries) as $foregroundCountry) {
         $name = array_search($foregroundCountry, $sort);
         unset($sort[$name]);
         $sort = [$name => $foregroundCountry] + $sort;
     }
     $options = [];
     foreach ($sort as $label => $value) {
         $option = ['value' => $value, 'label' => $label];
         if ($this->helperData->isRegionRequired($value)) {
             $option['is_region_required'] = true;
         }
         $options[] = $option;
     }
     if (count($options) > 0 && $emptyLabel !== false) {
         array_unshift($options, ['value' => '', 'label' => $emptyLabel]);
     }
     return $options;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:35,代码来源:Collection.php


示例15: testValidate

 /**
  * @param $data
  * @param $expected
  *
  * @dataProvider validateDataProvider
  */
 public function testValidate($data, $expected)
 {
     $this->directoryDataMock->expects($this->once())->method('getCountriesWithOptionalZip')->will($this->returnValue([]));
     $this->directoryDataMock->expects($this->never())->method('isRegionRequired');
     $this->model->setData($data);
     $this->assertEquals($expected, $this->model->validate());
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:13,代码来源:AbstractAddressTest.php


示例16: validate

 /**
  * Validate address attribute values
  *
  * @return bool|array
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function validate()
 {
     $errors = [];
     if (!\Zend_Validate::is($this->getFirstname(), 'NotEmpty')) {
         $errors[] = __('Please enter the first name.');
     }
     if (!\Zend_Validate::is($this->getLastname(), 'NotEmpty')) {
         $errors[] = __('Please enter the last name.');
     }
     if (!\Zend_Validate::is($this->getStreetLine(1), 'NotEmpty')) {
         $errors[] = __('Please enter the street.');
     }
     if (!\Zend_Validate::is($this->getCity(), 'NotEmpty')) {
         $errors[] = __('Please enter the city.');
     }
     if (!\Zend_Validate::is($this->getTelephone(), 'NotEmpty')) {
         $errors[] = __('Please enter the phone number.');
     }
     $_havingOptionalZip = $this->_directoryData->getCountriesWithOptionalZip();
     if (!in_array($this->getCountryId(), $_havingOptionalZip) && !\Zend_Validate::is($this->getPostcode(), 'NotEmpty')) {
         $errors[] = __('Please enter the zip/postal code.');
     }
     if (!\Zend_Validate::is($this->getCountryId(), 'NotEmpty')) {
         $errors[] = __('Please enter the country.');
     }
     if ($this->getCountryModel()->getRegionCollection()->getSize() && !\Zend_Validate::is($this->getRegionId(), 'NotEmpty') && $this->_directoryData->isRegionRequired($this->getCountryId())) {
         $errors[] = __('Please enter the state/province.');
     }
     if (empty($errors) || $this->getShouldIgnoreValidation()) {
         return true;
     }
     return $errors;
 }
开发者ID:opexsw,项目名称:magento2,代码行数:40,代码来源:AbstractAddress.php


示例17: getCountryId

 /**
  * @return string
  */
 public function getCountryId()
 {
     $countryId = $this->getData('country_id');
     if ($countryId === null) {
         $countryId = $this->directoryHelper->getDefaultCountry();
     }
     return $countryId;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:11,代码来源:Data.php


示例18: validateValue

 /**
  * Validate postal/zip code
  * Return true and skip validation if country zip code is optional
  *
  * @param array|null|string $value
  * @return array|bool
  */
 public function validateValue($value)
 {
     $attribute = $this->getAttribute();
     $label = __($attribute->getStoreLabel());
     $countryId = $this->getExtractedData('country_id');
     if ($this->directoryHelper->isZipCodeOptional($countryId)) {
         return true;
     }
     $errors = [];
     if (empty($value) && $value !== '0') {
         $errors[] = __('"%1" is a required value.', $label);
     }
     if (count($errors) == 0) {
         return true;
     }
     return $errors;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:24,代码来源:Postcode.php


示例19: afterLoad

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Model\CurrencyFactory类代码示例发布时间:2022-05-23
下一篇:
PHP Adminhtml\CustomerIndex类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap