Mage_Sales_Model_Order_Shipment_Track Class Reference

Inheritance diagram for Mage_Sales_Model_Order_Shipment_Track:

Mage_Sales_Model_Abstract Mage_Core_Model_Abstract Varien_Object

List of all members.

Public Member Functions

 _construct ()
 setShipment (Mage_Sales_Model_Order_Shipment $shipment)
 getShipment ()
 isCustom ()
 getNumberDetail ()
 getStore ()

Public Attributes

const CUSTOM_CARRIER_CODE = 'custom'

Protected Attributes

 $_shipment = null
 $_eventPrefix = 'sales_order_shipment_track'
 $_eventObject = 'track'


Detailed Description

Definition at line 27 of file Track.php.


Member Function Documentation

_construct (  ) 

Initialize resource model

Reimplemented from Varien_Object.

Definition at line 38 of file Track.php.

00039     {
00040         $this->_init('sales/order_shipment_track');
00041     }

getNumberDetail (  ) 

Retrieve detail for shipment track

Returns:
string

Definition at line 79 of file Track.php.

00080     {
00081         $carrierInstance = Mage::getSingleton('shipping/config')->getCarrierInstance($this->getCarrierCode());
00082         if (!$carrierInstance) {
00083             $custom['title'] = $this->getTitle();
00084             $custom['number'] = $this->getNumber();
00085             return $custom;
00086         } else {
00087             $carrierInstance->setStore($this->getStore());
00088         }
00089 
00090         if (!$trackingInfo = $carrierInstance->getTrackingInfo($this->getNumber())) {
00091             return Mage::helper('sales')->__('No detail for number "%s"', $this->getNumber());
00092         }
00093 
00094         return $trackingInfo;
00095     }

getShipment (  ) 

Retrieve Shipment instance

Returns:
Mage_Sales_Model_Order_Shipment

Definition at line 60 of file Track.php.

00061     {
00062         if (!($this->_shipment instanceof Mage_Sales_Model_Order_Shipment)) {
00063             $this->_shipment = Mage::getModel('sales/order_shipment')->load($this->getParentId());
00064         }
00065 
00066         return $this->_shipment;
00067     }

getStore (  ) 

Get store object

Returns:
Mage_Core_Model_Store

Reimplemented from Mage_Sales_Model_Abstract.

Definition at line 102 of file Track.php.

00103     {
00104         if ($this->getShipment()) {
00105             return $this->getShipment()->getStore();
00106         }
00107         return Mage::app()->getStore();
00108     }

isCustom (  ) 

Definition at line 69 of file Track.php.

00070     {
00071         return $this->getCarrierCode() == self::CUSTOM_CARRIER_CODE;
00072     }

setShipment ( Mage_Sales_Model_Order_Shipment shipment  ) 

Declare Shipment instance

Parameters:
Mage_Sales_Model_Order_Shipment $shipment
Returns:
Mage_Sales_Model_Order_Shipment_Item

Definition at line 49 of file Track.php.

00050     {
00051         $this->_shipment = $shipment;
00052         return $this;
00053     }


Member Data Documentation

$_eventObject = 'track' [protected]

Reimplemented from Mage_Core_Model_Abstract.

Definition at line 33 of file Track.php.

$_eventPrefix = 'sales_order_shipment_track' [protected]

Reimplemented from Mage_Core_Model_Abstract.

Definition at line 32 of file Track.php.

$_shipment = null [protected]

Definition at line 30 of file Track.php.

const CUSTOM_CARRIER_CODE = 'custom'

Definition at line 29 of file Track.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:48 2009 for Magento by  doxygen 1.5.8