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


PHP Address::getConfig方法代碼示例

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


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

示例1: testGetConfigCanShowConfig

 public function testGetConfigCanShowConfig()
 {
     $result = ['key1' => 'value1', 'key2' => 'value2'];
     $store = $this->getMockBuilder('Magento\\Store\\Model\\Store')->disableOriginalConstructor()->getMock();
     $store->expects($this->any())->method('getWebsiteId')->will($this->returnValue('1'));
     $this->scopeConfig->expects($this->once())->method('getValue')->with('customer/address', \Magento\Framework\Store\ScopeInterface::SCOPE_STORE, $store)->will($this->returnValue($result));
     $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($store));
     $this->assertNull($this->helper->getConfig('unavailable_key'));
     $this->assertFalse($this->helper->canShowConfig('unavailable_key'));
     $this->assertEquals($result['key1'], $this->helper->getConfig('key1'));
     $this->assertEquals($result['key2'], $this->helper->getConfig('key2'));
     $this->assertTrue($this->helper->canShowConfig('key1'));
     $this->assertTrue($this->helper->canShowConfig('key2'));
 }
開發者ID:,項目名稱:,代碼行數:14,代碼來源:

示例2: getConfig

 /**
  * @param string $key
  * @return null|string
  */
 public function getConfig($key)
 {
     return $this->_addressHelper->getConfig($key);
 }
開發者ID:tingyeeh,項目名稱:magento2,代碼行數:8,代碼來源:AbstractWidget.php

示例3: install

 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     /** @var EavSetup $eavSetup */
     $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
     $setup->startSetup();
     $connection = $setup->getConnection();
     $select = $connection->select()->from($setup->getTable('core_config_data'), 'COUNT(*)')->where('path=?', 'customer/address/prefix_show')->where('value NOT LIKE ?', '0');
     $showPrefix = (bool) $this->customerAddress->getConfig('prefix_show') || $connection->fetchOne($select) > 0;
     $select = $connection->select()->from($setup->getTable('core_config_data'), 'COUNT(*)')->where('path=?', 'customer/address/middlename_show')->where('value NOT LIKE ?', '0');
     $showMiddlename = (bool) $this->customerAddress->getConfig('middlename_show') || $connection->fetchOne($select) > 0;
     $select = $connection->select()->from($setup->getTable('core_config_data'), 'COUNT(*)')->where('path=?', 'customer/address/suffix_show')->where('value NOT LIKE ?', '0');
     $showSuffix = (bool) $this->customerAddress->getConfig('suffix_show') || $connection->fetchOne($select) > 0;
     $select = $connection->select()->from($setup->getTable('core_config_data'), 'COUNT(*)')->where('path=?', 'customer/address/dob_show')->where('value NOT LIKE ?', '0');
     $showDob = (bool) $this->customerAddress->getConfig('dob_show') || $connection->fetchOne($select) > 0;
     $select = $connection->select()->from($setup->getTable('core_config_data'), 'COUNT(*)')->where('path=?', 'customer/address/taxvat_show')->where('value NOT LIKE ?', '0');
     $showTaxVat = (bool) $this->customerAddress->getConfig('taxvat_show') || $connection->fetchOne($select) > 0;
     $customerEntityTypeId = $eavSetup->getEntityTypeId('customer');
     $addressEntityTypeId = $eavSetup->getEntityTypeId('customer_address');
     /**
      *****************************************************************************
      * checkout/onepage/register
      *****************************************************************************
      */
     $connection->insert($setup->getTable('eav_form_type'), ['code' => 'checkout_onepage_register', 'label' => 'checkout_onepage_register', 'is_system' => 1, 'theme' => '', 'store_id' => 0]);
     $formTypeId = $connection->lastInsertId($setup->getTable('eav_form_type'));
     $connection->insert($setup->getTable('eav_form_type_entity'), ['type_id' => $formTypeId, 'entity_type_id' => $customerEntityTypeId]);
     $connection->insert($setup->getTable('eav_form_type_entity'), ['type_id' => $formTypeId, 'entity_type_id' => $addressEntityTypeId]);
     $elementSort = 0;
     if ($showPrefix) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'prefix'), 'sort_order' => $elementSort++]);
     }
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'firstname'), 'sort_order' => $elementSort++]);
     if ($showMiddlename) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'middlename'), 'sort_order' => $elementSort++]);
     }
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'lastname'), 'sort_order' => $elementSort++]);
     if ($showSuffix) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'suffix'), 'sort_order' => $elementSort++]);
     }
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'company'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'email'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'street'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'city'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'region'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'postcode'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'country_id'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'telephone'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'fax'), 'sort_order' => $elementSort++]);
     if ($showDob) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'dob'), 'sort_order' => $elementSort++]);
     }
     if ($showTaxVat) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'taxvat'), 'sort_order' => $elementSort++]);
     }
     /**
      *****************************************************************************
      * checkout/onepage/register_guest
      *****************************************************************************
      */
     $connection->insert($setup->getTable('eav_form_type'), ['code' => 'checkout_onepage_register_guest', 'label' => 'checkout_onepage_register_guest', 'is_system' => 1, 'theme' => '', 'store_id' => 0]);
     $formTypeId = $connection->lastInsertId($setup->getTable('eav_form_type'));
     $connection->insert($setup->getTable('eav_form_type_entity'), ['type_id' => $formTypeId, 'entity_type_id' => $customerEntityTypeId]);
     $connection->insert($setup->getTable('eav_form_type_entity'), ['type_id' => $formTypeId, 'entity_type_id' => $addressEntityTypeId]);
     $elementSort = 0;
     if ($showPrefix) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'prefix'), 'sort_order' => $elementSort++]);
     }
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'firstname'), 'sort_order' => $elementSort++]);
     if ($showMiddlename) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'middlename'), 'sort_order' => $elementSort++]);
     }
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'lastname'), 'sort_order' => $elementSort++]);
     if ($showSuffix) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'suffix'), 'sort_order' => $elementSort++]);
     }
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'company'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'email'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'street'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'city'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'region'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'postcode'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'country_id'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'telephone'), 'sort_order' => $elementSort++]);
     $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($addressEntityTypeId, 'fax'), 'sort_order' => $elementSort++]);
     if ($showDob) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'dob'), 'sort_order' => $elementSort++]);
     }
     if ($showTaxVat) {
         $connection->insert($setup->getTable('eav_form_element'), ['type_id' => $formTypeId, 'fieldset_id' => null, 'attribute_id' => $eavSetup->getAttributeId($customerEntityTypeId, 'taxvat'), 'sort_order' => $elementSort++]);
     }
     /**
      *****************************************************************************
      * checkout/onepage/billing_address
      *****************************************************************************
//.........這裏部分代碼省略.........
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:101,代碼來源:InstallData.php

示例4: getNameSuffixOptions

 /**
  * Retrieve name suffix dropdown options
  *
  * @param null $store
  * @return array|bool
  */
 public function getNameSuffixOptions($store = null)
 {
     return $this->_prepareNamePrefixSuffixOptions($this->addressHelper->getConfig('suffix_options', $store));
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:10,代碼來源:Options.php


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