I'm trying to work out the best way for players to sell things to NPC shopkeepers. I've never particularly like the traditional shopkeeper model that is willing to buy virtually anything that the player can pull out of their bag, even if they don't (or won't) sell it. I've considered having shopkeepers only buy the things they sell, or only have a finite list of things that they'll buy, but I guess I'm undecided as to what the best way to go about a shopkeeper is.
Is it worth deviating from the standard model? I don't particularly like it, but I realize that it is, after all, a game, which is meant to be fun and playable, rather than realistic or artistic.

a viable compromise would be to decrease the value of items sold to uninterested shopkeepers. ie a weaponsmith would buy a shiny necklace for 40% of what it's worth, while a guy with a shiny necklace fetish would buy it for 70% of what it's worth

whenever i play a game with buying/selling, the first thing i become paranoid about is whether or not the shopkeepers hold different items at different values

This is a difficult problem because the ultimate solution is a virtual economy. The value of an item should be based on its rarity, so if you have every goblin in a dungeon dropping swords and let your hero carry out 20 of them to sell (an unrealistic weight), you'll have people farming swords for profit. If you simply drop the price, you'll have a glut of ultra-cheap swords that doesn't make a lot of sense.

In a semi-realistic setting, there would be multiple impacts from this kind of behavior.

1) Swords would get locally cheaper.
2) Other shops might either buy up the cheap swords or drop their prices, or a little of both. This would depend partly on their distance from the cheap shop.
3) The local goblins would have a shorter supply of armaments and would probably switch to cheaper, simpler, or outright crappier weapons (like a heavily notched sword no merchant would pay crap for).
4) The local goblins would tend to entrust their arms to their best fighters, steepening the curve for obtaining good drops from goblins. Whereas a level 10 goblin before might earn you a +2 sword, now it might take a level 12 or more.

Thinking in terms of an availability curve is a good idea. If you have various grades of weaponry, low-level enemies should be armed with the less desirable stuff. The curve will steepen as you despoil more enemies and remove those items from the dungeon, and get shallower over time. A high enough curve could even lead to some interesting quest actions, like for instance a goblin military starved for good weapons might send out a troop of their best to raid the local shop and plunder the stockpile of cheap weapons there.

Ultimately all this stuff is not simple to model realistically though. In your case, simpler might be better. A shopkeeper could declare that he has a glut of items when he reaches a certain quantity out of his norm, and that glut could be accounted for by selling to neighboring shops over time or also simply depleting the inventory due to spoilage or simulated buying. A glut could lower the price, and a dearth of the item could raise it. You can have shopkeepers periodically check with each other to see if, for instance, shop B has five whips and shop A has only one, shop A wants to buy one of those whips from shop B. If neither shop has a good hunting knife, they'll both be aware of the low supply and offer more (up to a certain percentage, based on how rare they expect the item to really be) to any adventurer who chances to sell one. Naturally if only one Gleaming Sword of Truth exists, it should be nigh priceless because the shopkeepers would all know that swords of such quality are rare and that this particular one is unique.

You could get rid of the shopkeepers all together and give players the ability to sell their items to other players, making a player-generated market. Then, you could give value to trash items by allowing players to recycle them in some way, turn them in for credit for factions or make them into more expensive items. That way other players will have a reason to buy trash items. Just some suggestions.

I really can't eliminate shopkeepers entirely, that would be too far outside the genre of the game. It's probably not practical to rely on players as the sole source of purchased items, at least not in what I have in mind.

Lummox has some pretty nice ideas in his post. My ideas are sort of like his.

Definitely have a weight limit for players on what they can carry. This may be increased with increased strength, or different items, whatever. This will prevent players from having 20 suits of expensive armor at once. Another way would be to have items stack-able. Some would be stack-able to a limit some would not be stack-able.

Put in an economy system. If a shop has a bunch of swords they will buy them at a lower price then a shop that only has few to none. Same goes for selling, a shop with a lot of stock in something will sell it at a cheaper price.

I would also give shopkeepers a gold variable. Instead of a shop buying stuff in massive amounts give the shop an amount of gold. Then depending on what that shop has and how the economy is in that area the shopkeepers inventory will change as well as their gold.

Another thing is when buying or selling in bulk the prices should be dropped. Say you are selling 10 iron ores that the shopkeeper will buy one of for 10 gold. Since you are selling 10 of them he will buy all ten for 80. Same goes for the other way around. He would sell you 10 for 80 for buying in bulk.

Favoritism is another thing. The more the player does transactions with that shop keeper the more the shop keeper will like them and give them better deals. Even a mercantile skill would work. The higher it is the better deals you get.

Should the inventory of players who are not logged in be counted toward any sort of supply/demand factor? Creation of new characters with default equipment and deletion/abandonment of characters with high ticket items would seem like it would do weird things to a dynamic economy? And then I wonder what the impact of the player-base size on this system (10 players vs. 100, etc.)

I wouldn't personally use player's inventories. Players might just be collecting items. They could also have massive amounts of crafting materials that they plan to use for crafting. So having their items that they haven't sold affect the economy could turn into a massive failure.

This could be pointed towards a real life example. If all the gold in the world was owned by a few people who never planned to sell or pass the items on. This wouldn't change the economy for gold. It would still be non-existent in the economy and only used as a keepsake by those who own it.

But what if Goldfinger logs in, gathers up all the gold from Fort Knox, and then deletes character? (I just wanted to make a 007 reference; I've always had the impression that Byond has some subconscious James Bond vibe to it...)

So then the shopkeepers' prices should be based upon what they actually witness and have in stock? That seems reasonable.

EDIT: You could take a look at the economy behind Kingdom of Loathing. Whenever things got unbalanced by stockpiling meat, special expensive have-to-have items were released to regulate the balance.

hmm. this might be too epic an idea. but what about having a list of items for your game and have players "unlock" those items via certain actions like
alchemy or smithing or whatever.

That way the people who invest time or money or whatever into unlocking those items could set the price. Depending on the price others might hurry to develop that technology as well. The normal shops could have basic elements or ingredients , or maybe from time to time sell "rare" items that would normally need to be made.

The only down side to this is players going nuts and charging billions of dollars.but then again if you make money difficult to come by, all that work unlocking it would be for nothing if no one can afford to buy that item from you.

I'm just gonna take a shot in the dark here and say that you're a fan of Oblivion?

I'm already including stacked items, and I'll probably limit the number of items the players can carry.
And I do intend to include some sort of discount depending on how liked the player is by the shopkeeper.

But my real concern is how to stock the shops. Should shops always sell the same items, should they add items to their stock when players sell things to them, should they run out of stock on certain items, etc?

another way to tackle this problem would be to give every item a constant value and then modifiy it's buying prices by percentage.

For instance an apple has a value of 5 gold.(super expensive apple)

The limit on how over priced an item could be due to inflation or necessity would be something like 300%

This way in places where apples are rare, they would cost upward of 8 gold. But in places where they aren't very rare at all, they could cost as little as 2 gold.(I'm throwing random, unchecked numbers out.. dont flame me o_O)

Suit of armor value= 1000 gold

Actual price(if it's rare in that region) 3000
Or very common(333 gold)

The price difference is much more drastic depending on the original value.