Skip to content

Fix card prices on badge pages for localized names and the wrapped orderbook response - #2413

Open
kenny-ish wants to merge 3 commits into
IsThereAnyDeal:developfrom
kenny-ish:fix-localized-card-market-names
Open

kenny-ish wants to merge 3 commits into
IsThereAnyDeal:developfrom
kenny-ish:fix-localized-card-market-names

Conversation

@kenny-ish

@kenny-ish kenny-ish commented Nov 2, 2026 •

Copy link
Copy Markdown

Fixes #2393
Fixes #2392

Summary

On a badge page in another language the card names are localized, but the market only knows the English names, so the orderbook was asked for 620-Zerstörung and answered success: false (#2393). The first version of this PR read the names from the market listing links on the cards. Those links only exist for unowned cards on a signed-in user's own badge page, so it did nothing on the page from the report.

The English names are now taken from the English version of the same badge page. When the first price is requested on a page whose language is not English, the page is fetched once more with l=english and the cards are matched by position, since both pages list them in the same order. If the counts differ, the visible names are kept. Pages already in English fetch nothing extra. The "Lowest price" link uses the same name, so it opens the right listing.

/market/search/render/ would also give the names, but it answers 10 cards per request and every request from a CI runner was rate limited (HTTP 429).

The orderbook response is now wrapped in an outer data object (#2392), which left every card at N/A whichever name was used, so the card loader goes through parseOrderBookResponse from #2367 like the inventory does. Without that the name fix cannot be seen.

Test plan

  • test/card-market-name.test.mjs (npm test, also run in the build workflow): reading the names from the card markup in German and English, matching by position with the count mismatch fallback, and the l=english URL keeping border=1.
  • Against live Steam from a CI runner: https://steamcommunity.com/id/przemo20/gamecards/620 in German and English lists 8 cards in the same order; Zerstörung, Das Labor and Untergrund line up with Destruction, The Lab and Underground; the orderbook for 620-Destruction answers {"data":{"success":true,...}} with a price and 620-Zerstörung answers success: false.
  • npm run check and production builds for Firefox, Chrome and Edge.

Not checked: that l=english leaves the account language alone for a signed-in user. As far as I know the query parameter only applies to that request, and the steps in the issue switch languages the same way.

Use the market listing link on badge cards to recover the canonical
English market hash name before requesting orderbook prices. Keep the
visible localized name for badge completion display and fall back to it
when Steam does not provide a listing link.

Fixes IsThereAnyDeal#2393
@przemo20

przemo20 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for taking a look at this. However, I tested the PR, and it doesn't seem to work at all.

The following condition seems to always evaluate to true in my tests:

if (!href) {
    return `${appid}-${cardName}`;
}

Anyway, I don't think relying on the Search the Market link is ideal here. That link:

  • Is only available when the user is signed in and viewing their own badge page (and possibly under other conditions).
  • Is only shown for cards the user doesn't own. So, for example, if the user already owns the Zerstörung card, there won't be a link from which to retrieve its original name.

Another possibility would be to retrieve the original card names from the URLs used by the Buy remaining cards on the Market or Sell these cards on the Market buttons. However, those URLs would also only be available when the user is signed in and viewing their own badge page.

Alternatively, perhaps the original card names could be retrieved using Steam's /market/search/render/ endpoint. For example:

https://steamcommunity.com/market/search/render/?query=&start=0&appid=753&category_753_Game%5B%5D=tag_app_292030&category_753_item_class%5B%5D=tag_item_class_2&category_753_cardborder%5B%5D=tag_cardborder_0&norender=1

The tag_app_292030 value identifies the game, while tag_cardborder_0 and tag_cardborder_1 select regular and foil cards, respectively. However, this endpoint returns a maximum of 10 cards per request, so additional requests with different start values would be needed to retrieve the remaining cards.

@kenny-ish

Copy link
Copy Markdown
Author

Thanks for testing it, and sorry for the noise. You're right. My test built the card markup by hand with a listing link inside .badge_card_set_card and was never checked against a real badge page, so it passed while the fix does nothing on the page you described.

I'll rework this to take the market hash names from /market/search/render/ for the app (regular or foil border, paging with start) and match them to the cards on the page, and check it against a live response before pushing.

The market only knows the English card names, so on a badge page in
another language the orderbook was asked for the localized name and
answered success:false. The listing link the first version read is
only rendered for unowned cards on the owner's own page, so it did
nothing on the page from the report. Fetch the English version of the
badge page once when the first price is requested and match the cards
by position instead.

Steam also wraps the orderbook payload in an outer data object now, so
read it through parseOrderBookResponse like the inventory does.

Fixes IsThereAnyDeal#2392
Fixes IsThereAnyDeal#2393
@kenny-ish kenny-ish changed the title Fix card prices for localized trading card names Fix card prices on badge pages for localized names and the wrapped orderbook response Nov 3, 2026
@kenny-ish

Copy link
Copy Markdown
Author

Pushed a rework and dropped the listing link approach.

I tried /market/search/render/ first, but every request from a CI runner came back 429, and at 10 cards per page it would also take several requests per badge. The branch now fetches the badge page itself with l=english once, when the first price is requested on a page in another language, and matches the cards by position, since both pages list them in the same order. If the counts differ it keeps the visible names, and English pages fetch nothing extra.

The orderbook response also needed the data unwrap from #2367, otherwise the price is N/A whichever name is used (#2392), so this PR now covers that too.

Checked against your badge page from a runner: German and English both list 8 cards in the same order, Zerstörung, Das Labor and Untergrund line up with Destruction, The Lab and Underground, and the orderbook for 620-Destruction returns a price. If you could give it another try that would help, in particular whether l=english leaves your account language alone while signed in, which I cannot test here.

@przemo20

przemo20 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Thanks for the rework! I tested the latest version on badge pages in Polish, English, and German, and the original issue seems to be fixed. The card names are now resolved correctly, and the prices load as expected in all three languages. I also confirmed that no additional request for the English version is made when viewing an English badge page (that's nice).

I did notice one unrelated issue while testing on another user's badge page, though. When clicking Load card price for a card that the profile owner doesn't own, the orderbook request succeeds, but the button gets replaced with An error occurred (Retry).

For example, you can reproduce this on https://steamcommunity.com/id/przemo20/gamecards/35140/ by clicking Load card price under the first card, Intensive Treatment (which I don't own).

This seems to be caused by the existing badgeCompletion.update(costMap) call in FCardMarketLinks, which is executed even when badgeCompletion hasn't been initialized (it's only created when viewing your own badge page).

I tried adding a badgeCompletion check to the existing condition:

if (isUnowned && badgeCompletion) {
    costMap.set(cardName, price);
    badgeCompletion.update(costMap);
}

And that seems to prevent the error in my tests. This appears to be an issue in the existing code rather than something introduced by your PR, but I thought I'd mention it anyway.

Thanks again for working on this!

BadgeCompletion is only created on the user's own badge page, but the
price callback updated it for every unowned card, so on another user's
page the loaded price ended in "An error occurred". It stayed hidden
while every card price came back as N/A.
@kenny-ish

Copy link
Copy Markdown
Author

Thanks for testing it in three languages. I added your badgeCompletion check to this PR. It is old code, but it only started to fail here: before the orderbook unwrap every price came back as N/A, so the callback never ran on another user's page.

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

Labels

None yet

Projects

None yet

2 participants