There are no rules here, and it’s best not to invent any
The official rules don’t describe this at all. There are references to the idea that you can (or perhaps even should) randomly generate what’s available in any given town, and that characters can and should be motivated to go on journeys and quests by the search for particularly desired magic items that don’t show up.
But how they know about such a magic item isn’t described at all. Nor, for that matter, is it explained how a wizard knows which spells are available for scribing, or a cleric knows what spells they can pray for, and so on. The rules don’t even bother to say that this is just common knowledge for members of the appropriate classes—instead, the rules are just silent about it. It’s just assumed that one way or another, quests to find the perfect magic item are a likely activity for a D&D character, and how they figured out they should go on that quest is left entirely undescribed—or, in other words, entirely up to the DM. The rules just kind of breeze right past this concern, and leave it up to players to decide items to pursue and the DM to decide how that pursuit happens in the world.
It is metagaming—and it’s a good thing
The usual route to handling equipment at most tables in my experience is, when the party reaches an appropriate bastion of civilization and has some downtime, the players—not the player characters, the players—decide what they want to sell and what they want to buy. There is a timeskip and at the end of it, the player characters have sold the things the players decided to sell, bought the things the players have decided to buy, and have the appropriate amount of gold left afterwards.
Who, when, where, and how are not addressed in any fashion. Asking “how did the character know about an item that wasn’t just on the shelves?” is nonsensical under this approach, because we never even bothered to determine what items were on the shelves, or that the characters bought these items off of a shelf in the first place. Someway, somehow, it happened, and that’s all that matters.
There are several very good reasons to play things this way:
It’s fast, and gets the adventurers back to the adventure quicker, which is what most people want.
It’s easy, and helps to mitigate some of the serious balance problems in the system. More on this in a bit.
It actually helps verisimilitude—because there are metagame needs being addressed here that don’t bear much scrutiny, it’s good to not focus on it.
Of course, you don’t have to do things this way. Not every group I’ve played with has. In fact, at most tables, this isn’t the initial approach to items—this is what evolves after trying to roleplay out the whole thing and finding that it just takes too much time and isn’t satisfying or interesting enough to be worth it. But your group can evaluate the most worthy ways to spend your game time for yourselves, and come to different conclusions.
But what you do “have to” do, at least for your own sanity running the game, is ensure that player characters wind up with the items that the players pick out. Magic items are absolutely crucial in D&D 3.5e—this is a system utterly dominated by magic, but in which not all characters actually get their own magic. Magic items are the only way to mitigate that fundamental problem—they aren’t generally enough, but their lack is often felt very quickly indeed. And I don’t just mean the lack of magic items at all—very often, even just the lack of the right magic items is game-crippling. There are must-have items for all but the most powerful characters—denying characters their preferred items means only those most powerful characters get what they need. And you, as DM, don’t need yet another huge responsibility on your plate, so figuring out what’s needed for each character is left up to that character’s player. If you don’t do this, you are punishing the least-powerful classes, which has the most must-have items, and over time your players are likely to respond by gravitating towards the most-powerful classes, for whom items are much more likely to be merely nice-to-have.
Anything else takes tons of time—and mostly just highlights the problem
One way or another, you have to come up with some solution that gets the players’ chosen items into the hands of their respective characters. Hand-waving is the quick, easy way to make that happen. You could play it out in a really basic way by just having the items the players chose happen to be the items on the shelves. You could introduce skill checks to find out about items’ existence or whereabouts. There could be whole quests involved. Player choices of items could be less “shopping list” and more “wish list,” that you use the populate future loot drops.
But in all cases, you still need to get the right items into the player characters’ hands. And the more elaborate you get, the greater the risk of the player characters failing—and then you need a back-up plan to handle that failure, but still get the item into the player character’s hands.
All of these things take a lot of effort from you, the DM, and also take a lot of time at the table. None of them produce particularly great results—so long as failure isn’t an option, and it’s not, they all strain verisimilitude. So the decision by most tables, in my experience, is that they just don’t, because it isn’t worth it to them. If you’re thinking differently, you have to be ready for the fact that trying to improve matters here comes at a big cost, which means that this better be “worth” a whole lot.
And even then, the most likely result is that you’ll be focusing on item-finding quite a lot, but it won’t actually look or feel all that realistic. So you’ll only succeed in drawing a lot of attention to the problem—which only hurts immersion.
Finally, you have to keep in mind that you have to game with a group. It kind of sounds like your group wants to pretty much just buy exactly what they want and then move on. They would seem to prefer, then, that all of the above get reduced to a simple montage that you narrate as a timeskip happens—if even that. Making them play through it every time might get old. They might not enjoy it. They might decide that there are other, more enjoyable ways to spend their time. So you should probably discuss it with them before you go too far down the road of implementing something more.