I need to insert a javascript object into the head of my listing pages containing a json representation of the products listed on that page, i.e. not all products in the category but only those that have been paged by the toolbar.
I've found that I can get that data by putting an observer on catalog_block_product_list_collection but this is after the Head Block has been rendered, so therefore prevents me using that data in a child block of the Head.
As far as I can see I've got two options.
- Load a javascript block to the footer and use jquery to inject it to the header.
- Work out what Magento did before catalog_block_product_list_collection was called and recreate the logic in my model.
I wondered which way experienced Magento developers would jump and the pitfalls of both techniques, Thanks in advance.