[英]can i have a second media.phtml in my magento new theme?
so this is the project. 所以这是项目。
I need to display the regular product images for most of the products but for a second set of products i need to replace the image with a javascript that will change depending on selections of options. 我需要显示大多数产品的常规产品图片,但对于第二组产品,我需要使用JavaScript替换图片,该JavaScript会根据选项的选择而变化。
My question is: can i have two different media.phtml. 我的问题是:我可以有两个不同的media.phtml吗? Let's say media.phtml and js-media.phtml. 假设media.phtml和js-media.phtml。 And if i can where can i change this? 如果我能在哪里改变呢?
Or another case could be finding the file responsible for the content on the product page and change it there. 或者另一种情况是在产品页面上找到负责内容的文件并在此处进行更改。
<?php echo $this->getChildHtml('content') ?>
I thought i could change this creating a new layout file but apparently i am wrong. 我以为我可以更改此设置以创建新的布局文件,但是显然我错了。
Thanks 谢谢
This is totally something you can do. 这完全是您可以做的。
In your template create your js-media.phtml
in templates/catalog/product/view
. 在您的模板中,在templates/catalog/product/view
创建js-media.phtml
。
Then if you want to assign this new template only to some of the products, you can switch media template straight from the backend of magento, through the Design
tab of a product info. 然后,如果您只想将此新模板分配给某些产品,则可以通过产品信息的“ Design
选项卡直接从magento后端切换媒体模板。
There you can do this by adding a bit of XML into the Custom Layout Update
field : 在那里,您可以通过在“ Custom Layout Update
字段中添加一些XML来做到这一点:
<reference name="product.info.media">
<action method='setTemplate'><template>catalog/product/view/js-media.phtml</template></action>
</reference>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.