1

I have a 2 page

Myorderhistoyr.phtml

invoice.phtml

in below code is working in invoice.phtml but same code i used in Myorderhistoyr.phtml but it's not display anything

  <?php 
$isPartner= Mage::getModel('marketplace/userprofile')->isPartner(); 
$helper= Mage::helper('marketplace');
if($isPartner==1){
    ?>
    <script type="text/javascript">
    if (typeof jQuery == 'undefined'){
        document.write(unescape("%3Cscript src='//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
    }
    </script>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />

    <?php //$customer = Mage::getSingleton('customer/session')->getCustomer();
    //$customer_name =  $customer->getName(); // Full Name  ?>
    <!-- <div class="page-title">
        <h1 style="float:left;"><?php //echo "$customer_name" ." Order History"; ?></h1>
    </div> -->
    <div class="wk_mp_design">
        <!-- <div class="block block-account">  
            <div class="block-title">   
                <strong><span><h4><?php //echo $helper->__('Order History') ?></h4></span></strong>
            </div>
        </div> -->

        <div class="fieldset wk_mp_fieldset">
            <div class="grid">
                <div class="hor-scroll">
                    <form action="<?php echo Mage::helper('core/url')->getCurrentUrl();?>" method="post">
                        <table cellspacing="0" class="border wk_mp_list_table">
                            <thead>
                                <tr id="wk_mp_tr_heading">
                                    <th><span><?php echo $helper->__('Order Id') ?></span></th>
                                    <th><span><?php echo $helper->__('Date') ?></span></th>
                                    <th><span><?php echo $helper->__('Order Status') ?></span></th>
                                    <th><span>&nbsp;</span></th>
                                </tr>
                            </thead>
                            <tbody class="wk_mp_body">
                                <tr>
                                    <td>
                                        <input type="text" class="input-text" name="s" placeholder='<?php echo $helper->__('Search by Order Id') ?>' value="<?php echo $this->getRequest()->getParam('s')?>"/>
                                    </td>
                                    <td>
                                        <span class="wk_mp_td_span">
                                            <?php //echo $helper->__('From: ') ?>
                                            <input name="from_date" id="special_from_date" class="input-text" value="<?php echo $this->getRequest()->getParam('from_date')?>" placeholder='<?php echo $helper->__('From:') ?>' />
                                        </span>                             
                                        <span class="wk_mp_td_span">
                                            <?php //echo $helper->__('To: ') ?>
                                            <input name="to_date" id="special_to_date" class="input-text" value="<?php echo $this->getRequest()->getParam('to_date')?>" placeholder='<?php echo $helper->__('To:') ?>' />
                                        </span>
                                    </td>
                                    <td>
                                        <select name="orderstatus" class="input-text">
                                            <option value=""><?php echo $helper->__('All') ?></option>
                                            <?php 
                                            $orderstatus_coll = Mage::getModel('sales/order_status')->getResourceCollection()->getData();
                                            foreach ($orderstatus_coll as $orderstatus) {
                                                ?>
                                                <option value="<?php echo $orderstatus['status']?>" <?php if($this->getRequest()->getParam('orderstatus') == $orderstatus['status']) echo 'selected="selected"'?>>
                                                    <?php echo $orderstatus['label'] ?>
                                                </option>
                                                <?php
                                            }
                                            ?>
                                        </select>
                                    </td>
                                    <td>
                                        <button class="button" title="Save" id="save_butn" type="submit">
                                            <span><span><span><?php echo $helper->__('Submit') ?></span></span></span>
                                        </button>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </form>
                    <?php 
                    if(count($this->getCollection())==0){ ?>        
                        <div class="fieldset wk_mp_fieldset">
                            <div class="wk_emptymsg">
                                <?php echo $helper->__('No Order Available') ?>
                            </div>
                        </div>
                        <?php 
                    } else{ ?>
                        <?php $i=0;
                        foreach($this->getCollection() as $res){
                            $order = Mage::getModel('sales/order')->load($res['mageorderid']);
                            $status=$order->getStatus();
                            $name=$order->getCustomerName();
                            if($res['mageorderid']>0){
                                $i++;?>
                                <div class="wk_orderbox <?php if($i==1) echo "wk_first_order"?>">
                                    <div class="order_summery">
                                        <div class="wk_orderbox_content1">
                                            <!-- <div class="wk_orderbox_details">
                                                <div class="color">
                                                    <span class="wk_ordertitle_label"><?php //echo $helper->__('Order') ?></span> <strong>#<?php //echo $res['magerealorderid']; ?></strong>
                                                </div>
                                                <div class="name">
                                                    <?php //echo Mage::getModel('marketplace/saleslist')->getpronamebyorder($res['mageorderid']); ?>                                        

                                                </div>
                                            </div>-->
                                            <div class="wk_orderbox_details">
                                            <input type="button" value=" <?php echo $helper->__('Order') ?>#<?php echo $res['magerealorderid']; ?>" id="hideshow<?php echo $res['magerealorderid']; ?>" class="buttontoggle">
                                                <div id="content<?php echo $res['magerealorderid']; ?>" style="display: none;">
                                                     <?php echo Mage::getModel('marketplace/saleslist')->getpronamebyorder($res['mageorderid']); ?> 
                                                    <script type="text/javascript">
                                                    jQuery(document).ready(function($){
                                                      $('#hideshow<?php echo $res['magerealorderid']; ?>').live('click', function(event) { 

                                                             $('#hideshow<?php echo $res['magerealorderid']; ?>').toggleClass( "ordershow" );       
                                                             $('#content<?php echo $res['magerealorderid']; ?>').toggle('3000');

                                                        });

                                                     });

                                                    </script>
                                                </div>
                                            </div>

                                            <div class="check_now">

                                            <?php 
                                            $_order=Mage::getModel('sales/order')->load($this->getRequest()->getParam('id')); 
                                            $helper=Mage::helper('marketplace');
                                            $orderItems=$this->getOrderItems();
                                            foreach($orderItems as $item) {
                                                $mageorderid = $item->getMageorderid();
                                                $item_status="";
                                                foreach($_order->getAllItems() as $itemdata) {
                                                    if($itemdata->getProductId()==$item->getMageproid())
                                                        $item_status=$itemdata->getStatus();
                                                }
                                            }
                                            ?>

                                            <?php 
                                                    $tracking = $this->getTrackingNumber($_order->getId()); 
                                                    if($tracking!=""){
                                                        $shipmentId = $tracking->getShipmentId();
                                                        $invoiceId=$tracking->getInvoiceId();
                                                    }
                                                ?>






        <!-- Custom Order Status display -->
                                <?php $custom_order_status = $_order->getStatusLabel(); ?>
                                <?php //echo $custom_order_status;?>
        <!-- Custom Order Status display -->

        <?php if ($custom_order_status != 'Completed' && $custom_order_status !='Canceled'){?>
        <div class="wk_mp_order-info-box">
            <div class="box box-payment">

                <?php if ($custom_order_status == 'RTO'){?>

                    <div class="rto_status">
                        <strong><?php echo "This Order Has been  RTO State You can't able to Process"; ?>
                        </strong>
                    </div>

                <?php }
                    else{ ?>
                <div class="box-title">
                    <h2>
                        <span><?php echo $this->__('Process Your Order ') ?></span>
                    </h2>
                </div>
                <?php }?>
                <div class="box-content">
                <?php
                    $orderItems=$this->getOrderItems();
                    foreach($orderItems as $item) {
                        $item_status="";
                        foreach($_order->getAllItems() as $itemdata) {
                            if($itemdata->getProductId()==$item->getMageproid())
                                $item_status=$itemdata->getStatus();
                        }
                    }
                    $shipping_coll = Mage::getModel('mpshippingmanager/tracking')->getCollection()
                                    ->addFieldToFilter('order_id',array('eq'=>$this->getRequest()->getParam('id')))
                                    ->addFieldToFilter('seller_id',array('eq'=>Mage::getSingleton('customer/session')->getCustomerId()));
                    if(count($shipping_coll)){?>
                        <?php 
                        $tracking=$this->getTrackingNumber($_order->getId());
                        if($tracking!=""){
                            $disabled=$tracking->getTrackingNumber()==''? "":"readonly='readonly'";
                            $shipmentId = $tracking->getShipmentId();
                            $invoiceId=$tracking->getInvoiceId();
                            $shippingamount=$tracking->getShippingCharges();
                        }
                        if($_order->getStatus()=='pending' && $vendor_item_status!='canceled'){?>
                            <div class="scontent_status">
                                <span><?php echo $helper->__('Please Wait for Order Approve Your Admin');?></span></div>
                        <?php
                        }elseif(strtolower($vendor_item_status)=='canceled'){?>
                            <h3 class="scontent_status"><?php echo $helper->__('Order Canceled');?></h3>
                        <?php
                        }else{
                        ?>
                            <form action="<?php echo $this->getUrl('mpshippingmanager/shipping/savetrackingnumber')?>" id="shipping-form" method="post">



                                <div class="shipping_top" style="display:none">
                                    <span class="shipping_service"><?php echo $helper->__('Carrier');?></span>
                                    <span class="row_total"><?php echo $helper->__('Tracking Number');?></span>
                                </div>
                                <div class="items">
                                    <input class="required-entry" type="hidden" value="<?php echo $_order->getId(); ?>" name="order_id"/>
                                    <div class="wk_item">
                                        <span class="carrier" style="display:none"><input class="required-entry carrier" value="<?php echo $tracking->getCarrierName(); ?>" <?php echo $disabled;?> type="text" name="carrier"/></span>
                                        <span class="row_total wk_track_input" style="display:none">
                                            <!-- <input value="<?php //echo $tracking->getTrackingNumber(); ?>" <?php //echo $disabled;?> type="text" name="tracking_id"/> -->
                                            <input value="0" type="text" name="tracking_id"/>
                                        </span>
                                        <div class="order-status">
                                        <?php if(count($shipping_coll)): ?>
                                            <?php if($item_status=="Ordered"): ?>
                                                <a href="<?php echo $this->getUrl('mpshippingmanager/shipping/cancelorder',array('id'=>$mageorderid))?>">
                                                    <button class="button wk_mp_btn" style="flaot:none" title="<?php echo $helper->__('Cancel Order') ?>" type="button" id="save_butn" >
                                                        <span><span><?php echo $helper->__('Cancel Order') ?></span></span>
                                                    </button>
                                                </a>
                                            <?php endif;  ?>
                                        <?php endif; ?>

                                        <?php if($item_status=="Ordered"||$item_status=="Invoiced"){?>

                                            <button class="button wk_mp_btn" style="flaot:none" title="<?php echo $helper->__('Generate Invoice') ?>" type="submit" id="save_butn" >
                                                <span><span><?php echo $helper->__('Invoice') ?></span></span>
                                            </button>
                                        <?php } ?>


                                        <!-- Custom Order Status -->
                                        <?php if ($custom_order_status == 'Invoiced'){?>
                                        <a href="<?php echo $this->getUrl('mpshippingmanager/shipping/shipementorder',array('id'=>$mageorderid))?>">
                                          <button class="button wk_mp_btn" style="flaot:none" title="<?php echo $helper->__('Shipment') ?>" type="button" id="save_butn" >
                                          <span><span><?php echo $helper->__('Shipment') ?></span></span>
                                          </button>
                                        </a> 
                                        <?php }?>


                                        <?php if ($custom_order_status == 'Shipement'){?>
                                        <a href="<?php echo $this->getUrl('mpshippingmanager/shipping/rtoorder',array('id'=>$mageorderid))?>">
                                          <button class="button wk_mp_btn" style="flaot:none" title="<?php echo $helper->__('RTO') ?>" type="button" id="save_butn" >
                                          <span><span><?php echo $helper->__('RTO') ?></span></span>
                                          </button>
                                        </a>
                                        <?php }?>

                                        <!-- Custom Order Status -->





                                    </div>

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


                        <?php 
                        } ?>
                    <?php
                    }else{
                        echo $_order->getShipping_description();
                    }?>
                </div>
            </div>
        </div>
        <?php }?>

                                        </div>
                                            <?php //echo $status;?>

                                            <div class="order_details">

                                                    <?php
                                                        $shipping_coll = Mage::getModel('mpshippingmanager/tracking')->getCollection()
                                                                        ->addFieldToFilter('order_id',array('eq'=>$res['mageorderid']))
                                                                        ->addFieldToFilter('seller_id',array('eq'=>$res['mageproownerid']));
                                                        if(count($shipping_coll)): ?>
                                                        <?php if ($status !='pending' && $status != 'canceled'){?>
                                                            <a href="<?php echo $this->getUrl('mpshippingmanager/shipping/invoice',array('id'=>$res['mageorderid']))?>" >
                                                                <button class="button" title="<?php echo $helper->__('Process Your Order') ?>" type="button">
                                                                    <span><span><span><?php echo $helper->__('Invoice') ?></span></span></span>
                                                                </button>
                                                            </a>
                                                            <?php }?>
                                                        <?php endif;?>

                                                        <a href="<?php echo $this->getUrl('marketplace/marketplaceaccount/vieworder',array('id'=>$res['mageorderid']))?>">
                                                        <button class="button" title="<?php echo $helper->__('View Order') ?>" type="button">
                                                            <span><span><span><?php echo $helper->__('View') ?></span></span></span>
                                                        </button>
                                                    </a>
                                                </div>


                                            <div class="wk_dash_orderstatus">

                                                <div class="ma"><?php //echo $sta = "Status";?></div>

                                                <label for="name" class="wk_dash_label">
                                                        <div class="status <?php echo strtolower($status); ?>"><?php echo strtoupper($status); ?> 
                                                        </div>
                                                </label> 

                                            </div>
                                            <div class="pending_ststus">
                                            <?php if ($status =='pending'){

                                            echo "Please Wait for Admin Approval";

                                            }?>
                                        </div>

                                            <div style="clear:both;"></div>
                                        </div>

                                        <div class="wk_orderbox_content2">
                                            <div class="wk_orderbox_details">
                                                <div class="wk_orderbox_details_customer">
                                                    <span class="wk_title_label"><?php echo $helper->__('Customer: ');?></span>
                                                    <span class="wk_label"><?php echo $name;?></span>&nbsp;&nbsp;
                                                </div>
                                                <div class="wk_orderbox_details_date">
                                                <span class="wk_title_label"><?php echo $helper->__('Date: ');?></span>
                                                <span class="wk_label"><?php echo $res['cleared_at'];?></span>
                                            </div>
                                            <div class="wk_orderbox_total">
                                                <span class="wk_title_label"><?php echo $helper->__('Order Total: ');?></span>
                                                <span class="wk_label"><strong><?php echo Mage::helper('core')->currency(Mage::getModel('marketplace/saleslist')->getPricebyorder($res['mageorderid']));?></strong>
                                                </span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="wk_clear"></div>
                            <?php }
                        }   ?>
                        <?php
                    }?>
                </div>
            </div>
            <?php echo $this->getPagerHtml(); ?>        
        </div>  

    </div>
    <script> 
        var $wk_jq=jQuery.noConflict();
        (function($wk_jq){
            $wk_jq( "#special_from_date" ).datepicker({dateFormat: "yy-mm-dd"});
            $wk_jq( "#special_to_date" ).datepicker({dateFormat: "yy-mm-dd"});          
        })($wk_jq);
    </script>
<?php 
}else{
    echo "<h2 class='wk_new_msg'>".$helper->__("To BECOME SELLER PLEASE CONTACT TO ADMIN.")."</h2>";
}?>

xml file

<?xml version="1.0"?>   
<layout version="0.1.0">   
    <customer_account>
        <block name="marketplacenavigation">
            <block type="core/template" name="shippingleftlink" template="mpshippingmanager/shippingleftlink.phtml"/>
        </block>
    </customer_account>

    <mpshippingmanager_shipping_index>
        <update handle="customer_account"/>
        <reference name="head">
            <action method="addCss"><stylesheet>marketplace/mpshippingmanager/css/mpshipping.css</stylesheet></action>
            <action method="addCss"><stylesheet>marketplace/css/style.css</stylesheet></action>
        </reference>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
        <reference name="content">
             <block type="core/template" name="mpshippingmanager" as="mpshippingmanager" template="mpshippingmanager/index.phtml" />
        </reference>
    </mpshippingmanager_shipping_index>

    <marketplace_account_salesdetail>
        <reference name="head">
            <action method="addCss"><stylesheet>marketplace/mpshippingmanager/css/mpshipping.css</stylesheet></action>
        </reference>
         <update handle="customer_account"/>
          <reference name="content">
            <block type="mpshippingmanager/salesdetail" name="marketplace_salesdetail" as="marketplace_salesdetail" template="mpshippingmanager/salesdetail.phtml"/>
        </reference>
    </marketplace_account_salesdetail>

    <marketplace_account_invoice>
        <reference name="head">
            <action method="addCss"><stylesheet>marketplace/mpshippingmanager/css/mpshipping.css</stylesheet></action>
        </reference>
        <update handle="customer_account"/>
          <reference name="content">
            <block type="mpshippingmanager/invoice" name="marketplace_invoice" template="mpshippingmanager/invoice.phtml"/>
        </reference>
        <reference name="root">
            <action method="setTemplate"><template>page/1column.phtml</template></action>
        </reference>
    </marketplace_account_invoice>

    <marketplace_account_orderhistory>
        <reference name="head">
            <action method="addCss"><stylesheet>marketplace/mpshippingmanager/css/mpshipping.css</stylesheet></action>
            <action method="addCss"><stylesheet>marketplace/mpshippingmanager/css/datepicker/jquery-ui.css</stylesheet></action>    
        </reference>
        <reference name="content">
            <remove name="marketplace_myorderhistory"></remove>
            <block type="mpshippingmanager/invoice" name="mpshipping_invoice" template="mpshippingmanager/ordershipslip.phtml" before="_"/>
            <block type="marketplace/products" name="marketplace_myorderhistory_shipping" template="mpshippingmanager/myorderhistory.phtml" />
        </reference>

        <reference name="root">
            <action method="setTemplate"><template>page/1column.phtml</template></action>
        </reference>
    </marketplace_account_orderhistory>
    <marketplace_account_productlist>
        <reference name="content">
            <remove name="marketplace_myproductslist"></remove>
            <block type="marketplace/marketplace" name="marketplace_myproductslist_shipping" template="mpshippingmanager/myproductlist.phtml"/>
        </reference>
    </marketplace_account_productlist>  
</layout>   
  • did the block for both phtml is same too? – Qaisar Satti Jan 27 '16 at 9:03
  • which means???? – Magento 2 Jan 27 '16 at 9:04
  • paste ur xml too for adding the phtml file – Qaisar Satti Jan 27 '16 at 9:05
  • Check my updated question – Magento 2 Jan 27 '16 at 9:09
  • try to load your order by order id $order=Mage::getModel('sales/order')->load('order id'); and then check – Qaisar Satti Jan 27 '16 at 9:18
1

replace this

$_order=Mage::getModel('sales/order')->load($this->getRequest()->getParam('id')); 

with

$_order=Mage::getModel('sales/order')->load($res['mageorderid']); 
| improve this answer | |
  • Now it's showing Shipping - Charges : but i have a button it's not showing on that – Magento 2 Jan 27 '16 at 10:05
  • Button like Invoice & shipement it's not showing on that page – Magento 2 Jan 27 '16 at 10:06
  • change this too $orderItems=$this->getOrderItems(); to $orderItems=$_order->getOrderItems(); and check the code accordingly – Qaisar Satti Jan 27 '16 at 10:08
  • now also same i changed all place else part only work – Magento 2 Jan 27 '16 at 10:11
  • yes check there is used $this change it according to that.. – Qaisar Satti Jan 27 '16 at 10:47

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.