At header.phtml I load the product compare list with the following code:
$collection = $this->getLayout()->createBlock('catalog/product_compare_list')->getItems(); On default pages like category, product, cms pages the compare list is loaded.
But when I go to a custom module page (also on the frontend) the compare list is not loaded.
When I debug the $collection I noticed that _visitorId is different on the custom module page.
How can I load the compare list on the costum module page?

1 Answer 1


I have fixed it, I'm not sure if it is the correct way but it is working.
I'm using Alan Storms module to get the real visitor_id and I load this in to my collection http://alanstorm.com/magento_cross_area_sessions

$frontend = Mage::getModel('pulsestorm_crossareasession/manager')->getSessionData('frontend'); 
$visitorid = $frontend['core']['visitor_data']['visitor_id'];

$collection = Mage::getResourceModel('catalog/product_compare_item_collection')

$collection->setVisitorId( $visitorid );



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.