From de1ac00ce0081d8349817c6f12c80f3ff2e757bd Mon Sep 17 00:00:00 2001 From: Misso Marchewsky Date: Tue, 23 Mar 2021 20:24:27 -0300 Subject: [PATCH 1/2] fix: customer attr select on federal_tax_payer_id --- Model/Config/Source/CustomerAttribute.php | 58 +++++++++++++++++++++++ etc/adminhtml/system.xml | 2 +- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 Model/Config/Source/CustomerAttribute.php diff --git a/Model/Config/Source/CustomerAttribute.php b/Model/Config/Source/CustomerAttribute.php new file mode 100644 index 0000000..92a6b9e --- /dev/null +++ b/Model/Config/Source/CustomerAttribute.php @@ -0,0 +1,58 @@ +collectionFactory = $collectionFactory; + } + + /** + * @return array + */ + public function toOptionArray(): array + { + $collection = $this->collectionFactory + ->create() + ->setEntityTypeFilter(CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER) + ->addOrder('frontend_label', 'ASC'); + + $result = [ + [ + 'value' => '', + 'label' => __('Select CPF attribute') + ] + ]; + + foreach ($collection as $item) { + $result[] = [ + 'value' => $item->getAttributeCode(), + 'label' => $item->getFrontendLabel() + ]; + } + + return $result; + } +} diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 6bf9f5f..e80fae4 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -20,7 +20,7 @@ - Intelipost\Quote\Model\Config\Source\Attribute + Intelipost\Push\Model\Config\Source\CustomerAttribute Select CPF attribute From ec71e6f492fa8315b5647a328fb19fe99562b47c Mon Sep 17 00:00:00 2001 From: Misso Marchewsky Date: Tue, 23 Mar 2021 20:26:16 -0300 Subject: [PATCH 2/2] fix: remove unused const --- Model/Config/Source/CustomerAttribute.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/Model/Config/Source/CustomerAttribute.php b/Model/Config/Source/CustomerAttribute.php index 92a6b9e..2898e7e 100644 --- a/Model/Config/Source/CustomerAttribute.php +++ b/Model/Config/Source/CustomerAttribute.php @@ -14,8 +14,6 @@ class CustomerAttribute implements OptionSourceInterface { - const CUSTOMER_EAV_ENTITY_TYPE_ID = 1; - /** * @var CollectionFactory */