1

What is the code to pull in a custom view.phtml file via custom layout update (in admin > catalog > manage products > specific product) with magento? I would really like to do this in local.xml for specific products.

I found this:

<PRODUCT_ATTRIBUTE_SET_shirts>
<reference name="product.info">
  <action method="setTemplate"><template>my/custom/product/view.phtml</template></action>
</reference>

But this code is for attributes.

4

2 回答 2

6

好吧,我认为你不能在 local.xml 中做到这一点。但是针对这种情况进行了自定义布局更新。只需在那里写下你的 XML:

<reference name="product.info">
  <action method="setTemplate"><template>my/custom/product/view.phtml</template></action>
</reference>

或者,如果您需要为多个产品应用相同的 view.phtml,您可以创建一个仅包含一个 catalog/prodcut/view.phtml 的新主题,并使其扩展您当前的主题。然后将此主题仅应用于您需要的产品。

于 2011-08-05T06:13:27.710 回答
1

I am not entirely sure what you are asking for, but I am guessing you want to use your own view.phtml file and don't know how to have the xml layout file point to that new file.

first look for the file:

app/design/frontend/YOUR_THEME/default/layout/catalog.xml

This file essentially controls what blocks will be called within the catalog of products. If you look for the line:

<reference name="content">
        <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">

You can change the template= portion to point to your custom view.phtml file. Just remember that the file structure starts at the template file:

app/design/frontend/YOUR_THEME/default/template

So you will need to store your view file within that template file if you use this method.

I hope this helps!

于 2011-08-03T16:27:27.547 回答