本文整理汇总了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'));
}
示例2: getConfig
/**
* @param string $key
* @return null|string
*/
public function getConfig($key)
{
return $this->_addressHelper->getConfig($key);
}
示例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
*****************************************************************************
//.........这里部分代码省略.........
示例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));
}