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

asked Mar 13, 2017 at 13:51

1 Answer 1

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

answered Mar 13, 2017 at 14:07
1
  • i did but it didn't work Commented Mar 13, 2017 at 15:22

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.