Fix order history showing 'Shipped' for unshipped orders#72
Open
Fix order history showing 'Shipped' for unshipped orders#72
Conversation
The shipping status comparison `oxsenddate.value != " - "` uses a
space-padded dash (" - ") but OXID 7.x formats empty/zero dates as
just "-" (no spaces). The mismatch causes the condition to always
evaluate to true, so every order — including those that have never
been shipped — displays "Shipped!" in the account order history.
Replace the single-value comparison with a trimmed check against all
known empty-date representations: empty string, "-", and " - ".
Affects: b-7.4.x, b-7.5.x, b-8.0.x (same line in all branches).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In the account order history (
page/account/order.html.twig), the shipping status check on line 32 compares:{% elseif order.oxorder__oxsenddate.value !=" - " %}This comparison expects the formatted empty-date string to be
" - "(space-dash-space). However, OXID 7.x formats0000-00-00 00:00:00as"-"(just a dash, no spaces):Every order in the history displays "Shipped!" regardless of whether it has actually been shipped. This includes orders that are still being processed, awaiting payment, or not yet fulfilled.
Root Cause
The date formatting changed between OXID versions. The old Smarty-era formatting produced
" - "for empty dates, but the current Twig-based formatting produces"-". The template comparison was never updated to match.Fix
Replace the single-value string comparison with a robust check that covers all known empty-date representations:
{% elseif order.oxorder__oxsenddate.value|trim not in ["", "-", " - "] %}This handles:
""— empty string (e.g. NULL database value)"-"— current OXID 7.x formatting of0000-00-00" - "— legacy formatting (backward compatible)The
|trimfilter ensures leading/trailing whitespace doesn't cause further mismatches.Scope
The same line exists in
b-7.4.x,b-7.5.x, andb-8.0.x. This PR targetsb-7.4.x; the fix should be cherry-picked to the other branches.How to Reproduce
OXSENDDATEat0000-00-00 00:00:00)How to Verify the Fix
After applying, repeat the steps above. Orders without a shipping date now correctly show "Not yet shipped", while orders with a real
OXSENDDATEcontinue to show "Shipped!".