Skip to content

Fix Shipment list sorting on joined-table columns#169

Merged
rokaszygmantas merged 2 commits into
DPDBaltics:release-3.3.1from
TLabutis:BUGFIX/shipment-list-sorting
May 25, 2026
Merged

Fix Shipment list sorting on joined-table columns#169
rokaszygmantas merged 2 commits into
DPDBaltics:release-3.3.1from
TLabutis:BUGFIX/shipment-list-sorting

Conversation

@TLabutis

Copy link
Copy Markdown
Contributor

Summary

  • Tracking number, Receiver, Address, and City columns on the admin Shipment list now sort correctly. They come from joined tables (order_carrier, customer, address); previously PrestaShop fell back to the main shipment table and produced no useful ordering.
  • Default sort is now id_dpd_shipment DESC so the latest shipments appear at the top.

Implementation

  • Added order_key (not filter_key) for the four joined-table columns using PrestaShop's alias!column notation. order_key only affects ORDER BY, leaving the existing havingFilter (which targets the CONCAT / aliased SELECT columns) untouched. Using filter_key would have caused HAVING c.lastname LIKE ... and a 500 because c.lastname is not in the SELECT list.
  • Set _defaultOrderBy / _defaultOrderWay.

Test plan

  • PS 8.2.3: All four added columns sort ASC and DESC without errors
  • PS 9.1.2: Same, with 217 seeded shipments; latest at top by default
  • havingFilter still works (receiver_name=John matches CONCAT alias)
  • Existing main-table columns (date_print, date_add, reference1, num_of_parcels, printed_label, printed_manifest) still sort correctly

Sorts on Tracking number, Receiver, Address, and City fell back to
the main shipment table and produced no meaningful ordering. Added
order_key entries pointing at the correct join aliases so PS uses
the right columns in ORDER BY. filter_key is intentionally left
unset so HAVING filters keep targeting the SELECT aliases.

Also set default sort to id_dpd_shipment DESC so the latest
shipments appear first.
@TLabutis TLabutis changed the base branch from main to release-3.3.1 May 22, 2026 13:17
@rokaszygmantas rokaszygmantas merged commit f18848f into DPDBaltics:release-3.3.1 May 25, 2026
2 checks passed
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