I found the following sentence:
È un vero peccato che ti abbiano rubato il portafoglio.
Ora non possiamo comprare da mangiare.
However, I wonder why this uses comprare da mangiare, instead of comprare a mangiare. I know both a and da can be used as a proposition before an infinitive verb. I also know that there is a usage of da + infinitive to express "something to do" much like to + infinitive in English.
However, then I wonder why da mangiare can work without an object. For example, if the sentence is the following, which has an object to modify, I have no problem in understanding it:
Ora non possiamo comprare qualcosa da mangiare.
However, if there is no object there, I can't differentiate when to use a and when to use da, especially since both can be used to express an aim after the main verb.
So how can I tell apart the use cases of these two prepositions?
(Please answer the question in English if possible...)