shipperhq_shipperhq - Version 2.52.0

Version Notes

Accessorial support in admin

Download this release

Release Info

Developer Karen Baker
Extension shipperhq_shipperhq
Version 2.52.0
Comparing to
See all releases


Version 2.52.0

Files changed (121) hide show
  1. app/code/community/Shipperhq/Frontend/Block/Adminhtml/Sales/Order/Create/Shipping/Method/Form.php +135 -0
  2. app/code/community/Shipperhq/Frontend/Block/Catalog/Helper.php +226 -0
  3. app/code/community/Shipperhq/Frontend/Block/Catalog/Shipresults.php +94 -0
  4. app/code/community/Shipperhq/Frontend/Block/Checkout/AbstractBlock.php +52 -0
  5. app/code/community/Shipperhq/Frontend/Block/Checkout/Helper.php +698 -0
  6. app/code/community/Shipperhq/Frontend/Block/Checkout/Multishipping/Shipping.php +122 -0
  7. app/code/community/Shipperhq/Frontend/Block/Checkout/Onepage/Progress.php +52 -0
  8. app/code/community/Shipperhq/Frontend/Block/Checkout/Onepage/Shipping/Method/Available.php +158 -0
  9. app/code/community/Shipperhq/Frontend/Model/Checkout/Type/Multishipping.php +181 -0
  10. app/code/community/Shipperhq/Frontend/etc/config.xml +9 -0
  11. app/code/community/Shipperhq/Migration/Block/Adminhtml/Migration.php +48 -0
  12. app/code/community/Shipperhq/Migration/Block/Adminhtml/Migration/Edit/Form.php +35 -0
  13. app/code/community/Shipperhq/Migration/Block/Adminhtml/Migration/Migratable.php +214 -0
  14. app/code/community/Shipperhq/Migration/Helper/Data.php +152 -0
  15. app/code/community/Shipperhq/Migration/Model/Migrate.php +271 -0
  16. app/code/community/Shipperhq/Migration/Model/Product/Action.php +152 -0
  17. app/code/community/Shipperhq/Migration/Model/Resource/Iterator/Batched.php +63 -0
  18. app/code/community/Shipperhq/Migration/controllers/Adminhtml/Shqmigration/AjaxController.php +140 -0
  19. app/code/community/Shipperhq/Migration/controllers/Adminhtml/ShqmigrationController.php +76 -0
  20. app/code/community/Shipperhq/Migration/etc/adminhtml.xml +67 -0
  21. app/code/community/Shipperhq/Migration/etc/config.xml +85 -0
  22. app/code/community/Shipperhq/Migration/etc/migrate.xml +95 -0
  23. app/code/community/Shipperhq/Paypalexpress/Model/Express/Checkout.php +126 -0
  24. app/code/community/Shipperhq/Paypalexpress/etc/config.xml +47 -0
  25. app/code/community/Shipperhq/Pbint/Block/Adminhtml/System/Upload.php +73 -0
  26. app/code/community/Shipperhq/Pbint/Block/Sales/Order/Duty.php +55 -0
  27. app/code/community/Shipperhq/Pbint/Helper/Data.php +64 -0
  28. app/code/community/Shipperhq/Pbint/Model/Catalog/Category.php +180 -0
  29. app/code/community/Shipperhq/Pbint/Model/Catalog/Cron.php +151 -0
  30. app/code/community/Shipperhq/Pbint/Model/Catalog/File.php +862 -0
  31. app/code/community/Shipperhq/Pbint/Model/Catalog/Product.php +244 -0
  32. app/code/community/Shipperhq/Pbint/Model/Credentials.php +78 -0
  33. app/code/community/Shipperhq/Pbint/Model/Creditmemo/Duty.php +75 -0
  34. app/code/community/Shipperhq/Pbint/Model/Helper.php +224 -0
  35. app/code/community/Shipperhq/Pbint/Model/Inboundparcel.php +40 -0
  36. app/code/community/Shipperhq/Pbint/Model/Invoice/Duty.php +79 -0
  37. app/code/community/Shipperhq/Pbint/Model/Mysql4/Inboundparcel.php +39 -0
  38. app/code/community/Shipperhq/Pbint/Model/Mysql4/Inboundparcel/Collection.php +39 -0
  39. app/code/community/Shipperhq/Pbint/Model/Mysql4/Ordernumber.php +39 -0
  40. app/code/community/Shipperhq/Pbint/Model/Mysql4/Ordernumber/Collection.php +39 -0
  41. app/code/community/Shipperhq/Pbint/Model/Mysql4/Variable.php +39 -0
  42. app/code/community/Shipperhq/Pbint/Model/Mysql4/Variable/Collection.php +39 -0
  43. app/code/community/Shipperhq/Pbint/Model/Observer.php +171 -0
  44. app/code/community/Shipperhq/Pbint/Model/Ordernumber.php +40 -0
  45. app/code/community/Shipperhq/Pbint/Model/Pdf/Duty.php +41 -0
  46. app/code/community/Shipperhq/Pbint/Model/Quote/Duty.php +90 -0
  47. app/code/community/Shipperhq/Pbint/Model/Resource/Mysql4/Setup.php +33 -0
  48. app/code/community/Shipperhq/Pbint/Model/Variable.php +40 -0
  49. app/code/community/Shipperhq/Pbint/README +2 -0
  50. app/code/community/Shipperhq/Pbint/changelog.txt +0 -0
  51. app/code/community/Shipperhq/Pbint/controllers/Adminhtml/ShqpitneyController.php +66 -0
  52. app/code/community/Shipperhq/Pbint/etc/config.xml +248 -0
  53. app/code/community/Shipperhq/Pbint/etc/system.xml +162 -0
  54. app/code/community/Shipperhq/Pbint/sql/shqpbint_setup/mysql4-install-1.0.0.php +72 -0
  55. app/code/community/Shipperhq/Pbint/sql/shqpbint_setup/mysql4-install-1.0.1.php +73 -0
  56. app/code/community/Shipperhq/Pbint/sql/shqpbint_setup/mysql4-upgrade-1.0.0-1.0.1.php +29 -0
  57. app/code/community/Shipperhq/Shipper/Block/Adminhtml/Carrier/About.php +72 -0
  58. app/code/community/Shipperhq/Shipper/Block/Adminhtml/Carrier/Heading.php +48 -0
  59. app/code/community/Shipperhq/Shipper/Block/Adminhtml/Carrier/Refreshcarriers.php +74 -0
  60. app/code/community/Shipperhq/Shipper/Block/Adminhtml/Catalog/Product/Edit/Tab/Dimensional.php +50 -0
  61. app/code/community/Shipperhq/Shipper/Block/Adminhtml/Synchronize.php +57 -0
  62. app/code/community/Shipperhq/Shipper/Block/Adminhtml/Synchronize/Grid.php +96 -0
  63. app/code/community/Shipperhq/Shipper/Block/Adminhtml/Synchronize/Notify.php +97 -0
  64. app/code/community/Shipperhq/Shipper/Block/Adminhtml/System/Config/Fieldset/Shipper/Hint.php +51 -0
  65. app/code/community/Shipperhq/Shipper/Helper/Data.php +1026 -0
  66. app/code/community/Shipperhq/Shipper/Helper/Mapper.php +48 -0
  67. app/code/community/Shipperhq/Shipper/Model/Adminhtml/System/Config/Source/Carriers.php +57 -0
  68. app/code/community/Shipperhq/Shipper/Model/Adminhtml/System/Config/Source/Environmentscope.php +63 -0
  69. app/code/community/Shipperhq/Shipper/Model/Attributeupdate.php +41 -0
  70. app/code/community/Shipperhq/Shipper/Model/Carrier/Backup.php +142 -0
  71. app/code/community/Shipperhq/Shipper/Model/Carrier/Convert/AddressMapper.php +256 -0
  72. app/code/community/Shipperhq/Shipper/Model/Carrier/Convert/OrderMapper.php +274 -0
  73. app/code/community/Shipperhq/Shipper/Model/Carrier/Convert/ShipmentMapper.php +191 -0
  74. app/code/community/Shipperhq/Shipper/Model/Carrier/Convert/ShipperMapper.php +671 -0
  75. app/code/community/Shipperhq/Shipper/Model/Carrier/Shipper.php +1099 -0
  76. app/code/community/Shipperhq/Shipper/Model/Carrier/Shipperadmin.php +105 -0
  77. app/code/community/Shipperhq/Shipper/Model/Checkout/Helper.php +76 -0
  78. app/code/community/Shipperhq/Shipper/Model/Observer.php +439 -0
  79. app/code/community/Shipperhq/Shipper/Model/Observer/Order.php +446 -0
  80. app/code/community/Shipperhq/Shipper/Model/Observer/Shipment.php +107 -0
  81. app/code/community/Shipperhq/Shipper/Model/Order/Packages.php +87 -0
  82. app/code/community/Shipperhq/Shipper/Model/Quote/Packages.php +79 -0
  83. app/code/community/Shipperhq/Shipper/Model/Rate/Result.php +73 -0
  84. app/code/community/Shipperhq/Shipper/Model/Resource/Attributeupdate.php +37 -0
  85. app/code/community/Shipperhq/Shipper/Model/Resource/Attributeupdate/Collection.php +38 -0
  86. app/code/community/Shipperhq/Shipper/Model/Resource/Order/Packages.php +76 -0
  87. app/code/community/Shipperhq/Shipper/Model/Resource/Order/Packages/Collection.php +50 -0
  88. app/code/community/Shipperhq/Shipper/Model/Resource/Quote/Packages.php +76 -0
  89. app/code/community/Shipperhq/Shipper/Model/Resource/Quote/Packages/Collection.php +55 -0
  90. app/code/community/Shipperhq/Shipper/Model/Resource/Storage.php +161 -0
  91. app/code/community/Shipperhq/Shipper/Model/Sales/Quote/Address/Rate.php +73 -0
  92. app/code/community/Shipperhq/Shipper/Model/Session.php +41 -0
  93. app/code/community/Shipperhq/Shipper/Model/Source/Freight/Freightclass.php +73 -0
  94. app/code/community/Shipperhq/Shipper/Model/Source/Validation/Result.php +105 -0
  95. app/code/community/Shipperhq/Shipper/Model/Storage.php +242 -0
  96. app/code/community/Shipperhq/Shipper/Model/Storage/Manager.php +67 -0
  97. app/code/community/Shipperhq/Shipper/Model/Synchronize.php +432 -0
  98. app/code/community/Shipperhq/Shipper/changelog.txt +82 -0
  99. app/code/community/Shipperhq/Shipper/controllers/Adminhtml/ShqajaxController.php +63 -0
  100. app/code/community/Shipperhq/Shipper/controllers/Adminhtml/ShqsynchronizeController.php +96 -0
  101. app/code/community/Shipperhq/Shipper/etc/adminhtml.xml +70 -0
  102. app/code/community/Shipperhq/Shipper/etc/config.xml +523 -0
  103. app/code/community/Shipperhq/Shipper/etc/system.xml +286 -0
  104. app/code/community/Shipperhq/Shipper/sql/shipperhq_shipper_setup/mysql4-install-0.0.10.php +502 -0
  105. app/code/community/Shipperhq/Shipper/sql/shipperhq_shipper_setup/mysql4-install-0.0.11.php +526 -0
  106. app/code/community/Shipperhq/Shipper/sql/shipperhq_shipper_setup/mysql4-install-0.0.12.php +556 -0
  107. app/code/community/Shipperhq/Shipper/sql/shipperhq_shipper_setup/mysql4-install-0.0.13.php +568 -0
  108. app/code/community/Shipperhq/Shipper/sql/shipperhq_shipper_setup/mysql4-install-0.0.14.php +548 -0
  109. app/code/community/Shipperhq/Shipper/sql/shipperhq_shipper_setup/mysql4-install-0.0.15.php +567 -0
  110. app/code/community/Shipperhq/Shipper/sql/shipperhq_shipper_setup/mysql4-install-0.0.16.php +461 -0
  111. app/code/community/Shipperhq/Shipper/sql/shipperhq_shipper_setup/mysql4-install-0.0.17.php +444 -0
  112. app/code/community/Shipperhq/Shipper/sql/shipperhq_shipper_setup/mysql4-install-0.0.18.php +624 -0
  113. app/code/community/Shipperhq/Shipper/sql/shipperhq_shipper_setup/mysql4-install-0.0.19.php +629 -0
  114. app/code/community/Shipperhq/Shipper/sql/shipperhq_shipper_setup/mysql4-install-0.0.20.php +634 -0
  115. app/code/community/Shipperhq/Shipper/sql/shipperhq_shipper_setup/mysql4-install-0.0.21.php +645 -0
  116. app/code/community/Shipperhq/Shipper/sql/shipperhq_shipper_setup/mysql4-install-0.0.22.php +649 -0
  117. app/code/community/Shipperhq/Shipper/sql/shipperhq_shipper_setup/mysql4-install-0.0.23.php +671 -0
  118. app/code/community/Shipperhq/Shipper/sql/shipperhq_shipper_setup/mysql4-install-0.0.24.php +690 -0
  119. app/code/community/Shipperhq/Shipper/sql/shipperhq_shipper_setup/mysql4-install-0.0.25.php +816 -0
  120. app/code/community/Shipperhq/Shipper/sql/shipperhq_shipper_setup/mysql4-install-0.0.26.php +836 -0
  121. app/code/community/Shipperhq/Shipper/sql/shipperhq_shipper_setup/mysql4-install-0.0.27.php +790 -0
app/code/community/Shipperhq/Frontend/Block/Adminhtml/Sales/Order/Create/Shipping/Method/Form.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shipperhq_Frontend_Block_Adminhtml_Sales_Order_Create_Shipping_Method_Form
4
+ extends Mage_Adminhtml_Block_Sales_Order_Create_Shipping_Method_Form
5
+ {
6
+ /**
7
+ * Returns a helper block, that is used to retrieve all data
8
+ *
9
+ * @return Shipperhq_Frontend_Block_Checkout_Helper
10
+ */
11
+ public function getHelperBlock()
12
+ {
13
+ if ($this->_helperBlock === null) {
14
+ $this->_helperBlock = $this->getLayout()->createBlock(
15
+ 'shipperhq_frontend/checkout_helper',
16
+ sprintf('%s.helper', $this->getNameInLayout())
17
+ );
18
+
19
+ $this->_helperBlock->init(array(
20
+ 'calendar_block' => 'shipperhq_calendar/adminhtml_sales_order_create_shipping_method_calendar',
21
+ 'calendar_template' => 'shipperhq/calendar/sales/order/create/shipping_method/calendar.phtml',
22
+ 'pickup_block' => 'shipperhq_pickup/adminhtml_sales_order_create_shipping_method_storepickup',
23
+ 'pickup_template' => 'shipperhq/pickup/sales/order/create/shipping_method/storepickup.phtml',
24
+ 'accessorials_block' => 'shipperhq_freight/adminhtml_sales_order_create_shipping_method_accessorials',
25
+ 'accessorials_template' => 'shipperhq/freight/sales/order/create/shipping_method/accessorials.phtml',
26
+ 'quote' => $this->getQuote(),
27
+ 'address' => $this->getAddress()
28
+ ));
29
+ }
30
+
31
+
32
+ return $this->_helperBlock;
33
+ }
34
+
35
+ public function getCarrierGroupRates()
36
+ {
37
+ return $this->getHelperBlock()->getCarrierGroupRates();
38
+ }
39
+
40
+ public function getProcessedShippingRates()
41
+ {
42
+ return $this->getHelperBlock()->getProcessedShippingRates($this->getShippingRates());
43
+ }
44
+
45
+ public function adminShippingEnabled()
46
+ {
47
+ return Mage::getStoreConfigFlag('carriers/shipper/custom_admin');
48
+ }
49
+
50
+ /*
51
+ * Retrieves the items details ready for printing to checkout when < 2 carrier groups are in checkout
52
+ */
53
+ public function getSingleItemDetails($shippingRates)
54
+ {
55
+ return $this->getHelperBlock()->getSingleItemDetails($shippingRates);
56
+ }
57
+
58
+ /**
59
+ * Populates the location select dropdown
60
+ * @return string
61
+ */
62
+ public function getShippingMethodsSelect($name, $id, $value, $rates, $sole)
63
+ {
64
+ return $this->getHelperBlock()->getShippingMethodsSelect($name, $id, $value, $rates, $sole);
65
+ }
66
+
67
+ public function getAddressShippingMethod()
68
+ {
69
+ return $this->getHelperBlock()->getAddressShippingMethod();
70
+ }
71
+
72
+ public function isShippingMethodSelected($rates)
73
+ {
74
+ return $this->getHelperBlock()->isShippingMethodSelected($rates);
75
+ }
76
+
77
+ public function getShippingPrice($price, $flag, $includeContainer = true)
78
+ {
79
+ return $this->getHelperBlock()->getShippingPrice($price, $flag, $includeContainer);
80
+ }
81
+
82
+ public function showToolTips() {
83
+ return $this->getHelperBlock()->showToolTips();
84
+ }
85
+
86
+ public function getToolTipText()
87
+ {
88
+ return $this->getHelperBlock()->getToolTipText();
89
+ }
90
+
91
+ public function getMethodTitle($methodTitle, $methodDescription, $includeContainer)
92
+ {
93
+ return $this->getHelperBlock()->getMethodTitle($methodTitle, $methodDescription, $includeContainer);
94
+ }
95
+
96
+ protected function getFormattedItemList($items)
97
+ {
98
+ return $this->getHelperBlock()->getFormattedItemList($items);
99
+ }
100
+
101
+ public function getCarrierGroupAddressShippingMethod($carrierGroup)
102
+ {
103
+ return $this->getHelperBlock()->getCarrierGroupAddressShippingMethod($carrierGroup);
104
+ }
105
+
106
+ public function showItemDescription()
107
+ {
108
+ return $this->getHelperBlock()->showItemDescription();
109
+ }
110
+
111
+ public function getStorepickupHtml($carrierCode, $carrierType, $carriergroup = null )
112
+ {
113
+ return $this->getHelperBlock()->getStorepickupHtml($carrierCode, $carrierType, $carriergroup);
114
+ }
115
+
116
+ public function getCalendarHtml($carriergroup, $code, $soleMethod = false)
117
+ {
118
+ return $this->getHelperBlock()->getCalendarHtml($carriergroup, $code, $soleMethod);
119
+ }
120
+
121
+ public function isPickupCarrier($rate)
122
+ {
123
+ return $this->getHelperBlock()->isPickupCarrier($rate);
124
+ }
125
+
126
+ public function isFreightCarrier($rate)
127
+ {
128
+ return $this->getHelperBlock()->isFreightCarrier($rate);
129
+ }
130
+
131
+ public function getFreightAccessorialsHtml($carrierCode, $carrierType, $carrerigroup = '')
132
+ {
133
+ return $this->getHelperBlock()->getFreightAccessorialsHtml($carrerigroup, $carrierCode, $carrierType);
134
+ }
135
+ }
app/code/community/Shipperhq/Frontend/Block/Catalog/Helper.php ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shipperhq_Frontend_Block_Catalog_Helper
4
+ extends Mage_Core_Block_Template
5
+ {
6
+
7
+ private static $_debug;
8
+
9
+ protected $_storepickup;
10
+ protected $_calendar;
11
+ protected $_rates;
12
+ protected $_accessorial;
13
+
14
+
15
+ /**
16
+ * Calendar block name
17
+ *
18
+ * @var string
19
+ */
20
+ protected $_calendarBlockType;
21
+
22
+ /**
23
+ * Calendar block template
24
+ *
25
+ * @var string
26
+ */
27
+ protected $_calendarBlockTemplate;
28
+
29
+ /**
30
+ * Store pickup block name
31
+ *
32
+ * @var string
33
+ */
34
+ protected $_storePickupBlockType;
35
+
36
+ /**
37
+ * Store pickup block template
38
+ *
39
+ * @var string
40
+ */
41
+ protected $_storePickupBlockTemplate;
42
+
43
+ /**
44
+ * Freight accessorials block name
45
+ *
46
+ * @var string
47
+ */
48
+ protected $_freightAccessorialsBlockType;
49
+
50
+ /*
51
+ * Freight accessorials block template
52
+ *
53
+ * @var string
54
+ */
55
+ protected $_freightAccessorialsBlockTemplate;
56
+
57
+ /**
58
+ * Sets debug flag
59
+ */
60
+ protected function _construct() {
61
+ self::$_debug = Mage::helper('wsalogger')->isDebug('Shipperhq_Splitrates');
62
+
63
+ parent::_construct();
64
+
65
+ }
66
+
67
+ /**
68
+ * Sets up block properties
69
+ *
70
+ * @param array $options
71
+ * @return $this
72
+ */
73
+ public function init($options)
74
+ {
75
+ if (isset($options['calendar_block'])) {
76
+ $this->setCalendarBlockType($options['calendar_block']);
77
+ }
78
+ if (isset($options['calendar_template'])) {
79
+ $this->setCalendarBlockTemplate($options['calendar_template']);
80
+ }
81
+ // if (isset($options['pickup_block'])) {
82
+ // $this->setStorePickUpBlockType($options['pickup_block']);
83
+ // }
84
+ // if (isset($options['pickup_template'])) {
85
+ // $this->setStorePickUpBlockTemplate($options['pickup_template']);
86
+ // }
87
+
88
+ return $this;
89
+ }
90
+
91
+ public function isCalendarRate($carrierGroupId, $carrierCode, $carrierType)
92
+ {
93
+ return Mage::helper('shipperhq_calendar')->hasCalendarDetails($carrierGroupId,$carrierCode, $carrierType);
94
+ }
95
+
96
+ public function getCalendarHtml($carriergroup, $code)
97
+ {
98
+
99
+ $block = $this->_getCalendar()
100
+ ->setCarriergroupId($carriergroup)
101
+ ->setCarrierCode($code)
102
+ ->setName('calendar')
103
+ ->setTemplate($this->getCalendarBlockTemplate())
104
+ ->toHtml();
105
+ return $block;
106
+ }
107
+
108
+ public function getStorepickupHtml($carrierCode, $carrierType, $carriergroup = null )
109
+ {
110
+ return $this->_getStorePickup('storepickup_'.$carrierCode)
111
+ ->setCarriergroupId($carriergroup)
112
+ ->setCarrierCode($carrierCode)
113
+ ->setIsAccessPoints(Mage::helper('shipperhq_pickup')->isUpsAccessPointCarrier($carrierType))
114
+ ->setCarrierType($carrierType)
115
+ ->setName('storepickup_'.$carrierCode)
116
+ ->setTemplate($this->getStorePickUpBlockTemplate())
117
+ ->toHtml();
118
+ }
119
+
120
+ protected function _getCalendar($name = '')
121
+ {
122
+ if (!$this->_calendar) {
123
+ $this->_calendar = $this->getLayout()->createBlock($this->getCalendarBlockType(), $name);
124
+ // $this->_calendar->setQuote($this->getQuote());
125
+ // $this->_calendar->setAddress($this->getAddress());
126
+ }
127
+
128
+ return $this->_calendar;
129
+ }
130
+
131
+ protected function _getStorePickup($name)
132
+ {
133
+ $this->_storepickup = $this->getLayout()->createBlock($this->getStorePickUpBlockType(), $name);
134
+ $this->_storepickup->setQuote($this->getQuote());
135
+ $this->_storepickup->setAddress($this->getAddress());
136
+ return $this->_storepickup;
137
+ }
138
+
139
+ /**
140
+ * Returns calendar block type
141
+ *
142
+ * @return string
143
+ */
144
+ public function getCalendarBlockType()
145
+ {
146
+ return $this->_calendarBlockType;
147
+ }
148
+
149
+ /**
150
+ * Sets calendar block type
151
+ *
152
+ * @param string $blockType
153
+ * @return $this
154
+ */
155
+ public function setCalendarBlockType($blockType)
156
+ {
157
+ $this->_calendarBlockType = $blockType;
158
+ return $this;
159
+ }
160
+
161
+ /**
162
+ * Returns calendar block type
163
+ *
164
+ * @return string
165
+ */
166
+ public function getCalendarBlockTemplate()
167
+ {
168
+ return $this->_calendarBlockTemplate;
169
+ }
170
+
171
+ /**
172
+ * Sets calendar block type
173
+ *
174
+ * @param string $blockType
175
+ * @return $this
176
+ */
177
+ public function setCalendarBlockTemplate($blockType)
178
+ {
179
+ $this->_calendarBlockTemplate = $blockType;
180
+ return $this;
181
+ }
182
+
183
+ /**
184
+ * Returns a block type, that should be used for a calendar
185
+ *
186
+ * @return string
187
+ */
188
+ public function getStorePickUpBlockTemplate()
189
+ {
190
+ return $this->_storePickupBlockTemplate;
191
+ }
192
+
193
+ /**
194
+ * Sets store pickup block type
195
+ *
196
+ * @param string $template
197
+ * @return $this
198
+ */
199
+ public function setStorePickUpBlockTemplate($template)
200
+ {
201
+ $this->_storePickupBlockTemplate = $template;
202
+ return $this;
203
+ }
204
+
205
+ /**
206
+ * Returns a block type, that should be used for a calendar
207
+ *
208
+ * @return string
209
+ */
210
+ public function getStorePickUpBlockType()
211
+ {
212
+ return $this->_storePickupBlockType;
213
+ }
214
+
215
+ /**
216
+ * Sets store pickup block type
217
+ *
218
+ * @param $blockType
219
+ * @return $this
220
+ */
221
+ public function setStorePickUpBlockType($blockType)
222
+ {
223
+ $this->_storePickupBlockType = $blockType;
224
+ return $this;
225
+ }
226
+ }
app/code/community/Shipperhq/Frontend/Block/Catalog/Shipresults.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * Webshopapps Shipping Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * Shipper HQ Shipping
23
+ *
24
+ * @category ShipperHQ
25
+ * @package ShipperHQ_Shipping_Carrier
26
+ * @copyright Copyright (c) 2014 Zowta LLC (http://www.ShipperHQ.com)
27
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
28
+ * @author ShipperHQ Team sales@shipperhq.com
29
+ */
30
+
31
+ /**
32
+ * Provides proxy methods for helper block
33
+ *
34
+ * Supplies helper block with render information
35
+ */
36
+ class Shipperhq_Frontend_Block_Catalog_Shipresults extends Mage_Catalog_Block_Product_Abstract
37
+ {
38
+ /**
39
+ * Returns a helper block, that is used to retrieve all data
40
+ *
41
+ * @return Shipperhq_Frontend_Block_Checkout_Helper
42
+ */
43
+ public function getHelperBlock()
44
+ {
45
+ if ($this->_helperBlock === null) {
46
+ $this->_helperBlock = $this->getLayout()->createBlock(
47
+ 'shipperhq_frontend/catalog_helper',
48
+ sprintf('%s.helper', $this->getNameInLayout())
49
+ );
50
+
51
+ //TODO change these
52
+ $this->_helperBlock->init(array(
53
+ 'calendar_block' => 'shipperhq_calendar/catalog_calendar',
54
+ 'calendar_template' => 'shipperhq/calendar/catalog/calendar.phtml',
55
+ // 'pickup_block' => 'shipperhq_pickup/checkout_onepage_shipping_method_storepickup',
56
+ // 'pickup_template' => 'shipperhq/pickup/checkout/onepage/shipping_method/storepickup.phtml',
57
+ //
58
+ ));
59
+ }
60
+
61
+
62
+ return $this->_helperBlock;
63
+ }
64
+
65
+ public function isCalendarRate($carrierGroupId, $carrierCode, $carrierType)
66
+ {
67
+ return $this->getHelperBlock()->isCalendarRate($carrierGroupId, $carrierCode, $carrierType);
68
+ }
69
+
70
+ public function getCalendarHtml($carriergroup, $code, $soleMethod = false)
71
+ {
72
+ return $this->getHelperBlock()->getCalendarHtml($carriergroup, $code);
73
+ }
74
+
75
+ public function getStorepickupHtml($carrierCode, $carrierType, $carriergroup = null )
76
+ {
77
+ return $this->getHelperBlock()->getStorepickupHtml($carrierCode, $carrierType, $carriergroup);
78
+ }
79
+
80
+ public function isPickupCarrier($rate)
81
+ {
82
+ return $this->getHelperBlock()->isPickupCarrier($rate);
83
+ }
84
+
85
+ public function isFreightCarrier($rate)
86
+ {
87
+ return $this->getHelperBlock()->isFreightCarrier($rate);
88
+ }
89
+
90
+ public function getFreightAccessorialsHtml($carrierCode, $carrierType, $carrerigroup = '')
91
+ {
92
+ return $this->getHelperBlock()->getFreightAccessorialsHtml($carrerigroup, $carrierCode, $carrierType);
93
+ }
94
+ }
app/code/community/Shipperhq/Frontend/Block/Checkout/AbstractBlock.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class Shipperhq_Frontend_Block_Checkout_AbstractBlock
4
+ extends Mage_Core_Block_Template
5
+ {
6
+
7
+ /**
8
+ * Quote instance
9
+ *
10
+ * @var Mage_Sales_Model_Quote
11
+ */
12
+ protected $_quote;
13
+
14
+ /**
15
+ * Instance of address for shipping calculations
16
+ *
17
+ * @var Mage_Sales_Model_Quote_Address
18
+ */
19
+ protected $_address;
20
+
21
+ /**
22
+ * @return Mage_Sales_Model_Quote_Address
23
+ */
24
+ public function getAddress()
25
+ {
26
+ if (empty($this->_address)) {
27
+ $this->_address = $this->getQuote()->getShippingAddress();
28
+ }
29
+ return $this->_address;
30
+ }
31
+
32
+ public function setAddress($address)
33
+ {
34
+ $this->_address = $address;
35
+ return $this;
36
+ }
37
+
38
+ public function setQuote(Mage_Sales_Model_Quote $quote)
39
+ {
40
+ $this->_quote = $quote;
41
+ return $this;
42
+ }
43
+
44
+ /**
45
+ * @return Mage_Sales_Model_Quote
46
+ */
47
+ public function getQuote()
48
+ {
49
+ return $this->_quote;
50
+ }
51
+
52
+ }
app/code/community/Shipperhq/Frontend/Block/Checkout/Helper.php ADDED
@@ -0,0 +1,698 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Shipperhq_Frontend_Block_Checkout_Helper
4
+ extends Shipperhq_Frontend_Block_Checkout_AbstractBlock
5
+ {
6
+
7
+ private static $_debug;
8
+
9
+ protected $_storepickup;
10
+ protected $_calendar;
11
+ protected $_rates;
12
+ protected $_accessorial;
13
+
14
+
15
+ /**
16
+ * Calendar block name
17
+ *
18
+ * @var string
19
+ */
20
+ protected $_calendarBlockType;
21
+
22
+ /**
23
+ * Calendar block template
24
+ *
25
+ * @var string
26
+ */
27
+ protected $_calendarBlockTemplate;
28
+
29
+ /**
30
+ * Store pickup block name
31
+ *
32
+ * @var string
33
+ */
34
+ protected $_storePickupBlockType;
35
+
36
+ /**
37
+ * Store pickup block template
38
+ *
39
+ * @var string
40
+ */
41
+ protected $_storePickupBlockTemplate;
42
+
43
+ /**
44
+ * Freight accessorials block name
45
+ *
46
+ * @var string
47
+ */
48
+ protected $_freightAccessorialsBlockType;
49
+
50
+ /*
51
+ * Freight accessorials block template
52
+ *
53
+ * @var string
54
+ */
55
+ protected $_freightAccessorialsBlockTemplate;
56
+
57
+ /**
58
+ * Sets debug flag
59
+ */
60
+ protected function _construct() {
61
+ self::$_debug = Mage::helper('wsalogger')->isDebug('Shipperhq_Splitrates');
62
+
63
+ parent::_construct();
64
+
65
+ }
66
+
67
+ /**
68
+ * Sets up block properties
69
+ *
70
+ * @param array $options
71
+ * @return $this
72
+ */
73
+ public function init($options)
74
+ {
75
+ if (isset($options['calendar_block'])) {
76
+ $this->setCalendarBlockType($options['calendar_block']);
77
+ }
78
+ if (isset($options['calendar_template'])) {
79
+ $this->setCalendarBlockTemplate($options['calendar_template']);
80
+ }
81
+ if (isset($options['pickup_block'])) {
82
+ $this->setStorePickUpBlockType($options['pickup_block']);
83
+ }
84
+ if (isset($options['pickup_template'])) {
85
+ $this->setStorePickUpBlockTemplate($options['pickup_template']);
86
+ }
87
+ if (isset($options['accessorials_block'])) {
88
+ $this->setFreightAccessorialsBlockType($options['accessorials_block']);
89
+ }
90
+ if (isset($options['accessorials_template'])) {
91
+ $this->setFreightAccessorialsBlockTemplate($options['accessorials_template']);
92
+ }
93
+ if (isset($options['quote'])) {
94
+ $this->setQuote($options['quote']);
95
+ }
96
+ if (isset($options['address'])) {
97
+ $this->setAddress($options['address']);
98
+ }
99
+
100
+ return $this;
101
+ }
102
+
103
+ public function getCarrierGroupRates()
104
+ {
105
+ self::$_debug = true;
106
+ if (self::$_debug) {
107
+ Mage::helper('wsalogger/log')->postInfo('ShipperHQ','Getting Carrier Group Rates','');
108
+ }
109
+ $shippingRateGroups = $this->getShippingRates();
110
+ if (count($shippingRateGroups)==0) {
111
+ return;
112
+ }
113
+
114
+ $carrierGroupRates=array();
115
+
116
+ $address = $this->getAddress();
117
+ $address->unsetData('cached_items_all');
118
+ $address->unsetData('cached_items_nonnominal');
119
+
120
+ $itemsGrouped = Mage::helper('shipperhq_shipper')->getItemsGroupedByCarrierGroup($address->getAllItems());
121
+ $carrierGroupDescriber = Mage::getStoreConfig(Shipperhq_Shipper_Helper_Data::SHIPPERHQ_SHIPPER_CARRIERGROUP_DESC_PATH)?
122
+ Mage::getStoreConfig(Shipperhq_Shipper_Helper_Data::SHIPPERHQ_SHIPPER_CARRIERGROUP_DESC_PATH) : 'Vendor' ;
123
+ $displayMerged = $address->getCheckoutDisplayMerged() == 1? true : false;
124
+
125
+ $carrierGroupText = array();
126
+ $carrierGroupErrors = array();
127
+ foreach ($shippingRateGroups as $code=>$rates) {
128
+ $tempGroupRates=array();
129
+ foreach ($rates as $rate) {
130
+
131
+ $carriergroup=$rate->getCarriergroupId();
132
+ if(!$displayMerged && is_null($carriergroup)) {
133
+ continue;
134
+ }
135
+ $checkoutText = $rate->getCarriergroup();
136
+ if (array_key_exists($carriergroup,$tempGroupRates)) {
137
+ $tempGroupRates[$carriergroup][]=$rate;
138
+ } else {
139
+ $tempGroupRates[$carriergroup]= array($rate);
140
+ }
141
+ if($rate->getErrorMessage()) {
142
+ $carrierGroupErrors[$carriergroup][$code] = true;
143
+ }
144
+ if(isset($carriergroup) && $checkoutText != '') {
145
+ $carrierGroupText[$carriergroup] = $checkoutText;
146
+ }
147
+ }
148
+
149
+ foreach ($tempGroupRates as $carriergroup=>$rates) {
150
+ if (array_key_exists($carriergroup,$carrierGroupRates)) {
151
+ $carrierGroupRates[$carriergroup]['shipping'][$code] = $rates;
152
+ } else {
153
+ $carrierGroupRates[$carriergroup] = array (
154
+ 'item_list' => false,
155
+ 'shipping' => array(
156
+ $code => $rates
157
+ )
158
+ );
159
+ }
160
+ }
161
+ }
162
+
163
+ foreach ($carrierGroupRates as $carriergroup=>$value) {
164
+ if (array_key_exists($carriergroup,$itemsGrouped)) {
165
+ $carrierGroupRates[$carriergroup]['item_list']= $this->getFormattedItemList(
166
+ $itemsGrouped[$carriergroup]);
167
+ $carrierGroupRates[$carriergroup]['plain_item_list']= $itemsGrouped[$carriergroup];
168
+ }
169
+ if(array_key_exists($carriergroup, $carrierGroupErrors)) {
170
+ $carrierGroupRates[$carriergroup]['error']= $carrierGroupErrors[$carriergroup];
171
+ }
172
+ if(array_key_exists($carriergroup, $carrierGroupText)) {
173
+ $carrierGroupRates[$carriergroup]['checkout_text'] = $carrierGroupText[$carriergroup];
174
+ }
175
+ else {
176
+ $carrierGroupRates[$carriergroup]['checkout_text'] = '';
177
+ }
178
+ $carrierGroupRates[$carriergroup]['carriergroup_text'] = $carrierGroupDescriber;
179
+ }
180
+
181
+ if (self::$_debug) {
182
+ Mage::helper('wsalogger/log')->postInfo('ShipperHQ','Rates display information',$carrierGroupText);
183
+ }
184
+
185
+ return $carrierGroupRates;
186
+ }
187
+
188
+ public function getShippingRates()
189
+ {
190
+
191
+ // if (empty($this->_rates)) {
192
+ $this->getAddress()->collectShippingRates()->save();
193
+ $groups = $this->getAddress()->getGroupedAllShippingRates();
194
+ // return $this->_rates = $groups;
195
+ // }
196
+
197
+ return $groups;//$this->_rates;
198
+ }
199
+
200
+ public function getProcessedShippingRates($shippingRateGroups)
201
+ {
202
+ $processedRates = array();
203
+ $errorArray = array();
204
+ if(is_array($shippingRateGroups)) {
205
+ foreach($shippingRateGroups as $code => $rates)
206
+ {
207
+ foreach($rates as $rate)
208
+ {
209
+ if($rate->getErrorMessage())
210
+ {
211
+ $errorArray[$code] = true;
212
+ }
213
+ }
214
+ }
215
+ }
216
+ $processedRates['shipping'] = $shippingRateGroups;
217
+ if(count($errorArray) > 0 ) {
218
+ $processedRates['error'] = $errorArray;
219
+ }
220
+
221
+ return $processedRates;
222
+ }
223
+
224
+ /*
225
+ * Retrieves the items details ready for printing to checkout when < 2 carrier groups are in checkout
226
+ */
227
+ public function getSingleItemDetails($shippingRates)
228
+ {
229
+ $address = $this->getAddress();
230
+ $formattedItems = array();
231
+
232
+ $itemsGrouped = Mage::helper('shipperhq_shipper')->getItemsGroupedByCarrierGroup($address->getAllItems());
233
+
234
+ if (count($itemsGrouped)>1) {
235
+ if (self::$_debug) {
236
+ Mage::helper('wsalogger/log')->postDebug('ShipperHQ','Single Warehouse','Found more than 1 carrier group so returning');
237
+ }
238
+ return array();
239
+ }
240
+ $checkoutText = '';
241
+
242
+ foreach ($shippingRates as $code=>$rates) {
243
+ foreach ($rates as $rate) {
244
+ $carriergroupShippingDetails = Mage::helper('shipperhq_shipper')->decodeShippingDetails($rate->getCarriergroupShippingDetails());
245
+ foreach($carriergroupShippingDetails as $detail) {
246
+ if(array_key_exists('carriergroup', $detail)) {
247
+ $checkoutText = $detail['carriergroup'];
248
+ }
249
+ }
250
+ }
251
+ }
252
+
253
+ // now format these
254
+ foreach ($itemsGrouped as $carriergroupId=>$items) {
255
+ $formattedItems[] = array (
256
+ 'carriergroupId' => $carriergroupId,
257
+ 'checkout_text' => $checkoutText,
258
+ 'item_list' => $this->getFormattedItemList($items));
259
+ }
260
+ return $formattedItems;
261
+
262
+ }
263
+
264
+ /**
265
+ * Populates the location select dropdown
266
+ * @return string
267
+ */
268
+ public function getShippingMethodsSelect($name, $id, $value, $rates, $sole)
269
+ {
270
+ $options = array();
271
+ $error = false;
272
+ $matchedToSelected = false;
273
+ foreach($rates as $_rate) {
274
+
275
+ if($_rate->getErrorMessage()) {
276
+ $options = '<dt><ul class="messages"><li class="error-msg"><ul><li>'.$_rate->getErrorMessage() .'</li></ul></li></ul></dt>';
277
+
278
+ $error = true;
279
+ break;
280
+ }
281
+ $title = $_rate->getMethodTitle();
282
+ $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax(), false);
283
+ $_incl = $this->getShippingPrice($_rate->getPrice(), true, false);
284
+ $label = $title .' ' .$_excl;
285
+ if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl)
286
+ {
287
+ $label .= ' (' .$this->__('Incl. Tax') .' ' .$_incl .')';
288
+ }
289
+ $options[] = array(
290
+ 'value' => $_rate->getCode(),
291
+ 'label' => $label,
292
+ );
293
+ if($_rate->getCode() == $value) {
294
+ $matchedToSelected = true;
295
+ }
296
+ }
297
+
298
+ if($error) {
299
+ return $options;
300
+ }
301
+
302
+ $select = $this->getLayout()->createBlock('core/html_select')
303
+ ->setName($name)
304
+ ->setId($id)
305
+ ->setClass('shipping-method-select')
306
+ ->setValue($value)
307
+ ->setOptions($options);
308
+ if(!$sole) {
309
+ $select->setExtraParams('hidden="true"');
310
+ }
311
+ if($matchedToSelected) {
312
+ $select->setValue($value);
313
+ }
314
+ return $select->getHtml();
315
+ }
316
+
317
+ public function isShippingMethodSelected($rates)
318
+ {
319
+ $selectedShippingMethod = $this->getAddressShippingMethod();
320
+ foreach($rates as $rate)
321
+ {
322
+ if($rate->getCode() == $selectedShippingMethod) {
323
+ return true;
324
+ }
325
+ }
326
+ return false;
327
+ }
328
+
329
+ public function getShippingPrice($price, $flag, $includeContainer = true)
330
+ {
331
+ return $this->getQuote()->getStore()->convertPrice(Mage::helper('tax')->getShippingPrice($price, $flag, $this->getAddress()), true, $includeContainer);
332
+ }
333
+
334
+ public function getMethodTitle($methodTitle, $methodDescription, $includeContainer)
335
+ {
336
+ $title = $methodTitle;
337
+ if($includeContainer) {
338
+ $truncatedTitle = str_replace($methodDescription, '', $methodTitle);
339
+ $title = '<span class="method-title">'.$truncatedTitle.'</span> <span class="method-extra">'.$methodDescription.'</span>';
340
+ }
341
+ return $title;
342
+ }
343
+
344
+ public function showToolTips() {
345
+ $globals = Mage::helper('shipperhq_shipper')->getGlobalSettings();
346
+ if (!is_array($globals) || !array_key_exists('shippingTooltipText', $globals)
347
+ || $globals['shippingTooltipText'] == '') {
348
+ return false;
349
+ }
350
+ return true;
351
+ }
352
+
353
+ public function getToolTipText()
354
+ {
355
+ $globals = Mage::helper('shipperhq_shipper')->getGlobalSettings();
356
+ if (is_null($globals) || !array_key_exists('shippingTooltipText', $globals)
357
+ || $globals['shippingTooltipText'] == '') {
358
+ return false;
359
+ }
360
+ return addslashes($globals['shippingTooltipText']);
361
+ }
362
+
363
+ protected function getFormattedItemList($items)
364
+ {
365
+ $globals = Mage::helper('shipperhq_shipper')->getGlobalSettings();
366
+ if (is_null($globals)) {
367
+ return array();
368
+ }
369
+ $useParent = true;
370
+ $showAllItems = true;
371
+ $formattedItemList=array();
372
+
373
+ $weightUnit = 'none';
374
+ $showWeight = array_key_exists('dropshipShowWeight', $globals) ? $globals['dropshipShowWeight']: false;
375
+ if($showWeight) {
376
+ $weightUnit = array_key_exists('weightUnit', $globals) ? $globals['weightUnit']: 'none';
377
+ }
378
+
379
+ foreach ($items as $item) {
380
+ if ($item->getParentItem() && ( ($item->getParentItem()->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE && $useParent && !$showAllItems)
381
+ || $item->getParentItem()->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE )) {
382
+ continue;
383
+ }
384
+
385
+ if (!$useParent && $item->getHasChildren() && $item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE ) {
386
+ continue;
387
+ }
388
+
389
+ if ($item->getHasChildren() && $item->isShipSeparately() && !$useParent) {
390
+ foreach ($item->getChildren() as $child) {
391
+ $formattedItemList[]= self::getStyledHtmlItem(
392
+ 'bundle_child',$child->getQty(),$child->getProduct()->getName(),$child->getWeight(),$weightUnit);
393
+ }
394
+ } else {
395
+ $formattedItemList[] = self::getFormattedItem($item ,$weightUnit, $showWeight);
396
+ }
397
+ }
398
+ if (self::$_debug) {
399
+ Mage::helper('wsalogger/log')->postDebug('ShipperHQ','Formatted Item List',$formattedItemList);
400
+ }
401
+
402
+ return $formattedItemList;
403
+ }
404
+
405
+
406
+ protected static function getFormattedItem($item, $weightUnit, $showWeight) {
407
+
408
+ $class = 'non_bundle';
409
+
410
+ if ($item->getHasChildren()) {
411
+ $class = 'bundle_parent';
412
+ } elseif ($item->getParentItemId()) {
413
+ $class = 'bundle_child';
414
+ }
415
+
416
+ $styleHtmlItem = self::getStyledHtmlItem(
417
+ $class,$item->getQty(),$item->getName(),$item->getWeight(), $weightUnit);
418
+
419
+ return $styleHtmlItem;
420
+ }
421
+
422
+ protected static function getStyledHtmlItem($itemType, $qty, $name,$weight,$weightUnit)
423
+ {
424
+ $weightHtmlDesc = $weightUnit == 'none' ? '' : '
425
+ <span class="'.$itemType.'_weight">'.round($weight).$weightUnit.'</span>';
426
+
427
+ $qtyHtmlDesc = '<span class="'.$itemType.'_qty">'.$qty.' x '.'</span>';
428
+
429
+ $nameHtmlDesc = '<span class="'.$itemType.'_name">'.$name.'</span>';
430
+
431
+ return $qtyHtmlDesc.$nameHtmlDesc.$weightHtmlDesc;
432
+
433
+ }
434
+
435
+ public function getCarrierGroupAddressShippingMethod($carrierGroup)
436
+ {
437
+ $shippingDetails = $this->getQuote()->getShippingAddress()->getCarriergroupShippingDetails();
438
+ if (empty($shippingDetails) || $shippingDetails=='') {
439
+ return;
440
+ }
441
+ $_cargrps = Mage::helper('shipperhq_shipper')->decodeShippingDetails($shippingDetails);
442
+ foreach ($_cargrps as $_cargrp) {
443
+ if (is_array($_cargrp) && $_cargrp['carrierGroupId']==$carrierGroup) {
444
+ return $_cargrp['code'];
445
+ }
446
+ }
447
+
448
+ }
449
+
450
+ public function showItemDescription()
451
+ {
452
+ $globals = Mage::helper('shipperhq_shipper')->getGlobalSettings();
453
+ $showDesc = $globals['dropshipShowItemDesc'];
454
+ return $showDesc;
455
+ }
456
+
457
+ public function getStorepickupHtml($carrierCode, $carrierType, $carriergroup = null )
458
+ {
459
+ return $this->_getStorePickup('storepickup_'.$carrierCode)
460
+ ->setCarriergroupId($carriergroup)
461
+ ->setCarrierCode($carrierCode)
462
+ ->setIsAccessPoints(Mage::helper('shipperhq_pickup')->isUpsAccessPointCarrier($carrierType))
463
+ ->setCarrierType($carrierType)
464
+ ->setName('storepickup_'.$carrierCode)
465
+ ->setTemplate($this->getStorePickUpBlockTemplate())
466
+ ->toHtml();
467
+ }
468
+
469
+ public function getCalendarHtml($carriergroup, $code, $soleMethod = false)
470
+ {
471
+
472
+ return $this->_getCalendar()
473
+ ->setCarriergroupId($carriergroup)
474
+ ->setCarrierCode($code)
475
+ ->setSoleMethod($soleMethod)
476
+ ->setName('calendar')
477
+ ->setTemplate($this->getCalendarBlockTemplate())
478
+ ->toHtml();
479
+ }
480
+
481
+ public function isPickupCarrier($rate)
482
+ {
483
+ if(!Mage::helper('shipperhq_shipper')->isModuleEnabled('Shipperhq_Pickup')) {
484
+ return false;
485
+ }
486
+ if($rate && Mage::helper('shipperhq_pickup')->isPickupEnabledCarrier($rate->getCarrierType())) {
487
+ if (self::$_debug) {
488
+ Mage::helper('wsalogger/log')->postDebug('ShipperHQ Pickup','Following carrier has pickup enabled: ',
489
+ 'Carrier: ' .$rate->getCode() .', Type : ' .$rate->getCarrierType() );
490
+ }
491
+ return true;
492
+ }
493
+ if (self::$_debug) {
494
+ Mage::helper('wsalogger/log')->postDebug('ShipperHQ Pickup','This carrier is not pickup enabled ',
495
+ 'Carrier: ' .$rate->getCode() .', Type : ' .$rate->getCarrierType());
496
+ }
497
+ return false;
498
+ }
499
+
500
+ public function isFreightCarrier($rate)
501
+ {
502
+ if(!Mage::helper('shipperhq_shipper')->isModuleEnabled('Shipperhq_Freight')) {
503
+ return false;
504
+ }
505
+ if($rate && $rate->getFreightRate() == 1) {
506
+ if (self::$_debug) {
507
+ Mage::helper('wsalogger/log')->postDebug('ShipperHQ Freight','Carrier is freight enabled',
508
+ 'Carrier : ' . $rate->getCode() .', Is freight rate : ' .$rate->getFreightRate()
509
+ );
510
+ }
511
+ return true;
512
+ }
513
+ if (self::$_debug) {
514
+ Mage::helper('wsalogger/log')->postDebug('ShipperHQ Freight','Carrier is NOT freight enabled',
515
+ 'Carrier : ' . $rate->getCode() .', Is freight rate : ' .$rate->getFreightRate()
516
+ );
517
+ }
518
+ return false;
519
+ }
520
+
521
+ public function getFreightAccessorialsHtml($carrierGroup, $carrierCode, $carrierType)
522
+ {
523
+ //go and get the freight accessorials and set them here for this one carrier
524
+
525
+ return $this->_getAccessorial('freight_'.$carrierCode)
526
+ ->setCarriergroupId($carrierGroup)
527
+ ->setCarrierCode($carrierCode)
528
+ ->setName('accessorial_'.$carrierCode)
529
+ ->setTemplate($this->getFreightAccessorialsBlockTemplate())
530
+ ->toHtml();
531
+ }
532
+
533
+ protected function _getStorePickup($name)
534
+ {
535
+ $this->_storepickup = $this->getLayout()->createBlock($this->getStorePickUpBlockType(), $name);
536
+ $this->_storepickup->setQuote($this->getQuote());
537
+ $this->_storepickup->setAddress($this->getAddress());
538
+ return $this->_storepickup;
539
+ }
540
+
541
+ protected function _getCalendar($name = '')
542
+ {
543
+ if (!$this->_calendar) {
544
+ $this->_calendar = $this->getLayout()->createBlock($this->getCalendarBlockType(), $name);
545
+ $this->_calendar->setQuote($this->getQuote());
546
+ $this->_calendar->setAddress($this->getAddress());
547
+ }
548
+
549
+ return $this->_calendar;
550
+ }
551
+
552
+ protected function _getAccessorial($name = '')
553
+ {
554
+ if (!$this->_accessorial) {
555
+ $this->_accessorial = $this->getLayout()->createBlock($this->getFreightAccessorialsBlockType(), $name);
556
+ $this->_accessorial->setQuote($this->getQuote());
557
+ $this->_accessorial->setAddress($this->getAddress());
558
+ }
559
+
560
+ return $this->_accessorial;
561
+ }
562
+
563
+ /**
564
+ * Returns a block type, that should be used for a calendar
565
+ *
566
+ * @return string
567
+ */
568
+ public function getStorePickUpBlockType()
569
+ {
570
+ return $this->_storePickupBlockType;
571
+ }
572
+
573
+ /**
574
+ * Sets store pickup block type
575
+ *
576
+ * @param $blockType
577
+ * @return $this
578
+ */
579
+ public function setStorePickUpBlockType($blockType)
580
+ {
581
+ $this->_storePickupBlockType = $blockType;
582
+ return $this;
583
+ }
584
+
585
+ /**
586
+ * Returns calendar block type
587
+ *
588
+ * @return string
589
+ */
590
+ public function getCalendarBlockType()
591
+ {
592
+ return $this->_calendarBlockType;
593
+ }
594
+
595
+ /**
596
+ * Sets calendar block type
597
+ *
598
+ * @param string $blockType
599
+ * @return $this
600
+ */
601
+ public function setCalendarBlockType($blockType)
602
+ {
603
+ $this->_calendarBlockType = $blockType;
604
+ return $this;
605
+ }
606
+
607
+ /**
608
+ * Returns a block type, that should be used for a calendar
609
+ *
610
+ * @return string
611
+ */
612
+ public function getStorePickUpBlockTemplate()
613
+ {
614
+ return $this->_storePickupBlockTemplate;
615
+ }
616
+
617
+ /**
618
+ * Sets store pickup block type
619
+ *
620
+ * @param string $template
621
+ * @return $this
622
+ */
623
+ public function setStorePickUpBlockTemplate($template)
624
+ {
625
+ $this->_storePickupBlockTemplate = $template;
626
+ return $this;
627
+ }
628
+
629
+ /**
630
+ * Returns calendar block type
631
+ *
632
+ * @return string
633
+ */
634
+ public function getCalendarBlockTemplate()
635
+ {
636
+ return $this->_calendarBlockTemplate;
637
+ }
638
+
639
+ /**
640
+ * Sets calendar block type
641
+ *
642
+ * @param string $blockType
643
+ * @return $this
644
+ */
645
+ public function setCalendarBlockTemplate($blockType)
646
+ {
647
+ $this->_calendarBlockTemplate = $blockType;
648
+ return $this;
649
+ }
650
+
651
+ /**
652
+ * @param mixed $freightAccessorialsBlockTemplate
653
+ */
654
+ public function setFreightAccessorialsBlockTemplate($freightAccessorialsBlockTemplate)
655
+ {
656
+ $this->_freightAccessorialsBlockTemplate = $freightAccessorialsBlockTemplate;
657
+ }
658
+
659
+ /**
660
+ * @return mixed
661
+ */
662
+ public function getFreightAccessorialsBlockTemplate()
663
+ {
664
+ return $this->_freightAccessorialsBlockTemplate;
665
+ }
666
+
667
+ /**
668
+ * @param string $freightAccessorialsBlockType
669
+ */
670
+ public function setFreightAccessorialsBlockType($freightAccessorialsBlockType)
671
+ {
672
+ $this->_freightAccessorialsBlockType = $freightAccessorialsBlockType;
673
+ }
674
+
675
+ /**
676
+ * @return string
677
+ */
678
+ public function getFreightAccessorialsBlockType()
679
+ {
680
+ return $this->_freightAccessorialsBlockType;
681
+ }
682
+
683
+
684
+
685
+ public function getCarrierName($carrierCode)
686
+ {
687
+ if ($name = Mage::getStoreConfig('carriers/'.$carrierCode.'/title', $this->getQuote()->getStoreId())) {
688
+ return $name;
689
+ }
690
+
691
+ return $carrierCode;
692
+ }
693
+
694
+ public function getAddressShippingMethod()
695
+ {
696
+ return $this->getAddress()->getShippingMethod();
697
+ }
698
+ }
app/code/community/Shipperhq/Frontend/Block/Checkout/Multishipping/Shipping.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * Webshopapps Shipping Module
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *