Careful buying online, the ones I bought online didn't even last 10k miles, spend the extra $$$ and save the headache. My 2 cents.
As has been mentioned here, where you buy your parts doesn't have all that much to do with the quality of what you get.
Whether you buy your parts online or at a local parts store, the most important consideration in getting quality parts is the manufacturer. Local parts stores often sell cheep, low quality parts. Some stores sell nothing but. The same can be found online. High quality parts are also available from a variety of locations. Even quality brands offer cheaper grade parts. It is not nearly as simple as online or local.
If you buy a quality brand part that is not from an "economy" parts line, you are very likely to end up with a part the performs well. Nothing is certain, but this gives you the best chance of success. If you buy a cheap part from an economy line or no-name brand, you are much less likely to end up with a part that performs well. You are especially less likely to end up with a part that performs well for a long time. This really doesn't have anything to do with where the part is purchased.
The benefits of buying locally are that you can often get the part on the same day and it is much easier and cheaper to return the part if there is an immediate issue. Warranty returns will likely be easier as well. Parts are almost always more expensive at local stores and the selection will be much more limited. Also, many auto parts stores sell their own brand and it can be difficult to know exactly what you are getting because you don't know the manufacturer. Stores like Advanced Auto Parts sell both their own brand as well as some of the manufacturer brands, though you often have to order these parts and they are more expensive then buying them direct.
The benefits of buying online are that you have an almost unlimited selection available and will nearly always get the lowest price, though shipping can eat into that if it is not included. There are problems with online ordering, especially if you are not ordering from a mainstream outlet like Amazon, RockAuto, Walmart, etc, or a well known parts site like Caird or Summit Racing, etc. There are ever increasing issues with counterfeit parts so beware of prices that are significantly lower than it looks like they should be. I have had this problem even on Amazon (not with car parts). There are also horror stories about getting someone else's rusty old part in your brand new box because someone returned their old part instead of the new one and no one checked, or no one cared. This can happen in local stores as well. I now open every box at the store immediately after I have bought it. There are allot of open box items that are sold as new.
There is no foolproof method of buying parts since there always seem to be some people who are dishonest, lazy, or incompetent. I don't consider cheap parts to represent any dishonesty as long as they are not advertised as other than what they are. I think there is a place for parts that can get you buy in the short term though it really depends on what the parts do.
Your best bet is to buy a quality brand part from a reputable store, whether that store is on a local street or in the ether. You will generally always get a quality part when buying from a dealer, but these will also be the most expensive.
LMHmedchem