0

i'd like to add Carrier (shipping method_ column on magento admin pate under magento > sales > shipments

i put this code in Grid.php

protected function _prepareCollection()

{
    $collection = Mage::getResourceModel($this->_getCollectionClass());
    $collection->getSelect()->join('sales_flat_order', 'main_table.entity_id =

sales_flat_order.entity_id',array('shipping_method')); $this->setCollection($collection);z return parent::_prepareCollection(); }

$this->addColumn('shipping_method', array( 'header'=> Mage::helper('sales')->__('Shipping Method'), 'width' => '80px', 'type' => 'options', 'index' => 'shipping_method', 'options' => $shippingmethods, ));

but What i want to be shown is carrier title....like UPS, USPS, DHL that code show me bit different result tThx n

0
$methods = Mage::getSingleton('shipping/config')->getActiveCarriers();
            $shippingmethods = array();
            foreach($methods as $_ccode => $_carrier) {
                if($_methods = $_carrier->getAllowedMethods())  {
                    if(!$_title = Mage::getStoreConfig("carriers/$_ccode/title"))
                        $_title = $_ccode;
                    foreach($_methods as $_mcode => $_method)   {
                        $_code = $_ccode . '_' . $_mcode;
                        $shippingmethods[$_code]= $_title;
                    }
                }
            }

            $this->addColumn('shipping_method', array(
            'header'=> Mage::helper('sales')->__('Shipping Method'),
            'width' => '80px',
            'type'  => 'options',
            'index' => 'shipping_method',
            'options' => $shippingmethods,
            ));

try above code. Hope it helps to get Shipping Title. Thanks

  • i did but it didn't work – Diny Na Mar 13 '17 at 15:22

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.