Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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.

  1. Load a javascript block to the footer and use jquery to inject it to the header.
  2. 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.

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.