1

How can I create 3 donation button in magento 1.9.3 on cms page .

1st button price is 100$
2nd button price is 200$
3rd button price is 300$

and when visitor click on button automatically redirect to checkout page

2
  • I would suggest to make 3 virtual product and add on button to link of cart with that product id
    – Kul
    Commented Dec 18, 2016 at 14:08
  • i have create 3 product but please tell me what is url of button ? Commented Dec 18, 2016 at 17:30

2 Answers 2

1

You can create 3 different product with different price as per your need and add below code to generate link for button.

<?php echo Mage::getUrl('checkout/cart/add', array('product'=>$productid,'qty'=>1, 'form_key' => Mage::getSingleton('core/session')->getFormKey())) ?>

Where $productid will be id of your product.

Hope it will help

0
1

below code for button in file

<?php $product = Mage::getModel('catalog/product')->load('your-product-id') ?>
<?php echo Mage::helper('checkout/cart')->getAddUrl($product) ?>
2
  • thanks for Answers but i have create button with 2 code as per your code Commented Dec 19, 2016 at 11:03
  • i have create button with 2 code as per your code my product id is 87 1st code <button class="button btn-cart" title="Add to Cart" onclick="setLocation('<?php $product = Mage::getModel('catalog/product')->load('87') ?> <?php echo Mage::helper('checkout/cart')->getAddUrl($product) ?>')->getFormKey())) ?>')" type="button"><span><span>Add to Cart</span></span></button> 2nd <a class="button" href="<?php $product = Mage::getModel('catalog/product')->load('87') ?> <?php echo Mage::helper('checkout/cart')->getAddUrl($product) ?>">Sign Up</a></li> </ul> but both button show 404 error Commented Dec 19, 2016 at 11:06

Your Answer

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

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