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
Post a Comment