Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Issue: Customer name in admin order management is "Guest" #18640

Closed
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,14 @@ public function execute()
$data['backend_model'] = $this->productHelper->getAttributeBackendModelByInputType(
$data['frontend_input']
);

if ($model->getIsUserDefined() === null) {
$data['backend_type'] = $model->getBackendTypeByInput($data['frontend_input']);
}
}

$data += ['is_filterable' => 0, 'is_filterable_in_search' => 0];

if ($model->getIsUserDefined() === null || $model->getIsUserDefined() != 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please tell what is the reason of changes in this file? How is it related to the original issue?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slavvka you are right, I cloned my previous fixes and pushed in that so the previous files are also reflecting..... i will update it...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maheshWebkul721 Thank you! And please revert all empty lines that you removed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maheshWebkul721 I would suggest you recreated your fix from the scratch and force-pushed it to ensure you don't have not needed changes.

$data['backend_type'] = $model->getBackendTypeByInput($data['frontend_input']);
}

$defaultValueField = $model->getDefaultValueByInput($data['frontend_input']);
if ($defaultValueField) {
$data['default_value'] = $this->getRequest()->getParam($defaultValueField);
Expand Down Expand Up @@ -327,8 +327,7 @@ private function preprocessOptionsData(&$data)
$serializedOptions = json_decode($data['serialized_options'], JSON_OBJECT_AS_ARRAY);
foreach ($serializedOptions as $serializedOption) {
$option = [];
$serializedOptionWithParsedAmpersand = str_replace('&', '%26', $serializedOption);
parse_str($serializedOptionWithParsedAmpersand, $option);
parse_str($this->escapeSpecialChars($serializedOption), $option);
$data = array_replace_recursive($data, $option);
}
}
Expand Down Expand Up @@ -356,6 +355,18 @@ private function returnResult($path = '', array $params = [], array $response =
return $this->resultFactory->create(ResultFactory::TYPE_REDIRECT)->setPath($path, $params);
}

/**
* @param string $value
* @return string
*/
private function escapeSpecialChars($value)
{
$valueArray = explode("=", $value);
$valueArray[1] = isset($valueArray[1])? urlencode($valueArray[1]):'';
$finalValue = implode("=", $valueArray);
return $finalValue;
}

/**
* Define whether request is Ajax
*
Expand Down
7 changes: 6 additions & 1 deletion app/code/Magento/Quote/Model/QuoteManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,13 @@ public function placeOrder($cartId, PaymentInterface $paymentMethod = null)
}

if ($quote->getCheckoutMethod() === self::METHOD_GUEST) {
$billingAddress = $quote->getBillingAddress();

$quote->setCustomerId(null);
$quote->setCustomerEmail($quote->getBillingAddress()->getEmail());
$quote->setCustomerEmail($billingAddress->getEmail());
$quote->setCustomerFirstname($billingAddress->getFirstname());
$quote->setCustomerMiddlename($billingAddress->getMiddlename());
$quote->setCustomerLastname($billingAddress->getLastname());
$quote->setCustomerIsGuest(true);
$quote->setCustomerGroupId(\Magento\Customer\Api\Data\GroupInterface::NOT_LOGGED_IN_ID);
}
Expand Down