php - getChildHtml inside a foreach in Magento -


I'm working on a new template in Magento to avoid duplicate code, I want to preview one for each product I want to use hair template.

In particular, I have performed such a way:

  $ products = Mage:: getModel ('list / product') - & gt; GetCollection (); Foreign currency ($ products as products $) {$ this- & gt; GetChild ('preview_product') - & gt; Set data ('product', $ product); $ This- & gt; GetChildHtml ('preview_product', true); // to avoid caching correct}   

The block preview_product file is called preview_product.file, which contains the following code:

    

The problem is simple In this case the result is:

    

Generating the same hostility or similar HTML How can I use this code?

  copy $ this-> getLayout () - & gt; Create Block ('Core / Template') - & gt; Settemplate ('path / per / template.file') - & gt; Setproduct ($ product) - & gt; ToHtml ();    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -