1

I am creating custom module for RMA(product return) in magento that's why I am trying to add a custom link "Return Request" in My Orders panel in customer account section as shown in below image- enter image description here

For that I have created module "Assel_Rma" which have some files as below-

config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
  <modules>
        <Assel_Rma>
            <version>1.0.2</version>
        </Assel_Rma>
   </modules>
   <frontend>
        <routers>
            <rma>
                <use>standard</use>
                <args>
                    <module>Assel_Rma</module>
                    <frontName>rma</frontName>
                </args>
            </rma>
        </routers>
        <layout>
            <updates>
                <rma>
                    <file>assel/rma.xml</file>
                </rma>
            </updates>
     </layout>
    </frontend>
    <global>
        <models>
            <rma>
                <class>Assel_Rma_Model</class>
            </rma>
        </models>
        <blocks>
            <rma>
                <class>Assel_Rma_Block</class>
            </rma> 
            <sales>
                <rewrite>
                    <sales_order_history>Assel_Rma_Block_Sales_Order_History</sales_order_history>
                </rewrite>
           </sales>               
        </blocks>
        <helpers>
            <rma>
                <class>Assel_Rma_Helper</class>
            </rma>
        </helpers>
    </global>
</config>

frontend/base/default/layout/assel.xml

<?xml version="1.0"?>
<layout version="0.1.0">

    <sales_order_history translate="label">
        <label>Customer My Account Order History</label>
        <update handle="customer_account"/>
        <reference name="my.account.wrapper">
            <action method="setTemplate">
                <template>rma/sales/order/history.phtml</template>
            </action>
          <block type="customer/account_dashboard" name="customer.account.link.back" template="customer/account/link/back.phtml"/> 
        </reference>
        <reference name="left">
            <remove name="catalog.shopby"/>
            <remove name="basenews"/>
            <remove name="bestsales"/>
            <remove name="left-block-banner-free"/>
            <remove name="blogleft" /> 
        </reference>
    </sales_order_history>

</layout>

app/code/local/Assel/Rma/Block/Sales/Order/History.php

<?php
class Assel_Rma_Block_Sales_Order_History extends Mage_Sales_Block_Order_History
{
}

After doing all above now "My Orders" looks like as below-

enter image description here

In above image my sidebar gets doubled and nothing is shown on the page. can anyone please help me to get rid out of this problem.

1 Answer 1

1

change rewrite code in xml

<sales>
                <rewrite>
                    <order_history>Assel_Rma_Block_Sales_Order_History</order_history>
                </rewrite>
           </sales>

you have to set template from block as it is set in Mage_sales_Block_Order_History.

public function __construct()
    {
        parent::__construct();
        $this->setTemplate('rma/sales/order/history.phtml');

        $orders = Mage::getResourceModel('sales/order_collection')
            ->addFieldToSelect('*')
            ->addFieldToFilter('customer_id', Mage::getSingleton('customer/session')->getCustomer()->getId())
            ->addFieldToFilter('state', array('in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates()))
            ->setOrder('created_at', 'desc')
        ;

        $this->setOrders($orders);

        Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('root')->setHeaderTitle(Mage::helper('sales')->__('My Orders'));
    }
32
  • thanks for the reply @ Qaisar..I have added that _construct() function in my block file but no luck even I have cleared cache. Oct 28, 2015 at 12:20
  • did you remove it from xml? Oct 28, 2015 at 12:21
  • Sorry but what I need to remove from xml.? Oct 28, 2015 at 12:23
  • when you set it from block what you need xml for? do it from one place Oct 28, 2015 at 12:23
  • Ok. I removed code from xml so now sidebar comes only once but page still show empty. Oct 28, 2015 at 12:25

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.