我们正在开发一个Magento网上商店,它有两个类别.
我们希望使用第一类的默认产品视图模板和第二类的自定义产品视图模板.
这有可能吗?我们如何实现这一目标?
*编辑 - 解决方案*
对于任何对此感到好奇的人.解决方案比我想象的容易得多.
我只需要将这段代码放在相关类别的自定义布局更新部分中,我必须将选项"Apply to products"设置为yes!
<reference name="product.info">
<action method="setTemplate"> <template>catalog/product/view-recipe.phtml</template></action>
</reference>
Run Code Online (Sandbox Code Playgroud)
*编辑* 我尝试将此代码添加到catalog.xml.
<CATEGORY_5>
<reference name="product.info">
<action method="setTemplate"><template>catalog/product/view-recipe.phtml</template></action>
</reference>
</CATEGORY_5>
Run Code Online (Sandbox Code Playgroud)
*编辑* 我尝试将此代码添加到catalog.xml:
<CATEGORY_5>
<reference name="product.info">
<action method="setTemplate"><template>catalog/product/view-recipe.phtml</template></action>
</reference>
</CATEGORY_5>
Run Code Online (Sandbox Code Playgroud)
这个代码到自定义布局更新部分:
<reference name="product.info">
<action method="setTemplate"><template>catalog/product/view-recipe.phtml</template></action>
</reference>
Run Code Online (Sandbox Code Playgroud)
我安装了补丁,但遗憾的是仍然没有结果.
你的意思是类别目录清单吗?然后,您可以尝试"自定义布局更新".
<reference name="product_list">
<action method="setTemplate">
<template>catalog/product/custom-theme.phtml</template>
</action>
</reference>
Run Code Online (Sandbox Code Playgroud)
当然,你应该先创建custom layout,你可以从base list.phtml中获取参考
*编辑*
如果您想要定制特定的产品/类别,那么您可以使用custom layout handle.请考虑以下链接.
*编辑*
首先你应该CategoryController.php viewAction()从/app/code/core/Mage/Catalog/Controllers文件夹修改方法(如Inchoo示例中所指定).
然后,你应该这样做:
<CATEGORY_20>
<reference name="product.info">
<action method="setTemplate"><template>catalog/product/custom-theme.phtml</template></action>
</reference>
</CATEGORY_20>
Run Code Online (Sandbox Code Playgroud)
*编辑*
Magento有一个关于自定义布局更新的错误,问题ID为7625.他们在下一个版本中通过Bug Track指定修复但仍然有问题.所以,Ingo Weseloh制作了一个补丁,你可以找到以下链接.
Exanto Reclayup 7625
*编辑*
迈克尔,你可以试试这个(这是艾伦风暴的消化)
<CATEGORY_20>
<reference name="product.info">
<action method="setTemplate"><template>catalog/product/custom-theme.phtml</template></action>
<action method="setIsHandle"><applied>1</applied></action>
</reference>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12705 次 |
| 最近记录: |