Other Rishonim maintain that Havdalah should be done before lighting the menorah. Based on the rule that the more frequent mitzvah should be performed first, Havdalah takes precedence. Furthermore, it would be inappropriate to recite the brocha of borei me’orei haeish after lighting the menorah and basking in its glow. Many Achronim follow this view. Mishnah Berurah writes that a person in his own home may choose to follow either view. In shul, however, the view of the Shulchan Aruch should be upheld and the menorah should be lit first. Some Achronim write that if a child will become bar mitzvah on Motzoei Shabbos, he should light the menorah first. Since his obligation of Havdalah is only that of a child (as he was a child on Shabbos) and his obligation of lighting the menorah is that of an adult, menorah lighting should be done first in this case.
[משנ"ב תרפא, ג, וביה"ל א, ד"ה מדליקין; ביאורים ומוספים דרשו, 9-8]