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

[Cart] fix existing cart initalization on customer login #1779

Merged
merged 2 commits into from
Nov 15, 2021
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -37,27 +37,13 @@ public function findForCustomer(CustomerInterface $customer): array
return $carts;
}

public function findNamedForCustomer(CustomerInterface $customer, $name): ?OrderInterface
{
$list = $this->getList();
$list->setCondition('customer__id = ? AND name = ? AND order__id is null', [$customer->getId(), $name]);
$list->load();

$objects = $list->getObjects();

if (count($objects) === 1 && $objects[0] instanceof OrderInterface) {
return $objects[0];
}

return null;
}

public function findLatestByStoreAndCustomer(StoreInterface $store, CustomerInterface $customer): ?OrderInterface
{
$list = $this->getList();
$list->setCondition('customer__id = ? AND store = ? AND order__id is null ', [$customer->getId(), $store->getId()]);
$list->setOrderKey('o_creationDate');
$list->setOrder('DESC');
$list->setLimit(1);
Copy link
Member

Choose a reason for hiding this comment

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

that is right

$list->load();

$objects = $list->getObjects();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ interface CartRepositoryInterface extends PimcoreRepositoryInterface
*/
public function findForCustomer(CustomerInterface $customer): array;

/**
* @param string $name
*/
public function findNamedForCustomer(CustomerInterface $customer, $name): ?OrderInterface;

public function findLatestByStoreAndCustomer(StoreInterface $store, CustomerInterface $customer): ?OrderInterface;

/**
Expand Down