简体   繁体   中英

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.

My question is: can i have two different media.phtml. Let's say media.phtml and 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 .

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.

There you can do this by adding a bit of XML into the Custom Layout Update field :

<reference name="product.info.media">
    <action method='setTemplate'><template>catalog/product/view/js-media.phtml</template></action>
</reference>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM