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

implement fix for wrong sAddresses data issue. consider userId to get… #2702

Open
wants to merge 3 commits into
base: 5.7
Choose a base branch
from
Open
Changes from 1 commit
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
17 changes: 9 additions & 8 deletions engine/Shopware/Controllers/Frontend/Checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ public function finishAction()
$orderVariables = $this->session['sOrderVariables']->getArrayCopy();

if (!empty($orderVariables['sOrderNumber'])) {
$orderVariables['sAddresses']['billing'] = $this->getOrderAddress($orderVariables['sOrderNumber'], 'billing');
$orderVariables['sAddresses']['shipping'] = $this->getOrderAddress($orderVariables['sOrderNumber'], 'shipping');
$orderVariables['sAddresses']['billing'] = $this->getOrderAddress($orderVariables['sOrderNumber'], Shopware()->Session()->get('sUserId'), 'billing');
mitelg marked this conversation as resolved.
Show resolved Hide resolved
$orderVariables['sAddresses']['shipping'] = $this->getOrderAddress($orderVariables['sOrderNumber'], Shopware()->Session()->get('sUserId'), 'shipping');
$orderVariables['sAddresses']['equal'] = $this->areAddressesEqual($orderVariables['sAddresses']['billing'], $orderVariables['sAddresses']['shipping']);
}

Expand Down Expand Up @@ -407,8 +407,8 @@ public function finishAction()
$orderVariables = $this->session['sOrderVariables']->getArrayCopy();

if (!empty($orderVariables['sOrderNumber'])) {
$orderVariables['sAddresses']['billing'] = $this->getOrderAddress($orderVariables['sOrderNumber'], 'billing');
$orderVariables['sAddresses']['shipping'] = $this->getOrderAddress($orderVariables['sOrderNumber'], 'shipping');
$orderVariables['sAddresses']['billing'] = $this->getOrderAddress($orderVariables['sOrderNumber'], Shopware()->Session()->get('sUserId'), 'billing');
$orderVariables['sAddresses']['shipping'] = $this->getOrderAddress($orderVariables['sOrderNumber'], Shopware()->Session()->get('sUserId'), 'shipping');
$orderVariables['sAddresses']['equal'] = $this->areAddressesEqual($orderVariables['sAddresses']['billing'], $orderVariables['sAddresses']['shipping']);
}

Expand Down Expand Up @@ -503,8 +503,8 @@ public function finishAction()

$orderVariables = $this->session['sOrderVariables']->getArrayCopy();

$orderVariables['sAddresses']['billing'] = $this->getOrderAddress($orderVariables['sOrderNumber'], 'billing');
$orderVariables['sAddresses']['shipping'] = $this->getOrderAddress($orderVariables['sOrderNumber'], 'shipping');
$orderVariables['sAddresses']['billing'] = $this->getOrderAddress($orderVariables['sOrderNumber'], Shopware()->Session()->get('sUserId'), 'billing');
$orderVariables['sAddresses']['shipping'] = $this->getOrderAddress($orderVariables['sOrderNumber'], Shopware()->Session()->get('sUserId'), 'shipping');
$orderVariables['sAddresses']['equal'] = $this->areAddressesEqual($orderVariables['sAddresses']['billing'], $orderVariables['sAddresses']['shipping']);

$this->View()->assign($orderVariables);
Expand Down Expand Up @@ -2131,7 +2131,7 @@ private function isValidAddress(int $addressId, bool $isShippingAddress = false)
/**
* @return array<string, mixed>
*/
private function getOrderAddress(string $orderNumber, string $source): array
private function getOrderAddress(string $orderNumber, int $userId, string $source): array
mitelg marked this conversation as resolved.
Show resolved Hide resolved
{
$builder = $this->get(Connection::class)->createQueryBuilder();
$context = $this->get(ContextServiceInterface::class)->getShopContext();
Expand All @@ -2140,8 +2140,9 @@ private function getOrderAddress(string $orderNumber, string $source): array

$address = $builder->select(['address.*'])
->from($sourceTable, 'address')
->join('address', 's_order', '', 'address.orderID = s_order.id AND s_order.ordernumber = :orderNumber')
->join('address', 's_order', '', 'address.orderID = s_order.id AND s_order.ordernumber = :orderNumber AND s_order.userID = :userID')
->setParameter('orderNumber', $orderNumber)
->setParameter('userID', $userId)
->execute()
->fetch();

Expand Down