1

I extended the controller CartController and I added a post action

class Zap_PayFee_Checkout_CartController extends Mage_Checkout_CartController
    {

        public function indexAction() {
            Mage::log('IndexAction');
            parent::indexAction();
        }

        public function estimatePayFeePostAction()
        {
            Mage::log('Estimate Payfee Action Post');
        }
    }

my config.xml

...
    <frontend>
        <routers>
             <checkout>
                <args>
                    <modules>
                        <zap_payfee before="Mage_Checkout">Zap_PayFee_Checkout</zap_payfee>
                    </modules>
                </args>
            </checkout>
        </routers>
    </frontend>
    ......
    <global>
        <rewrite>
                <zap_payfee_checkout_cart>
                    <from><![CDATA[#^/checkout/cart/#]]></from>  
                    <to>/payfee/checkout_cart/</to>
                </zap_payfee_checkout_cart>
        </rewrite>
    </global>
...

payfee.phtml

<form id="payfee-cart" method="post" action="<?php echo $this->getUrl('checkout/cart/estimatePayFeePostAction') ?>">
    <fieldset>
    <?php foreach($methods as $method =>$type):?>

        <input type="radio" name="payfee" value="<?php echo $type['value'];?>"><?php echo $type['label'];?>
    <?php endforeach;?>
    </fieldset>
    <div class="buttons-set">
                <button type="button"
                        title="<?php echo $this->__('Get PayFee') ?>"
                        onclick="coPayFeeMethodForm.submit()"
                        class="button">
                        <span><span>
                        <?php echo $this->__('Get PayFee') ?>

                    </button>
    </div>
</form>

the indexAction () works while estimatePayFeePostAction () does not work

what is my url address ? action= getUrl('checkout/cart/estimatePayFeePostAction')

2
  • In your controller did you add <?php require_once Mage::getModuleDir('controllers', 'Mage_Checkout') . DS . 'CartController.php'; class Zap_PayFee_Checkout ... and geturl should be Mage::getUrl('checkout/cart/estimatePayFeePost')` Oct 7 '14 at 15:26
  • Also if you use before="Mage_Checkout" then you dont need <from><![CDATA[#^/checkout/cart/#]]></from> <to>/payfee/checkout_cart/</to> Oct 7 '14 at 15:33
0

It's not required to add 'action' when using getUrl

$action = Mage::getUrl('checkout/cart/estimatePayFeePost');

Should return the currect url.

0

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.