Although some solicitors work on a commission basis (especially if they're employed on a 'no win, no fee' basis), many others simply charge for their time.
In the latter case, a solicitor's fee might be quite low if he/she has only had to write one letter, threatening legal action, before the debtor pays up. However if he/she has hand to spend hours looking up relevant precedents and then submitting them to the debtor's solicitor (only to receive back counter arguments), examining and analysing documents such as contracts and invoices, submitting documents to the court and then appearing there in person, (etc, etc), his/her fees could be vastly more.