I am new to magento, I created the button in magento\app\design\frontend\base\default\template\catalog\product\list.phtml for sending emails for quote information. It's showing the button and When customer click on quote button I redirected my custom action that is getUrl('wishlist/quote/index')

<form id="wishlist-view-form" action="<?php echo $this->getUrl('*/*/update', array('wishlist_id' => $this->getWishlistInstance()->getId())) ?>" method="post">
                    <button class="form-button" type="submit" onclick="setLocation('<?php echo Mage::getUrl('wishlist/quote/index'); ?>')"><span>Submit</span></button>


but it's not working. By default, this form is firing $this->getUrl('*/*/update', array('wishlist_id' => $this->getWishlistInstance()->getId())) form action.

and I created controller in Magento\app\code\core\Mage\Wishlist\controllers\QuoteController.php


class Mage_Wishlist_QuoteController extends Mage_Core_Controller_Front_Action

    public function indexAction()




and Magento\app\design\frontend\base\default\layout\wishlist.xml

        <reference name="content">
            <block name="customer.mail" type="wishlist/mail_email" template="wishlist/test.phtml"></block>

why magento act like this? If I redirect using custom button how can I redirect/send/do some action?



It is because when you press button it submits the form and is not setting location. Just set form action wishlist/quote/index. If button purpose is to submit form use action. If purpose is just redirect to some page use a link button.


For setting different submit url's for different buttons use:

onclick="editForm.submit('<?php echo Mage::getUrl('wishlist/quote/index'); ?>');return false;"

editForm - here is object which is creating to validate form. It should be defined in somewhere in magento\app\design\frontend\base\default\template\catalog\product\list.phtml. If not define it

var editForm = new varienForm('wishlist-view-form');
  • in indexAction() I redirected but it's not calling the action defaultly it's calling form action why? Jan 28 '14 at 12:03
  • Because it is html standard behavior. Just set correct form action. Jan 28 '14 at 12:10
  • how can you suggest me? or post some of code it will be better for me. Jan 28 '14 at 12:12
  • <form id="wishlist-view-form" action="<?php echo $this->getUrl('wishlist/quote/index') ?>" method="post"> Jan 28 '14 at 12:14
  • In this form 4+1(custom button)=5 buttons is there so I want work every button as indusal how? Jan 28 '14 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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