Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
Advertisement

Returns search results for an item.

result = C_AuctionHouse.GetItemSearchResultInfo(itemKey, itemSearchResultIndex)

Arguments[]

itemKey
ItemKey
Field Type Description
itemID number
itemLevel number? = 0
itemSuffix number? = 0
battlePetSpeciesID number? = 0
itemSearchResultIndex
number

Returns[]

result
ItemSearchResultInfo?
Field Type Description
itemKey ItemKey
owners string[]
totalNumberOfOwners number
timeLeft Enum.AuctionHouseTimeLeftBand
auctionID number
quantity number
itemLink string?
containsOwnerItem boolean
containsAccountItem boolean
containsSocketedItem boolean
bidder string?
minBid number?
bidAmount number?
buyoutAmount number?
timeLeftSeconds number?
Enum.AuctionHouseTimeLeftBand
Value Field Description
0 Short 30 minutes
1 Medium 2 hours
2 Long 12 hours
3 VeryLong 2 days

Example[]

Sends a search query for Inv ore stormsilver [Storm Silver Ore] when the button is pressed. Also prints results when manually browsing the AH.

local test_item = 5956 -- Blacksmith Hammer
local test_commodity = 152579 -- Storm Silver Ore

local btn = CreateFrame("Button", nil, UIParent, "UIPanelButtonTemplate")
btn:SetPoint("CENTER")
btn:SetSize(120, 40)
btn:SetText("Example")
btn:SetScript("OnClick", function(self, button)
	local itemKey = C_AuctionHouse.MakeItemKey(test_commodity)
	C_AuctionHouse.SendSearchQuery(itemKey, {}, false)
end)

local f = CreateFrame("Frame")

function f:ITEM_SEARCH_RESULTS_UPDATED(event, itemKey)
	for i = 1, C_AuctionHouse.GetNumItemSearchResults(itemKey) do
		local result = C_AuctionHouse.GetItemSearchResultInfo(itemKey, i)
		print(event, itemKey.itemID, i, result.auctionID, result.buyoutAmount)
	end
end

function f:COMMODITY_SEARCH_RESULTS_UPDATED(event, itemID)
	for i = 1, C_AuctionHouse.GetNumCommoditySearchResults(itemID) do
		local result = C_AuctionHouse.GetCommoditySearchResultInfo(itemID, i)
		print(event, itemID, i, result.quantity, result.auctionID, result.unitPrice)
	end
end

function f:OnEvent(event, ...)
	self[event](self, event, ...)
end

f:RegisterEvent("ITEM_SEARCH_RESULTS_UPDATED")
f:RegisterEvent("COMMODITY_SEARCH_RESULTS_UPDATED")
f:SetScript("OnEvent", f.OnEvent)

Patch changes[]

Shadowlands Patch 9.0.5 (2021-03-09): Added totalNumberOfOwners field.
Battle for Azeroth Patch 8.3.0 (2020-01-14): Added.


Advertisement