I handle things a little differently in my game. Basically, I start with the maximum gp values in the DMG. If what they're looking to buy or sell isn't at least in that ball park, there's no way anyone there has it or can afford to buy it. Now, if that's not a problem, the player can roll a Buy or Sell check as appropriate. The Buy check has a DC based on the item's type (staffs overall have a higher DC than potions or scrolls, for example,) and overall gp value. They tend to range from around 12 for the lowest value items, to 35 or more for the good stuff. The roll is modified by the city's NPC level modifier (again found in the DMG) and their own charisma score. If they make a Buy check, that item is for sale somewhere in the city, and can be immediately purchased at book price. If not, they can still get it, but they have to have it commissioned and wait the appropriate amount of time to get the item made. Sell costs are similar, but the NPC level modifier only costs for half. If a Sell check is made, they found an interested buyer and can sell it at full book price. If not, they sell it at half book price, to a more general buyer (not a magic Wal Mart, per sec, but more likely a mages guild, a weapon shop, a typical gnomish curio shop, or whatever's appropriate.) I use the Charisma modifier because the player's skill shouldn't affect what's actually available. A pursuasive person might be able to convince a reluctant buyer/seller to agree to a deal, but if no one has, say, a staff of healing, than it doesn't matter if the buyer is a 1st level mook or a 75th level bard with triple digit Diplomacy and Gather Information scores.
One problem I do have, and am looking for advice from others on this thread about, is how to deal with "neat" items? You know, Figurines of Wondrous Power, Rods of Wonder, Decanters of Endless Water, all the named weapons, unique items you made up, and so on? How do you encourage a player to keep a few of those instead of immediately selling to add another plus to a weapon, armor, or such?