Open markshust opened 2 years ago
Hi @markshust. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:
Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release
For more details, review the Magento Contributor Assistant documentation.
Add a comment to assign the issue: @magento I am working on this
To learn more about issue processing workflow, refer to the Code Contributions.
Join Magento Community Engineering Slack and ask your questions in #github channel.
:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
:clock10: You can find the schedule on the Magento Community Calendar page.
:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel
:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
@magento give me 2.4-develop instance
Hi @markshust. Thank you for your request. I'm working on Magento instance for you.
Hi @markshust, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.
@magento give me 2.4-develop instance
Hi @markshust. Thank you for your request. I'm working on Magento instance for you.
Hi @markshust, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.
@magento give me 2.4-develop instance
Hi @markshust. Thank you for your request. I'm working on Magento instance for you.
Hi @markshust, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.
@magento give me 2.4-develop instance
Hi @markshust. Thank you for your request. I'm working on Magento instance for you.
Hi @markshust, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.
@magento give me 2.4-develop instance
Hi @markshust. Thank you for your request. I'm working on Magento instance for you.
Hi @markshust, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.
Hi @engcom-Lima. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
[ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).Details
If the issue has a valid description, the label Issue: Format is valid
will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid
appears.
[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description
label to the issue by yourself.
[ ] 3. Add Component: XXXXX
label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.4-develop
branchDetails
- Add the comment @magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
[ ] 5. Add label Issue: Confirmed
once verification is complete.
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hi @markshust ,
Thank you for reporting the issue.
We were able to reproduce this issue on 2.4-develop instance.
Steps followed to reproduce the issue :-
app/code/MarkShust/MyModule/registration.php
<?php declare(strict_types=1);
use Magento\Framework\Component\ComponentRegistrar;
ComponentRegistrar::register(
ComponentRegistrar::MODULE,
'MarkShust_MyModule',
__DIR__
);
app/code/MarkShust/MyModule/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="MarkShust_MyModule">
<sequence>
<module name="Magento_Customer"/>
</sequence>
</module>
</config>
app/code/MarkShust/MyModule/Setup/Patch/Data/AddAddressClassificationAttribute.php
<?php declare(strict_types=1);
namespace MarkShust\MyModule\Setup\Patch\Data;
use Magento\Customer\Api\AddressMetadataInterface;
use Magento\Eav\Model\Config as EavConfig;
use Magento\Framework\Exception\AlreadyExistsException;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Customer\Model\ResourceModel\Attribute as AttributeResourceModel;
use MarkShust\MyModule\Model\Config\Source\AddressClassification;
use Zend_Validate_Exception;
class AddAddressClassificationAttribute implements DataPatchInterface
{
const ATTRIBUTE_CODE = 'address_classification';
private AttributeResourceModel $attributeResourceModel;
private EavConfig $eavConfig;
private EavSetupFactory $eavSetupFactory;
private ModuleDataSetupInterface $moduleDataSetup;
public function __construct(
AttributeResourceModel $attributeResourceModel,
EavConfig $eavConfig,
EavSetupFactory $eavSetupFactory,
ModuleDataSetupInterface $moduleDataSetup
) {
$this->attributeResourceModel = $attributeResourceModel;
$this->eavConfig = $eavConfig;
$this->eavSetupFactory = $eavSetupFactory;
$this->moduleDataSetup = $moduleDataSetup;
}
/**
* @return array
*/
public static function getDependencies(): array
{
return [];
}
/**
* @return array
*/
public function getAliases(): array
{
return [];
}
/**
* @return $this
* @throws LocalizedException
* @throws AlreadyExistsException
* @throws Zend_Validate_Exception
*/
public function apply(): self
{
$eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);
$eavSetup->addAttribute(
AddressMetadataInterface::ENTITY_TYPE_ADDRESS,
self::ATTRIBUTE_CODE,
[
'type' => 'int',
'label' => 'Address Classification',
'input' => 'select',
'source' => AddressClassification::class,
'required' => true,
'default' => 0,
'system' => false,
'position' => 150,
'sort_order' => 150,
]
);
$attribute = $this->eavConfig->getAttribute(
AddressMetadataInterface::ENTITY_TYPE_ADDRESS,
self::ATTRIBUTE_CODE
);
$attribute->setData('used_in_forms', [
'adminhtml_customer_address',
'customer_address_edit',
'customer_register_address',
]);
$this->attributeResourceModel->save($attribute);
return $this;
}
}
app/code/MarkShust/MyModule/Model/Config/Source/AddressClassification.php
<?php declare(strict_types=1);
namespace MarkShust\MyModule\Model\Config\Source;
use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource;
use Magento\Eav\Model\Entity\Attribute\Source\SourceInterface;
use Magento\Framework\Data\OptionSourceInterface;
class AddressClassification extends AbstractSource implements OptionSourceInterface, SourceInterface
{
public function getAllOptions(): array
{
return [
[
'value' => 0,
'label' => 'Residential',
],
[
'value' => 1,
'label' => 'Commercial',
],
];
}
}
bin/magento module:enable MarkShust_MyModule
bin/magento setup:upgrade
Expected Result: The custom address attribute should be rendered just as it is being rendered for previous addresses.
Actual Result: Custom address attribute is not rendered.
As we can see above, the attribute Residential is set for default address but not for newly added address. Based on this confirming the issue.
Thanks!
:x: Something went wrong. Cannot create Jira issue.
Hello @engcom-Lima,
Thanks for your input!
As per our discussion in the triage call, please try to reproduce the issue with the fresh Magento module.
Thanks
Hi @engcom-Hotel, I tried reproducing the issue with the fresh Magento 2.4-develop instance and the issue is still reproducible. I created the custom module and added the patch script following the documentation and as per the reproducible steps mentioned by @markshust I was able to reproduce the issue.
Based on this confirming the issue!
Thanks.
:x: You don't have permission to export this issue.
:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-2341 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
We have tried to reproduce the issue in the latest development branch i.e. 2.4-develop and the issue is still relevant. The added attribute is not visible in the checkout page:
We have selected Residential
while adding new address:
But it is not showing here:
Also we are unable to checkout with address because the Address Classification
field is marked as required
:
Hence reconfirming the issue and prioritize it as P1.
Thanks
Hi @markshust,
The Magento core engineering team is working on the issue and may do further implementation to cover few more scenarios as needed. We will reach out to you if we need more information.
Thank you once again!
Custom customer address EAV attributes of
'type' => 'int'
and'input' => 'select'
do not render after a logged-in customer creates a new address at checkout.Preconditions (*)
Steps to reproduce (*)
'type' => 'int'
and'input' => 'select'
. Ensure'system' => false
so it's created as a "custom" attribute.app/code/MarkShust/MyModule/registration.php
app/code/MarkShust/MyModule/etc/module.xml
app/code/MarkShust/MyModule/Setup/Patch/Data/AddAddressClassificationAttribute.php
app/code/MarkShust/MyModule/Model/Config/Source/AddressClassification.php
bin/magento module:enable MarkShust_MyModule
.bin/magento setup:upgrade
.Expected result (*)
custom_attributes
property. This differs from the data stored for the new customer address as explained in the Actual result info below. They are also stored as an object containing alabel
andvalue
, as opposed to just an integer:Actual result (*)
newCustomerShippingAddress
property, and as an integer (address_classification: 0
).