1

Unable to redirect to the third party site after clicking place order.. I think I am having problem with my controller and .phtml file. Help me with the controller and .phtml files.. How do I write corresponding controller and .phtml code for this one?

config.xml
<?xml version="1.0" ?>
<config>
    <modules>
        <MyModule_ESewa>
            <version>1.0.0</version>    
        </MyModule_ESewa>   
    </modules>
    <global>
        <!-- declare helper class -->
        <helpers>
            <esewa>
                <class>MyModule_ESewa_Helper</class>
            </esewa>
        </helpers>
        <!-- model -->
        <models>
            <esewa>
                <class>MyModule_ESewa_Model</class>
            </esewa>
        </models>
        <blocks>
            <esewa>
                <class>MyModule_ESewa_Block</class>
            </esewa>
        </blocks>
        <!-- end of model -->
    </global>   
    <!-- start start of declaretion of payment -->
    <!-- declare default configuration values for this module -->
    <default>
    <!-- 'payment' configuration section (tab) -->
        <payment>
    <!-- 'newmodule' configuration group (fieldset) -->
            <esewa>
    <!-- by default this payment method is inactive -->
                <active>0</active>
    <!-- model to handle logic for this payment method -->          
                <model>esewa/standard</model>
                <!-- order status for new orders paid by this payment method -->
                <order_status>pending</order_status>
                <!-- set payment title to -->
                <title>Custom Payment</title>
                <allowspecific>0</allowspecific>

            </esewa>        
        </payment>
    </default>
</config> 




system.xml

<?xml version="1.0"?>
<config>
        <sections>
                <!-- goto  Payment Section -->
                <payment>
                        <!-- now goto payment group -->
                        <groups>
                                <esewa  translate="label" module="esewa">
                                    <label>eSewa</label>
                                    <sort_order>999</sort_order>
                                    <show_in_default>1</show_in_default>
                                    <show_in_website>1</show_in_website>
                                    <show_in_store>1</show_in_store>
                                    <fields>
                                        <active translate="label">
                                            <label>Enable</label>
                                            <frontend_type>select</frontend_type>
                                            <source_model>adminhtml/system_config_source_yesno</source_model>   
                                            <sort_order>1</sort_order>
                                            <show_in_default>1</show_in_default>
                                            <show_in_website></show_in_website>
                                            <show_in_store>1</show_in_store>
                                        </active>   
                                        <order_status translate="label">
                                            <label>New Order Status</label>
                                            <frontend_type>select</frontend_type>
                                            <source_model>adminhtml/system_config_source_order_status_newprocessing</source_model>
                                            <sort_order>2</sort_order>
                                            <show_in_default>1</show_in_default>
                                            <show_in_website>1</show_in_website>
                                            <show_in_store>1</show_in_store>
                                        </order_status>
                                        <title translate="label">
                                            <label>Title</label>
                                            <frontend_type>text</frontend_type>
                                            <sort_order>1</sort_order>
                                            <show_in_default>1</show_in_default>
                                            <show_in_website>1</show_in_website>
                                            <show_in_store>1</show_in_store>
                                        </title>
                                        <allowspecific translate="label">
                                            <label>Payment from Applicable Countries</label>
                                            <frontend_type>allowspecific</frontend_type>
                                            <sort_order>50</sort_order>
                                            <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
                                            <show_in_default>1</show_in_default>
                                            <show_in_website>1</show_in_website>
                                            <show_in_store>0</show_in_store>
                                        </allowspecific>
                                        <specificcountry translate="label">
                                            <label>Payment from Specific Countries</label>
                                            <frontend_type>multiselect</frontend_type>
                                            <sort_order>51</sort_order>
                                            <source_model>adminhtml/system_config_source_country</source_model>
                                            <show_in_default>1</show_in_default>
                                            <show_in_website>1</show_in_website>
                                            <show_in_store>0</show_in_store>
                                            <can_be_empty>1</can_be_empty>
                                        </specificcountry>
                                        <sort_order translate="label">
                                            <label>Sort Order</label>
                                            <frontend_type>text</frontend_type>
                                            <sort_order>100</sort_order>
                                            <show_in_default>1</show_in_default>
                                            <show_in_website>1</show_in_website>
                                            <show_in_store>0</show_in_store>
                                            <frontend_class>validate-number</frontend_class>
                                        </sort_order>

                                        <submit_url>
                                            <label>Gateway URL</label>
                                                <frontend_type>text</frontend_type>
                                                    <sort_order>58</sort_order>
                                                    <show_in_default>1</show_in_default>
                                                    <show_in_website>1</show_in_website>
                                                    <show_in_store>0</show_in_store>
                                        </submit_url>

                                        <merchant_id>
                                            <label>Merchant ID</label>
                                            <frontend_type>text</frontend_type>
                                            <sort_order>59</sort_order>
                                            <show_in_default>1</show_in_default>
                                            <show_in_website>1</show_in_website>
                                            <show_in_store>0</show_in_store>
                                        </merchant_id>  
                                </fields>
                                </esewa>
                        </groups>   
                </payment>
        </sections>
</config>  



standard.php
<?php
class MyModule_ESewa_Model_Standard extends Mage_Payment_Model_Method_Abstract
{
    protected $_code = 'esewa';
    protected $_canAuthorize = true;
    protected $_isGateway = true;


    public function getOrderPlaceRedirectUrl()
    {

        return Mage::getUrl('esewa/standard/redirect', array('_secure' => true));
    }

}
?> 
2

There are lot issue

issue1:

You cannot declare model and block,helpers types in Capital letter always change in lower case letter.so you need change ESewa to esewa

        <models><ESewa>..</ESewa></models>
        <helpers><ESewa>..</ESewa></helpers>
        <blocks><ESewa>..</ESewa></blocks>

modified config.xml

<?xml version="1.0" ?>
<config>
    <modules>
        <MyModule_ESewa>
            <version>1.0.0</version>    
        </MyModule_ESewa>   
    </modules>
    <global>
        <!-- declare helper class -->
        <helpers>
            <esewa>
                <class>MyModule_ESewa_Helper</class>
            </esewa>
        </helpers>
        <!-- model -->
        <models>
            <esewa>
                <class>MyModule_ESewa_Model</class>
            </esewa>
        </models>
        <blocks>
            <esewa>
                <class>MyModule_ESewa_Block</class>
            </esewa>
        </blocks>
        <!-- end of model -->
    </global>   
    <!-- start start of declaretion of payment -->
    <!-- declare default configuration values for this module -->
    <default>
    <!-- 'payment' configuration section (tab) -->
        <payment>
    <!-- 'newmodule' configuration group (fieldset) -->
            <esewa>
    <!-- by default this payment method is inactive -->
                <active>0</active>
    <!-- model to handle logic for this payment method -->          
                <model>esewa/standard</model>
                <!-- order status for new orders paid by this payment method -->
                <order_status>pending</order_status>
                <!-- set payment title to -->
                <title>Custom Payment</title>
                <allowspecific>0</allowspecific>

            </esewa>        
        </payment>
    </default>
</config> 

Issue2:

system.xml code is

<?xml version="1.0"?>
<config>
        <sections>
                <!-- goto  Payment Section -->
                <payment>
                        <!-- now goto payment group -->
                        <groups>
                                <esewa  translate="label" module="esewa">
                                    <label>My Payment</label>
                                    <sort_order>999</sort_order>
                                    <show_in_default>1</show_in_default>
                                    <show_in_website>1</show_in_website>
                                    <show_in_store>1</show_in_store>
                                    <fields>
                                        <active translate="label">
                                            <label>Enable</label>
                                            <frontend_type>select</frontend_type>
                                            <source_model>adminhtml/system_config_source_yesno</source_model>   
                                            <sort_order>1</sort_order>
                                            <show_in_default>1</show_in_default>
                                            <show_in_website></show_in_website>
                                            <show_in_store>1</show_in_store>
                                        </active>   
                                        <order_status translate="label">
                                            <label>New Order Status</label>
                                            <frontend_type>select</frontend_type>
                                            <source_model>adminhtml/system_config_source_order_status_newprocessing</source_model>
                                            <sort_order>2</sort_order>
                                            <show_in_default>1</show_in_default>
                                            <show_in_website>1</show_in_website>
                                            <show_in_store>1</show_in_store>
                                        </order_status>
                                        <title translate="label">
                                            <label>Title</label>
                                            <frontend_type>text</frontend_type>
                                            <sort_order>1</sort_order>
                                            <show_in_default>1</show_in_default>
                                            <show_in_website>1</show_in_website>
                                            <show_in_store>1</show_in_store>
                                        </title>
                                        <allowspecific translate="label">
                                            <label>Payment from Applicable Countries</label>
                                            <frontend_type>allowspecific</frontend_type>
                                            <sort_order>50</sort_order>
                                            <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
                                            <show_in_default>1</show_in_default>
                                            <show_in_website>1</show_in_website>
                                            <show_in_store>0</show_in_store>
                                        </allowspecific>
                                        <specificcountry translate="label">
                                            <label>Payment from Specific Countries</label>
                                            <frontend_type>multiselect</frontend_type>
                                            <sort_order>51</sort_order>
                                            <source_model>adminhtml/system_config_source_country</source_model>
                                            <show_in_default>1</show_in_default>
                                            <show_in_website>1</show_in_website>
                                            <show_in_store>0</show_in_store>
                                            <can_be_empty>1</can_be_empty>
                                        </specificcountry>
                                        <sort_order translate="label">
                                            <label>Sort Order</label>
                                            <frontend_type>text</frontend_type>
                                            <sort_order>100</sort_order>
                                            <show_in_default>1</show_in_default>
                                            <show_in_website>1</show_in_website>
                                            <show_in_store>0</show_in_store>
                                            <frontend_class>validate-number</frontend_class>
                                        </sort_order>

                                        <submit_url>
                                            <label>Gateway URL</label>
                                                <frontend_type>text</frontend_type>
                                                    <sort_order>58</sort_order>
                                                    <show_in_default>1</show_in_default>
                                                    <show_in_website>1</show_in_website>
                                                    <show_in_store>0</show_in_store>
                                        </submit_url>

                                        <merchant_id>
                                            <label>Merchant ID</label>
                                            <frontend_type>text</frontend_type>
                                            <sort_order>59</sort_order>
                                            <show_in_default>1</show_in_default>
                                            <show_in_website>1</show_in_website>
                                            <show_in_store>0</show_in_store>
                                        </merchant_id>  
                                </fields>
                                </esewa>
                        </groups>   
                </payment>
        </sections>
</config>   

ISSUE3:

standard.php file should be Standard.php and payment code ESewa should be small letter esewa and code is

 <?php
class MyModule_ESewa_Model_Standard extends Mage_Payment_Model_Method_Abstract
{
    protected $_code = 'esewa';


public function getOrderPlaceRedirectUrl()
{
    return Mage::getUrl('customcard/standard/redirect', array('_secure' => true));
}
}
?>

and MyModule_ESewa_Model_standard to MyModule_ESewa_Model_Standard

[Edit]:

As you want say you want redirect to third party site. According to you module after order place you will redirection customcard/standard/redirect page and from here you will redirect to third partly site.

  • I have replaced my code with yours one.. When I now click on the Payment Methods tab inside System -> configuration -> Payment Methods, it leads to me blank page however I can see URL in address bar.. The url looks like: index.php/backend/system_config/edit/section/payment/key/20ec1cfa469f09de6331a2240f0210e3/ .. I don't know what is the issue. – Sid Sep 7 '14 at 11:36
  • as you define system xml so need acl permission.So to admin>System>permission>roles>Select admin role and save it and then clear cache by delete form your magneto dir/var/cache – Amit Bera Sep 7 '14 at 11:40
  • did it! but still same problem, same blank page.. Can this issue happens if there is any problem on /app/etc/modules .xml file? – Sid Sep 7 '14 at 11:48
  • put it...on qyestin – Amit Bera Sep 7 '14 at 12:00
  • I have updated my question. See it – Sid Sep 7 '14 at 12:06
1

Clear cache and log out and login again.

Have you created the module file in app/etc/modules folder? Go to system->configuration->advanced and see if your module is present in the list. If not, it should be present there before you can start seeing it in the admin.

  • It is present in system->configuration->advanced. But Whenever I tried to click the Payment Method inside System->configuration->Payment Methods,it will just show up the blank page however I can see a link in my address bar. – Sid Sep 7 '14 at 11:22
  • Try logging out and logging back in. – Paras Sood Sep 7 '14 at 11:38

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.