Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Reusable phtml file to render product “snapshot information” - How to? 
 
jeff.meyer
Member
 
Total Posts:  51
Joined:  2008-11-24
 

I would like to reuse a product “snapshot” across multiple areas of my site.  Is it possible to just create an HTML (phtml) file and pass variables to it from another HTML file?  So in something like /catalog/product/list.phtml I’d like to loop over each product, but rather than place the product display info in that file, I’d like to pull it into a separate file that I can then use in other templates.  Make sense?

So a piece of my /catalog/product/list.phtml file might look something like this:

<?php
foreach ($_productCollection as $_product)
{
    render_product_snapshot
($_product);  //this being the area that I'm not sure how to achieve
}
?>

For my purposes, all of my products are simple, so nothing complex is necessary.

Any help/thoughts would be greatly appreciated.  Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
jeff.meyer
Member
 
Total Posts:  51
Joined:  2008-11-24
 

Still trying to figure this one out.  I can’t really find evidence of this anywhere within the code without using full block functionality, but that seems a bit unnecessary.  Has anyone achieved this?  It’s a staple in most frameworks that I’m familiar with (i.e. Symfony - include_partial()), but I’m new to Zend :(

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top