2

I am using Marketplace in my website so seller can able to process their order in their dashboard.

In seller Dashboard My order history it shows all order with order id on that page I try to make process their order like Invoice & Shipment

But my problem is all order id shows with in foreach {} i also try to place code in that my code also have foreach.I placed code in this way foreach {foreach {}}

i think this is the reason it not working can you please anyone tell me the what is problem here?

   <div class="Check_now">


                                        <?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" style="display:none">
            <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 }?>

in check now part not working in that page

| improve this question | | | | |
  • you are missing this <?php echo $tracking->getCarrierName(); ?> because there is not tracking variable in code. add this or remove this will work – Qaisar Satti Feb 1 '16 at 7:04
  • I noticed that in your code neither your first foreach($this->getCollection() as $res) { nor if($res['mageorderid']>0) { does not have a closing bracket (}). It looks like you need to add <?php } } ?> at the very end of your file. Sure, if you pasted the entire part of your code here and did not miss anything. – Yaroslav Rogoza Feb 1 '16 at 7:12
  • @QaisarSatti where i need to add this – Magento 2 Feb 1 '16 at 7:20
  • @YaroslavRogoza i didn't get this – Magento 2 Feb 1 '16 at 7:21
  • <span class="carrier" style="display:none"><input class="required-entry carrier" value="<?php echo $tracking->getCarrierName(); ?>" <?php echo $disabled;?> type="text" name="carrier"/></span> remove this and check it is working – Qaisar Satti Feb 1 '16 at 7:30
2

add this code in you phtml and this method to getTrackingNumber to your block that will make it work.

<?php 
   $tracking = $this->getTrackingNumber($_order->getId()); 
      if($tracking!=""){
        $shipmentId = $tracking->getShipmentId();
      $invoiceId=$tracking->getInvoiceId();
       }
  ?>
| improve this answer | | | | |
  • Check my updated question i added that code and your code it's not working what is the problem on that – Magento 2 Feb 1 '16 at 9:03
  • did you add method in block i ask you? – Qaisar Satti Feb 1 '16 at 9:07
  • Check now question i add that form code as well as your code – Magento 2 Feb 1 '16 at 9:09
  • can you give me live link so i can check? – Qaisar Satti Feb 1 '16 at 9:10
  • you mean user name psw and url right? – Magento 2 Feb 1 '16 at 9:11

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.