Skip to content

Exclude order payment table columns from check pending orders query#107

Open
alitopaloglu wants to merge 1 commit intomoyasar:masterfrom
alitopaloglu:fix-pending-orders-cron-query
Open

Exclude order payment table columns from check pending orders query#107
alitopaloglu wants to merge 1 commit intomoyasar:masterfrom
alitopaloglu:fix-pending-orders-cron-query

Conversation

@alitopaloglu
Copy link

@alitopaloglu alitopaloglu commented Sep 5, 2025

  • Order collection joins order payment table with all columns which are not needed.
  • When rest of the code tries to load to order by entity_id, because of there are 2 entity_id columns in order collection (1 is for order, 1 is for payment) code tries to load the order by entity_id of payment table which is wrong.
  • If we do not select any columns in order collection while joining the payment table, there will be only 1 entity_id which belongs to order entity

@AbdullahAldakheel
Copy link
Collaborator

Hello 👋🏼,
Thanks for the clear explanation, it makes sense.
good catch

$query = $this->orderCollection
->getSelect()
->join(['pp' => 'sales_order_payment'], 'main_table.entity_id = pp.parent_id')
->join(['pp' => 'sales_order_payment'], 'main_table.entity_id = pp.parent_id', [])
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should select method field from sales_order_payment

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants