ASHPackage

Object representation of a package from a shipment.

Defined (1)

The class is defined in the following location(s).

/wpsc-includes/shipping.helper.php  
  1. class ASHPackage { 
  2. /** 
  3. * Product ids included in package 
  4. * @var array 
  5. */ 
  6. var $product_id = array(); 
  7. /** 
  8. * Weight in pounds of the package 
  9. * @var decimal 
  10. */ 
  11. var $weight; 
  12. /** 
  13. * The height in inches of the package 
  14. * @var decimal 
  15. */ 
  16. var $height; 
  17. /** 
  18. * The length (longest part) of the package in inches 
  19. * @var decimal 
  20. */ 
  21. var $length; 
  22. /** 
  23. * The width of the package in inches 
  24. * @var decimal 
  25. */ 
  26. var $width; 
  27. /** 
  28. * Girth is defined, for a rectangle as G=2(Height+Width) 
  29. * is auto calc'ed when you use set_dimensions 
  30. * @var decimal 
  31. */ 
  32. var $girth; 
  33. /** 
  34. * Whatever you want to describe what is in the package 
  35. * @var string 
  36. */ 
  37. var $contents; 
  38. /** 
  39. * The value/price of the item/package 
  40. * @var decimal 
  41. */ 
  42. var $value; 
  43. /** 
  44. * Flag denotes if the package has hazardous material or not 
  45. * @var boolean 
  46. */ 
  47. var $hazard = FALSE; 
  48. /** 
  49. * Flag denotes if the package is to have insurance added to the quote 
  50. * @var boolean 
  51. */ 
  52. var $insurance = FALSE; 
  53. /** 
  54. * The amount that the package is to be insured for 
  55. * @var decimal 
  56. */ 
  57. var $insured_amount; 
  58. /** 
  59. * The package can't be shipped sideways. 
  60. * var boolean 
  61. */ 
  62. var $this_side_up = FALSE; 
  63.  
  64. /** 
  65. * The constructor for the ASHPackage class 
  66. * Accepts an arguments array to fill out the class on initialization 
  67. * @since 0.0.1 
  68. * @param array $args 
  69. */ 
  70. function ASHPackage(array $args = array()) { 
  71. foreach($args as $key=>$value) { 
  72. $this->$key=$value; 
  73. /** 
  74. * This is a "magic function" that will be used when I can convert to PHP5 
  75. * When a property / function is set to private, this controls access 
  76. * to outside functions 
  77. * @since 0.0.1 
  78. * @param string $item 
  79. * @return mixed 
  80. */ 
  81. function __get($item) { 
  82. return $this->$item; 
  83.  
  84. /** 
  85. * This is a "magic function" that sets a property that has as protected scope 
  86. * only for php5 
  87. * @since 0.0.1 
  88. * @param string $item 
  89. * @param mixed $value 
  90. */ 
  91. function __set($item, $value) { 
  92. $this->$item = $value; 
  93.  
  94. /** 
  95. * This is a magic function that controls how the string representation of 
  96. * the class looks / behaves. 
  97. * @since 0.0.1 
  98. */ 
  99. function __toString() { 
  100. // Nothing here yet 
  101.  
  102. /** 
  103. * Sets the dimensions for the package given an array 
  104. * array values should be "Height", "Length", "Width" and weight 
  105. * girth is automatically calculated 
  106. * @since 0.0.1 
  107. * @param array $dimensions 
  108. */ 
  109. function set_dimensions(array $dimensions) { 
  110. foreach($dimensions as $key=>$value) { 
  111. $this->$key = $value; 
  112. $this->girth = 2*($this->width+$this->height); 
  113.