Marx had a labor theory of value, just like adam smith which is entirely wrong. The cost of a good is determined by the value it provides to the consumer. The consumer will not pay more than the value it provides the to them. In Marx's view the cost of a good is determined by how much it cost to produce.
I have the impression that the standard economic doctrine was that the cost of a good was determined by where the supply curve intersects the demand curve — which is to say, the point at which the amount it costs to produce it is equal to how much value it provides to the consumer.
This in itself doesn't contradict Marx's point (and what Marx thought the real value of things was is irrelevant). The point where he got it wrong was apparently in equating the cost of keeping a laborer alive with the cost of their labor.
To elaborate, if you're not familiar with these ideas of supply and demand curves, the idea is that as you produce more and more of something, the cost to produce it eventually starts to go up forever.
For example, working 20 hours a week might have a negative cost, working 40 hours a week means you don't have a lot of socializing time, working 80 hours a week means you have no leisure time unless you have someone else to cook and clean for you, working 100 hours a week means you're sleep-deprived and have time for neither leisure nor cooking and cleaning, working 168 hours a week is invariably fatal within a few months, and working more than that is impossible.
On the other side, the incremental value to the consumer diminishes after some point, ultimately reaching zero. A single fork per person is useful every day, six forks per person is useful only when they invite friends over or want to postpone doing the dishes, thirty forks per person is useful only if you're doing funky art projects by bending forks, and 300 forks per person would be valuable only as scrap metal, i.e. the labor that went into making them produced zero or even negative value.
The theory is that these two curves must intersect in at least one point, and that's the market equilibrium. It's commonly assumed that they intersect in only one point because they're monotonic, but that's probably not true.
The consumer will pay at most the value that it provides them; however the producer will charge at least the cost to produce the item.
If the former is less than the latter, obviously there is no sale. If the latter is less than the former, then the price will be somewhere in between these points - exactly where is the interesting thing.