I have a website, sell a products with and without installation service. I want two add to cart buttons, one with and one without installation on a product page. The price for installation is variable for each product.

How can I create a extra add to cart button for this products? Thanks

  • 1
    You can do this using adding custom option to product. No requirement to add this extra button. Feb 13, 2017 at 10:28

1 Answer 1


write below code in {theme}/template/catalog/product/view/addtocart.phtml near Add to Cart button.

        $_price = Mage::getResourceModel('catalog/product')->getAttributeRawValue($_product->getSampleProductId(), 'price', Mage::app()->getStore()); 
        $_formattedPrice = Mage::helper('core')->currency($_price, true, false);
        $_buttonTitle = "Order Sample @".$_formattedPrice;
    <button type="button" title="<?php echo $_buttonTitle ?>" class="button btn-cart" onclick="setLocation('<?php echo Mage::getUrl('checkout/cart/add/product/'.$_product->getSampleProductId()) ?>')"><span><span><?php echo $_buttonTitle ?></span></span></button>
<?php endif; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.