-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Preconditions (*)
- Magento 2.4.7-p7
- Module 1.6.4
Steps to reproduce (*)
- Place an order
Expected result (*)
- View the success page
Actual result (*)
- The Magento error page is shown, "There has been an error processing your request"
- The error in the report is
Warning: Undefined array key 104 in /var/www/deploy/releases/20251112204937/vendor/meta/module-conversion/Model/Tracker/Purchase.php on line 189
This is the line of code causing the error
meta-for-magento2/app/code/Meta/Conversion/Model/Tracker/Purchase.php
Lines 184 to 191 in eef709e
| if ($order->getCustomerGender()) { | |
| $genderId = $order->getCustomerGender(); | |
| $userData[AAMSettingsFields::GENDER] = | |
| $this->magentoDataHelper->hashValue( | |
| $this->customerMetadata->getAttributeMetadata('gender') | |
| ->getOptions()[$genderId]->getLabel() | |
| ); | |
| } |
There probably needs to be an additional condition to make sure the $genderId exists in the array before calling the ->getLabel() method, for example:
if ($order->getCustomerGender()) {
$genderId = $order->getCustomerGender();
$gender = $this->customerMetadata->getAttributeMetadata('gender')
->getOptions()[$genderId] ?? false;
if ($gender) {
$userData[AAMSettingsFields::GENDER] =
$this->magentoDataHelper->hashValue($gender->getLabel());
}
}Metadata
Metadata
Assignees
Labels
No labels
