Catalog style game, "ALL" Category

Currently I’m making a catalog style game that utilizes different categories, I’m mostly just winging it and have no idea what I’m doing and if everything is going to come together in the end (I hope so), however I’m a little stuck on where to go next; I need an “all” category, I’m unsure the best way to implement it with the way my current UI gathers the categories as shown below

Anyone got any tips?

return {
	
	["Category"] = {
		["Accessories"] = {
			{Type = "Hat", AssetType = Enum.AvatarAssetType.Hat},
			{Type = "Face", AssetType = Enum.AvatarAssetType.FaceAccessory},
			{Type = "Neck", AssetType = Enum.AvatarAssetType.NeckAccessory},
			{Type = "Shoulder", AssetType = Enum.AvatarAssetType.ShoulderAccessory},
			{Type = "Front", AssetType = Enum.AvatarAssetType.FrontAccessory},
			{Type = "Back", AssetType = Enum.AvatarAssetType.BackAccessory},
			{Type = "Waist", AssetType = Enum.AvatarAssetType.WaistAccessory},
		},
		["Clothing"] = {
			{Type = "Shirts", AssetType = Enum.AvatarAssetType.Shirt},
			{Type = "Pants", AssetType = Enum.AvatarAssetType.Pants},
			{Type = "Layered Shorts", AssetType = Enum.AvatarAssetType.ShortsAccessory},
			{Type = "Layered Shirts", AssetType = Enum.AvatarAssetType.ShirtAccessory},
		},
		["Heads"] = {},
		["Bundles"] = {},
	},
	
	["Style"] = {
		["Medieval"] = {
			"Pine",
			"Lobsterlings",
		},
		["Post Apoc"] = {
			"Apparel Apparel Apparel"
		},
	},
}

What’s stopping you from just looping through each of the keys in the ["Category"] table? Perhaps I’m not entirely understanding how you intend to implement the system but if say you have one master function that handles getting catalogue data (e.g. {Type = "Hat", AssetType = Enum.AvatarAssetType.Hat}) then you could just collect each array from each category, collate them into a single array and just loop through that, passing each array into that master function. Alternatively, you may want to build a ‘cache’ system where you collect data about each category once and just reuse that data to avoid constantly sending API requests - but of course, you would need to update the data every now-and-then.

I may be wrong about this but the catalogue API allows for fetching data about the ‘all’ category on its own without having to do anything else - I haven’t dealt with anything catalogue related in a while so I may very well be wrong about that but it would be worth while to research

I haven’t started building the catalog search function yet, but my plan is to loop through the ["Category"] table in the catalog data module as you said.

However you mentioned there’s a way to search the “All” category through the Roblox catalog API.
Does that “All” search include specific subcategories (for example: “Accessories → All”), or does it just return every catalog item no matter the type?

I’m also wondering how to handle the actual “All” button in my client UI. Right now, the dropdown buttons are automatically generated based on the contents of my CatalogData module.

Would I need to manually add a table with an “All” type? or something? I’m not sure how to make the actual ALL button in the dropdown for each category, I suppose thats what the question was targeted more to.

I use .Type as a name for setting the current filter in my filter handler module but I also use it for the text button names

local FilterHandler = {
	Category = {Selected = nil, Filter = nil},
	Style = {Selected = nil, Filter = nil},
}

I can’t quite exactly remember how the catalogue API works so I can’t really answer this, however, I do know that the API allows for filters to be included into the call to restrict the types of items that are returned back, but again, this would be ideal to research beforehand just to confirm that assumption.

Yeah I suppose you could do it manually, and it may work out. However, it might be better to instead have an array at the end of each category to represent the ‘all’ option (it could just be empty or have something inside of it, or just anything to indicate that it’s the array for the ‘all’ option, you might want to do Type = "All"), and the idea would be that you would design logic to attach each of the ‘all’ options to their respective categories so that when the ‘all’ option is chosen, you can refer back to the data of the chosen category for the ‘all’ option and just iterate through it to collect the catalogue data for all of those items in the category. Hopefully that makes sense!

Thanks for the help, in terms of the catalog returning some sort of specific item, or an all category, I couldn’t find anything on it, only categories such as relevance, best selling etc.

I’m assuming you’re just suppose to loop through a table and insert the Enum.AvatarAsseType into the AssetTypes as it accepts a table rather than just one.

Yeah that should function as expected.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.