Magento – Add second addtocart.phtml file

product

I am looking to add a second addtocart.phtml file to a custom product layout

I am overriding the product template fine using the below in the products "custom layout update" field

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

But i am trying to have a second addtocart file now, as i want to change the content of this file for the one layout only

i tried adding this also to the custom layout update

<block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="catalog/product/view/addtocart2.phtml" />

But the add to cart button just disappears completely.

Best Answer

To replace that "add to cart" template on product page with your own template:

<catalog_product_view>
    <reference name="product.info.addtocart">
        <action method="setTemplate">
            <template>catalog/product/view/my_brand_new_addtocart_template.phtml</template>
        </action>
    </reference>
</catalog_product_view>
Related Topic