not sure about the train tickets, perhaps have a look on www.raileurope.co.uk
i do know of one restaurant by the sagrada familia cathedral, not sure of the name but it is on the modern side of the cathedral and for a basic price you can have all you can eat. i'm pretty sure it's next door to kfc.
Montmelo is on the Barcelona "Cercanias" or suburban network, whose web page is http://www.renfe.es/cercanias/barcelona/index_ horarios.html - it's in spanish & there doesn't appear to be a link to it from the RENFE English page. As travelling to Montmelo os over what is essentially a "metro" system, it's probably unlikely you could pre-purchase tickets outside spain.
Montmelo is in zone 2, and the fare from the city centre is EUR1.40.
We had a great meal in one of the many restaurants in the street that runs diagonally from the northern corner of la Sagradia Familia. If you have google earth have a look, there are plenty of bars and restaurants in this area.