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

Performance issue on checkout page. #516

Open
kpitn opened this issue Sep 19, 2022 · 3 comments
Open

Performance issue on checkout page. #516

kpitn opened this issue Sep 19, 2022 · 3 comments
Assignees

Comments

@kpitn
Copy link

kpitn commented Sep 19, 2022

Hi,

I'm using the last version module (4.1.1)

Instead of using order collection, repository is use with searchcriteria.

File : /vendor/checkoutcom/magento2/Model/Service/OrderHandlerService.php

        /** @var OrderInterface $order */
        $order = $this->orderRepository->getList($search)->setPageSize(1)->getLastItem();

Magento getlist load all customer orders before limiting the query with last item.

screen

items

@kpitn
Copy link
Author

kpitn commented Sep 19, 2022

Patch to solve the problem (if you want to keep repository)

--- Model/Service/OrderHandlerService.php
+++ Model/Service/OrderHandlerService.php
@@ -289,10 +289,16 @@

         // Create the search instance
         $search = $this->searchBuilder->create();
+        /** @var SortOrder $sortOrder */
+        $sortOrder = \Magento\Framework\App\ObjectManager::getInstance()->create(\Magento\Framework\Api\SortOrderBuilder::class)
+            ->setField('created_at')
+            ->setDirection(\Magento\Framework\Api\SortOrder::SORT_ASC)
+            ->create();
+        $search->setPageSize(1)->setSortOrders([$sortOrder]);

         // Get the resulting order
         /** @var OrderInterface $order */
-        $order = $this->orderRepository->getList($search)->setPageSize(1)->getLastItem();
+        $order = $this->orderRepository->getList($search)->getLastItem();

         if ($order->getId()) {
             $this->logger->additional($this->getOrderDetails($order), 'order');

@Dnd-Gimix
Copy link
Collaborator

Hello @kpitn ,

Thanks a lot for the feedback, very efficient as always! ;)
This is taken into account and we will work on it in the near future.

We will keep you posted of our progress regarding this improvement.

Regards,

@Dnd-Gimix Dnd-Gimix self-assigned this Sep 19, 2022
@JamesFX2
Copy link

JamesFX2 commented Nov 9, 2022

I flagged the same in #503 but sadly, this was missed.

I'm undecided if I should continue to raise issues with this project.

Off the top of my head, there are

They've released versions that have broken filters (so crashed the checkout loading 2 million transactions to try and figure out the last payment method used), have put PHP 8.0 specific code in versions meant for 7.x, had invalid JS that broke checkouts.

Every time, it's an ordeal that ends up becoming a game of message passing between the internal support team and their Magento agency. I have 18 separate plugins, 8 class rewrites fixing or altering things on your extension. It's my preferred solution these days. It saves my time jumping through hoops to help a company that's valued at $40 billion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants