Assume that there is a tin of peaches at each end. That leaves two tins of peaches and six tins of pears between. If all eight remaining tins were distinct there would be 8! ways to arrange them. But 2!= 2 of those are just rearrangements of the peaches and 6! of them are just rearrangements of the pears so there are \(\displaystyle \frac{8!}{2!6!}= 28\) ways to do this.
Assume that there is a tin of pears at each end. That leaves four tins of peaches and four tins of pears between. Do the same as above.