Version Notes
Notes
Download this release
Release Info
Developer | Bobby Burden |
Extension | iparcel_logistics |
Version | 1.0.4 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.0.4
- app/code/community/Iparcel/Logistics/Block/Sales/Order/Totals/Abstract.php +30 -0
- app/code/community/Iparcel/Logistics/Block/Sales/Order/Totals/Duty.php +32 -0
- app/code/community/Iparcel/Logistics/Block/Sales/Order/Totals/Tax.php +32 -0
- app/code/community/Iparcel/Logistics/Helper/Data.php +65 -0
- app/code/community/Iparcel/Logistics/Model/Api/Quote.php +51 -0
- app/code/community/Iparcel/Logistics/Model/Carrier/Iparcel.php +5 -10
- app/code/community/Iparcel/Logistics/Model/Order/Creditmemo/Total/Duty.php +23 -0
- app/code/community/Iparcel/Logistics/Model/Order/Creditmemo/Total/Tax.php +24 -0
- app/code/community/Iparcel/Logistics/Model/Order/Invoice/Total/Duty.php +23 -0
- app/code/community/Iparcel/Logistics/Model/Order/Invoice/Total/Tax.php +23 -0
- app/code/community/Iparcel/Logistics/Model/Quote/Address/Total/Abstract.php +28 -0
- app/code/community/Iparcel/Logistics/Model/Quote/Address/Total/Collector.php +29 -0
- app/code/community/Iparcel/Logistics/Model/Quote/Address/Total/Duty.php +75 -0
- app/code/community/Iparcel/Logistics/Model/Quote/Address/Total/Tax.php +113 -0
- app/code/community/Iparcel/Logistics/Model/Resource/Api/Quote.php +18 -0
- app/code/community/Iparcel/Logistics/Model/Tax/Quote/Shipping.php +51 -0
- app/code/community/Iparcel/Logistics/Model/Tax/Quote/Subtotal.php +51 -0
- app/code/community/Iparcel/Logistics/Model/Tax/Quote/Tax.php +51 -0
- app/code/community/Iparcel/Logistics/etc/config.xml +81 -1
- app/code/community/Iparcel/Logistics/etc/system.xml +57 -0
- app/code/community/Iparcel/Logistics/sql/iplogistics_setup/mysql4-upgrade-1.0.0-1.0.1.php +23 -0
- app/code/community/Iparcel/Logistics/sql/iplogistics_setup/mysql4-upgrade-1.0.1-1.0.2.php +18 -0
- app/code/community/Iparcel/Logistics/sql/iplogistics_setup/mysql4-upgrade-1.0.2-1.0.3.php +51 -0
- app/code/community/Iparcel/Logistics/sql/iplogistics_setup/mysql4-upgrade-1.0.3-1.0.4.php +12 -0
- app/design/adminhtml/default/default/layout/iplogistics.xml +50 -0
- app/design/adminhtml/default/default/template/iplogistics/order/totals/duty.phtml +9 -0
- app/design/adminhtml/default/default/template/iplogistics/order/totals/tax.phtml +9 -0
- app/design/frontend/base/default/layout/iplogistics.xml +65 -0
- app/etc/modules/Iparcel_Logistics.xml +1 -0
- package.xml +5 -4
app/code/community/Iparcel/Logistics/Block/Sales/Order/Totals/Abstract.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel model for shipping duty display to frontend order views
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Logistics
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Logistics_Block_Sales_Order_Totals_Abstract extends Mage_Core_Block_Template
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Returns Magento Order
|
13 |
+
*
|
14 |
+
* @return Mage_Sales_Model_Order
|
15 |
+
*/
|
16 |
+
public function getOrder()
|
17 |
+
{
|
18 |
+
return $this->getParentBlock()->getOrder();
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Get totals source object
|
23 |
+
*
|
24 |
+
* @return Mage_Sales_Model_Order
|
25 |
+
*/
|
26 |
+
public function getSource()
|
27 |
+
{
|
28 |
+
return $this->getParentBlock()->getSource();
|
29 |
+
}
|
30 |
+
}
|
app/code/community/Iparcel/Logistics/Block/Sales/Order/Totals/Duty.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel model for shipping duty display to frontend order views
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Logistics
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Logistics_Block_Sales_Order_Totals_Duty extends Iparcel_Logistics_Block_Sales_Order_Totals_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Find and display duty for current order/credit memo
|
13 |
+
*
|
14 |
+
* @return Iparcel_Logistics_Block_Sales_Order_Totals_Duty
|
15 |
+
*/
|
16 |
+
public function initTotals()
|
17 |
+
{
|
18 |
+
if ((float) $this->getOrder()->getBaseIparcelDutyAmount()) {
|
19 |
+
$source = $this->getSource();
|
20 |
+
$value = $source->getIparcelDutyAmount();
|
21 |
+
|
22 |
+
$this->getParentBlock()->addTotal(new Varien_Object(array(
|
23 |
+
'code' => 'iparcel_duty',
|
24 |
+
'strong' => false,
|
25 |
+
'label' => Mage::helper('iplogistics')->getDutyLabel(),
|
26 |
+
'value' => $value
|
27 |
+
)));
|
28 |
+
}
|
29 |
+
|
30 |
+
return $this;
|
31 |
+
}
|
32 |
+
}
|
app/code/community/Iparcel/Logistics/Block/Sales/Order/Totals/Tax.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel model for shipping tax display to frontend order views
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Logistics
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Logistics_Block_Sales_Order_Totals_Tax extends Iparcel_Logistics_Block_Sales_Order_Totals_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Find and display tax for current order/credit memo
|
13 |
+
*
|
14 |
+
* @return Iparcel_Logistics_Block_Sales_Order_Totals_Duty
|
15 |
+
*/
|
16 |
+
public function initTotals()
|
17 |
+
{
|
18 |
+
if ((float) $this->getOrder()->getBaseIparcelTaxAmount()) {
|
19 |
+
$source = $this->getSource();
|
20 |
+
$value = $source->getIparcelTaxAmount();
|
21 |
+
|
22 |
+
$this->getParentBlock()->addTotal(new Varien_Object(array(
|
23 |
+
'code' => 'iparcel_tax',
|
24 |
+
'strong' => false,
|
25 |
+
'label' => Mage::helper('iplogistics')->getTaxLabel(),
|
26 |
+
'value' => $value
|
27 |
+
)));
|
28 |
+
}
|
29 |
+
|
30 |
+
return $this;
|
31 |
+
}
|
32 |
+
}
|
app/code/community/Iparcel/Logistics/Helper/Data.php
CHANGED
@@ -145,4 +145,69 @@ class Iparcel_Logistics_Helper_Data extends Iparcel_All_Helper_Data
|
|
145 |
|
146 |
return $qty;
|
147 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
}
|
145 |
|
146 |
return $qty;
|
147 |
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Helper method to find the value of the tax intercepting mode
|
151 |
+
*
|
152 |
+
* @return boolean
|
153 |
+
*/
|
154 |
+
public function getDisplayTaxAndDutyCumulatively()
|
155 |
+
{
|
156 |
+
return Mage::getStoreConfig('iparcel/tax/mode') == Iparcel_Logistics_Model_System_Config_Source_Tax_Mode::CUMULATIVELY;
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Helper method to find the value of the tax intercepting mode
|
161 |
+
*
|
162 |
+
* @return boolean
|
163 |
+
*/
|
164 |
+
public function getDisplayTaxAndDutySeparately()
|
165 |
+
{
|
166 |
+
return Mage::getStoreConfig('iparcel/tax/mode') == Iparcel_Logistics_Model_System_Config_Source_Tax_Mode::SEPARATELY;
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Return the Admin user created "Tax" Label
|
171 |
+
*
|
172 |
+
* @return string
|
173 |
+
*/
|
174 |
+
public function getTaxLabel()
|
175 |
+
{
|
176 |
+
$taxLabel = Mage::getStoreConfig('iparcel/tax/tax_label');
|
177 |
+
if ($taxLabel == '') {
|
178 |
+
return 'Tax';
|
179 |
+
} else {
|
180 |
+
return $taxLabel;
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Return the Admin user created "Duty" Label
|
186 |
+
*
|
187 |
+
* @return string
|
188 |
+
*/
|
189 |
+
public function getDutyLabel()
|
190 |
+
{
|
191 |
+
$dutyLabel = Mage::getStoreConfig('iparcel/tax/duty_label');
|
192 |
+
if ($dutyLabel == '') {
|
193 |
+
return 'Duty';
|
194 |
+
} else {
|
195 |
+
return $dutyLabel;
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Return the Admin user created "Tax And Duty" Label
|
201 |
+
*
|
202 |
+
* @return string
|
203 |
+
*/
|
204 |
+
public function getTaxAndDutyLabel()
|
205 |
+
{
|
206 |
+
$taxAndDutyLabel = Mage::getStoreConfig('iparcel/tax/tax_duty_label');
|
207 |
+
if ($taxAndDutyLabel == '') {
|
208 |
+
return 'Tax & Duty';
|
209 |
+
} else {
|
210 |
+
return $taxAndDutyLabel;
|
211 |
+
}
|
212 |
+
}
|
213 |
}
|
app/code/community/Iparcel/Logistics/Model/Api/Quote.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Model for retrieving stored shipping quotes from the database
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Logistics
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Logistics_Model_Api_Quote extends Mage_Core_Model_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initialize resource model
|
13 |
+
*/
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
$this->_init('iplogistics/api_quote');
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Loads quote from database by Magento Quote ID
|
21 |
+
*
|
22 |
+
* @param int $quote_id
|
23 |
+
* @return Iparcel_Logistics_Model_Api_Quote
|
24 |
+
*/
|
25 |
+
public function loadByQuoteId($quote_id)
|
26 |
+
{
|
27 |
+
$this->load($quote_id, 'quote_id');
|
28 |
+
return $this;
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Setter for serviceLevels
|
33 |
+
*
|
34 |
+
* @param array serviceLevels
|
35 |
+
* @return Iparcel_Logistics_Model_Api_Quote
|
36 |
+
*/
|
37 |
+
public function setServiceLevels($serviceLevels)
|
38 |
+
{
|
39 |
+
$this->setData('service_levels', serialize($serviceLevels));
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Getter for serviceLevels
|
44 |
+
*
|
45 |
+
* @return array
|
46 |
+
*/
|
47 |
+
public function getServiceLevels()
|
48 |
+
{
|
49 |
+
return unserialize($this->getData('service_levels'));
|
50 |
+
}
|
51 |
+
}
|
app/code/community/Iparcel/Logistics/Model/Carrier/Iparcel.php
CHANGED
@@ -114,12 +114,13 @@ class Iparcel_Logistics_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrie
|
|
114 |
|
115 |
if ($internationalOrder && Mage::getStoreConfig('carriers/i-parcel/active')) {
|
116 |
/** @var array $iparcel Tax & Duty totals */
|
117 |
-
$
|
118 |
/** @var Mage_Shipping_Model_Rate_Result $result*/
|
119 |
$result = Mage::getModel('shipping/rate_result');
|
120 |
|
121 |
/** @var stdClass $quote */
|
122 |
$quote = Mage::helper('iplogistics/api')->quote($request);
|
|
|
123 |
|
124 |
$serviceLevel = new stdClass;
|
125 |
if (isset($quote->ServiceLevels)) {
|
@@ -167,24 +168,18 @@ class Iparcel_Logistics_Model_Carrier_Iparcel extends Mage_Shipping_Model_Carrie
|
|
167 |
$method->setMethod($servicename);
|
168 |
$method->setMethodTitle($title);
|
169 |
$method->setPrice($total);
|
170 |
-
$method->setCost($total);
|
171 |
-
$method->setPriceOriginal($total);
|
172 |
-
$method->setPriceDuty($duty);
|
173 |
-
$method->setPriceTax($tax);
|
174 |
-
$method->setPriceInsurance($total);
|
175 |
-
$method->setPackageWeight($request->getPackageWeight());
|
176 |
|
177 |
// append method to result
|
178 |
$result->append($method);
|
179 |
|
180 |
-
$
|
181 |
'duty' => $duty,
|
182 |
'tax' => $tax
|
183 |
);
|
184 |
}
|
185 |
|
186 |
-
Mage::unregister('
|
187 |
-
Mage::register('
|
188 |
return $result;
|
189 |
}
|
190 |
} catch (Exception $e) {
|
114 |
|
115 |
if ($internationalOrder && Mage::getStoreConfig('carriers/i-parcel/active')) {
|
116 |
/** @var array $iparcel Tax & Duty totals */
|
117 |
+
$iparcelTaxAndDuty = array();
|
118 |
/** @var Mage_Shipping_Model_Rate_Result $result*/
|
119 |
$result = Mage::getModel('shipping/rate_result');
|
120 |
|
121 |
/** @var stdClass $quote */
|
122 |
$quote = Mage::helper('iplogistics/api')->quote($request);
|
123 |
+
$iparcelTaxAndDuty['parcel_id'] = $quote->ParcelID;
|
124 |
|
125 |
$serviceLevel = new stdClass;
|
126 |
if (isset($quote->ServiceLevels)) {
|
168 |
$method->setMethod($servicename);
|
169 |
$method->setMethodTitle($title);
|
170 |
$method->setPrice($total);
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
|
172 |
// append method to result
|
173 |
$result->append($method);
|
174 |
|
175 |
+
$iparcelTaxAndDuty['service_levels']['i-parcel_' . $servicename] = array(
|
176 |
'duty' => $duty,
|
177 |
'tax' => $tax
|
178 |
);
|
179 |
}
|
180 |
|
181 |
+
Mage::unregister('iparcel_duty_and_taxes');
|
182 |
+
Mage::register('iparcel_duty_and_taxes', $iparcelTaxAndDuty);
|
183 |
return $result;
|
184 |
}
|
185 |
} catch (Exception $e) {
|
app/code/community/Iparcel/Logistics/Model/Order/Creditmemo/Total/Duty.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel model for displaying duty total on credit memos
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Logistics
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Logistics_Model_Order_Creditmemo_Total_Duty extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
|
10 |
+
{
|
11 |
+
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
|
12 |
+
{
|
13 |
+
$order = $creditmemo->getOrder();
|
14 |
+
$dutyAmount = $order->getIparcelDutyAmount();
|
15 |
+
$baseDutyAmount = $order->getBaseIparcelDutyAmount();
|
16 |
+
|
17 |
+
$creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $dutyAmount);
|
18 |
+
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $baseDutyAmount);
|
19 |
+
|
20 |
+
$creditmemo->setIparcelDutyAmount($dutyAmount);
|
21 |
+
$creditmemo->setBaseIparcelDutyAmount($baseDutyAmount);
|
22 |
+
}
|
23 |
+
}
|
app/code/community/Iparcel/Logistics/Model/Order/Creditmemo/Total/Tax.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel model for displaying tax total on credit memos
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Logistics
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Logistics_Model_Order_Creditmemo_Total_Tax extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
|
10 |
+
{
|
11 |
+
|
12 |
+
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
|
13 |
+
{
|
14 |
+
$order = $creditmemo->getOrder();
|
15 |
+
$taxAmount = $order->getIparcelTaxAmount();
|
16 |
+
$baseTaxAmount = $order->getBaseIparcelTaxAmount();
|
17 |
+
|
18 |
+
$creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $taxAmount);
|
19 |
+
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $baseTaxAmount);
|
20 |
+
|
21 |
+
$creditmemo->setIparcelTaxAmount($taxAmount);
|
22 |
+
$creditmemo->setBaseIparcelTaxAmount($baseTaxAmount);
|
23 |
+
}
|
24 |
+
}
|
app/code/community/Iparcel/Logistics/Model/Order/Invoice/Total/Duty.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel model for displaying duty total on invoices
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Logistics
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Logistics_Model_Order_Invoice_Total_Duty extends Mage_Sales_Model_Order_Invoice_Total_Abstract
|
10 |
+
{
|
11 |
+
public function collect(Mage_Sales_Model_Order_Invoice $invoice)
|
12 |
+
{
|
13 |
+
$order = $invoice->getOrder();
|
14 |
+
$dutyAmount = $order->getIparcelDutyAmount();
|
15 |
+
$baseDutyAmount = $order->getBaseIparcelDutyAmount();
|
16 |
+
|
17 |
+
$invoice->setGrandTotal($invoice->getGrandTotal() + $dutyAmount);
|
18 |
+
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseDutyAmount);
|
19 |
+
|
20 |
+
$invoice->setIparcelDutyAmount($dutyAmount);
|
21 |
+
$invoice->setBaseIparcelDutyAmount($baseDutyAmount);
|
22 |
+
}
|
23 |
+
}
|
app/code/community/Iparcel/Logistics/Model/Order/Invoice/Total/Tax.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel model for displaying tax total on invoices
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Logistics
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Logistics_Model_Order_Invoice_Total_Tax extends Mage_Sales_Model_Order_Invoice_Total_Abstract
|
10 |
+
{
|
11 |
+
public function collect(Mage_Sales_Model_Order_Invoice $invoice)
|
12 |
+
{
|
13 |
+
$order = $invoice->getOrder();
|
14 |
+
$taxAmount = $order->getIparcelTaxAmount();
|
15 |
+
$baseTaxAmount = $order->getBaseIparcelTaxAmount();
|
16 |
+
|
17 |
+
$invoice->setGrandTotal($invoice->getGrandTotal() + $taxAmount);
|
18 |
+
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseTaxAmount);
|
19 |
+
|
20 |
+
$invoice->setIparcelTaxAmount($taxAmount);
|
21 |
+
$invoice->setBaseIparcelTaxAmount($baseTaxAmount);
|
22 |
+
}
|
23 |
+
}
|
app/code/community/Iparcel/Logistics/Model/Quote/Address/Total/Abstract.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Abstract model for i-parcel Quote Address totals
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Logistics
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Logistics_Model_Quote_Address_Total_Abstract extends Mage_Sales_Model_Quote_Address_Total_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Determines if the address is using an i-parcel shipping method
|
13 |
+
*
|
14 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
15 |
+
* @return boolean
|
16 |
+
*/
|
17 |
+
public function isIparcelShipping($address)
|
18 |
+
{
|
19 |
+
$shippingMethod = $address->getShippingMethod();
|
20 |
+
$shippingMethod = explode('_', $shippingMethod);
|
21 |
+
|
22 |
+
if ($shippingMethod[0] == 'i-parcel') {
|
23 |
+
return true;
|
24 |
+
}
|
25 |
+
|
26 |
+
return false;
|
27 |
+
}
|
28 |
+
}
|
app/code/community/Iparcel/Logistics/Model/Quote/Address/Total/Collector.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class to reorder Magento's total collectors
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Logistics
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Logistics_Model_Quote_Address_Total_Collector extends Mage_Sales_Model_Quote_Address_Total_Collector
|
10 |
+
{
|
11 |
+
public function getCollectors()
|
12 |
+
{
|
13 |
+
$collectors = parent::getCollectors();
|
14 |
+
|
15 |
+
$iparcel_tax = $collectors['iparcel_tax'];
|
16 |
+
$iparcel_duty = $collectors['iparcel_duty'];
|
17 |
+
$grand_total = $collectors['grand_total'];
|
18 |
+
|
19 |
+
unset($collectors['iparcel_tax']);
|
20 |
+
unset($collectors['iparcel_duty']);
|
21 |
+
unset($collectors['grand_total']);
|
22 |
+
|
23 |
+
$collectors['iparcel_tax'] = $iparcel_tax;
|
24 |
+
$collectors['iparcel_duty'] = $iparcel_duty;
|
25 |
+
$collectors['grand_total'] = $grand_total;
|
26 |
+
|
27 |
+
return $collectors;
|
28 |
+
}
|
29 |
+
}
|
app/code/community/Iparcel/Logistics/Model/Quote/Address/Total/Duty.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel model for shipping duty
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Logistics
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Logistics_Model_Quote_Address_Total_Duty extends Iparcel_Logistics_Model_Quote_Address_Total_Abstract
|
10 |
+
{
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
$this->setCode('iparcel_duty');
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Used each time collectTotals is invoked to find the duty rate
|
18 |
+
*
|
19 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
20 |
+
* @return Iparcel_Logistics_Model_Total_Duty
|
21 |
+
*/
|
22 |
+
public function collect(Mage_Sales_Model_Quote_Address $address)
|
23 |
+
{
|
24 |
+
if ($address->getAddressType() != 'shipping') {
|
25 |
+
return;
|
26 |
+
}
|
27 |
+
|
28 |
+
if (Mage::helper('iplogistics')->getDisplayTaxAndDutyCumulatively()
|
29 |
+
|| Mage::helper('iplogistics')->getDisplayTaxAndDutySeparately()) {
|
30 |
+
parent::collect($address);
|
31 |
+
|
32 |
+
$dutyAndTaxes = Mage::registry('iparcel_duty_and_taxes');
|
33 |
+
$duty = $dutyAndTaxes['service_levels'][$address->getShippingMethod()]['duty'];
|
34 |
+
|
35 |
+
$this->_setBaseAmount($duty);
|
36 |
+
$this->_setAmount(
|
37 |
+
$address->getQuote()->getStore()->convertPrice($duty, false)
|
38 |
+
);
|
39 |
+
}
|
40 |
+
return $this;
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Display the duty rate
|
45 |
+
*
|
46 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
47 |
+
* @return Iparcel_Logistics_Model_Total_Duty
|
48 |
+
*/
|
49 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
50 |
+
{
|
51 |
+
if ($address->getAddressType() != 'shipping'
|
52 |
+
|| $this->isIparcelShipping($address) == false) {
|
53 |
+
return;
|
54 |
+
}
|
55 |
+
|
56 |
+
$duty = $address->getIparcelDutyAmount();
|
57 |
+
|
58 |
+
// If we should show the tax and duty cumulatively
|
59 |
+
if (Mage::helper('iplogistics')->getDisplayTaxAndDutyCumulatively()
|
60 |
+
&& ($duty != null || $address->getIparcelTaxAmount() != null)) {
|
61 |
+
$address->addTotal(array(
|
62 |
+
'code' => $this->getCode(),
|
63 |
+
'title' => Mage::helper('iplogistics')->getTaxAndDutyLabel(),
|
64 |
+
'value' => $duty + $address->getIparcelTaxAmount()
|
65 |
+
));
|
66 |
+
} elseif (Mage::helper('iplogistics')->getDisplayTaxAndDutySeparately()
|
67 |
+
&& $duty != null) {
|
68 |
+
$address->addTotal(array(
|
69 |
+
'code' => $this->getCode(),
|
70 |
+
'title' => Mage::helper('iplogistics')->getDutyLabel(),
|
71 |
+
'value' => $duty
|
72 |
+
));
|
73 |
+
}
|
74 |
+
}
|
75 |
+
}
|
app/code/community/Iparcel/Logistics/Model/Quote/Address/Total/Tax.php
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* i-parcel model for shipping tax
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Logistics
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Logistics_Model_Quote_Address_Total_Tax extends Iparcel_Logistics_Model_Quote_Address_Total_Abstract
|
10 |
+
{
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
$this->setCode('iparcel_tax');
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Used each time collectTotals is invoked to find the duty rate
|
18 |
+
*
|
19 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
20 |
+
* @return Iparcel_Logistics_Model_Total_Tax
|
21 |
+
*/
|
22 |
+
public function collect(Mage_Sales_Model_Quote_Address $address)
|
23 |
+
{
|
24 |
+
if ($address->getAddressType() != 'shipping') {
|
25 |
+
return;
|
26 |
+
}
|
27 |
+
|
28 |
+
$tax = 0;
|
29 |
+
if ($this->isIparcelShipping($address) &&
|
30 |
+
(Mage::helper('iplogistics')->getDisplayTaxAndDutyCumulatively()
|
31 |
+
|| Mage::helper('iplogistics')->getDisplayTaxAndDutySeparately())) {
|
32 |
+
parent::collect($address);
|
33 |
+
|
34 |
+
$dutyAndTaxes = Mage::registry('iparcel_duty_and_taxes');
|
35 |
+
$tax = null;
|
36 |
+
|
37 |
+
$quote = Mage::getModel('iplogistics/api_quote');
|
38 |
+
$quote->loadByQuoteId($address->getQuote()->getId());
|
39 |
+
if (is_array($dutyAndTaxes)) {
|
40 |
+
/**
|
41 |
+
* To make the tax and duty information persist through to the final
|
42 |
+
* collectTotals, we must store the information from the registry.
|
43 |
+
*/
|
44 |
+
$quote->setQuoteId($address->getQuote()->getId());
|
45 |
+
$quote->setParcelId($dutyAndTaxes['parcel_id']);
|
46 |
+
$quote->setServiceLevels($dutyAndTaxes['service_levels']);
|
47 |
+
$quote->save();
|
48 |
+
} else {
|
49 |
+
/**
|
50 |
+
* If the registry is empty, then we are collecting totals while
|
51 |
+
* converting the quote to an order
|
52 |
+
*/
|
53 |
+
if ($quote->getId()) {
|
54 |
+
$dutyAndTaxes = array(
|
55 |
+
'parcel_id' => $quote->getParcelId(),
|
56 |
+
'service_levels' => $quote->getServiceLevels()
|
57 |
+
);
|
58 |
+
/**
|
59 |
+
* Catch an error caused by unserialize returning `false`
|
60 |
+
* if the data stored in the databse is invalid
|
61 |
+
*/
|
62 |
+
if ($dutyAndTaxes['service_levels'] == false) {
|
63 |
+
Mage::throwException('Failed to set shipping rates tax and duty.');
|
64 |
+
}
|
65 |
+
Mage::register('iparcel_duty_and_taxes', $dutyAndTaxes);
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
$tax = $dutyAndTaxes['service_levels'][$address->getShippingMethod()]['tax'];
|
70 |
+
|
71 |
+
$this->_setBaseAmount($tax);
|
72 |
+
$this->_setAmount(
|
73 |
+
$address->getQuote()->getStore()->convertPrice($tax, false)
|
74 |
+
);
|
75 |
+
|
76 |
+
/**
|
77 |
+
* If this is an i-parcel shipped order, we have to remove Magento's
|
78 |
+
* calculated tax, to allow i-parcel's to be the only tax calculated
|
79 |
+
*/
|
80 |
+
$address->setTaxAmount(0);
|
81 |
+
$address->setBaseTaxAmount(0);
|
82 |
+
|
83 |
+
return $this;
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Display the duty rate
|
89 |
+
*
|
90 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
91 |
+
* @return Iparcel_Logistics_Model_Total_Tax
|
92 |
+
*/
|
93 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
94 |
+
{
|
95 |
+
if ($address->getAddressType() != 'shipping') {
|
96 |
+
return;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* We only display the tax if the duty and tax are displayed seperately.
|
101 |
+
* Otherwise, the Duty model will handle displaying the combined total.
|
102 |
+
*/
|
103 |
+
if ($this->isIparcelShipping($address)
|
104 |
+
&& Mage::helper('iplogistics')->getDisplayTaxAndDutySeparately()
|
105 |
+
&& $address->getIparcelTaxAmount() != null) {
|
106 |
+
$address->addTotal(array(
|
107 |
+
'code' => $this->getCode(),
|
108 |
+
'title' => Mage::helper('iplogistics')->getTaxLabel(),
|
109 |
+
'value' => $address->getIparcelTaxAmount()
|
110 |
+
));
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
app/code/community/Iparcel/Logistics/Model/Resource/Api/Quote.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Resource Model for Iparcel_Logistics_Model_Api_Quote class
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Shipping
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Logistics_Model_Resource_Api_Quote extends Mage_Core_Model_Resource_Db_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Initializing Resource
|
13 |
+
*/
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
$this->_init('iplogistics/api_quote', 'id');
|
17 |
+
}
|
18 |
+
}
|
app/code/community/Iparcel/Logistics/Model/Tax/Quote/Shipping.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class to override Magento's tax rate
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Logistics
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Logistics_Model_Tax_Quote_Shipping extends Mage_Tax_Model_Sales_Total_Quote_Shipping
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Returns i-parcel's quote address abstract class
|
13 |
+
*
|
14 |
+
* @return Iparcel_Logistics_Model_Quote_Address_Total_Abstract
|
15 |
+
*/
|
16 |
+
private function _getAbstract()
|
17 |
+
{
|
18 |
+
$model = new Iparcel_Logistics_Model_Quote_Address_Total_Abstract;
|
19 |
+
return $model;
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Prevent's Magento's tax calculation if i-parcel shipping method is used
|
24 |
+
*
|
25 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
26 |
+
* @return object
|
27 |
+
*/
|
28 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
29 |
+
{
|
30 |
+
if ($this->_getAbstract()->isIparcelShipping($address)) {
|
31 |
+
return;
|
32 |
+
} else {
|
33 |
+
return parent::fetch($address);
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Prevent's Magento's tax display if i-parcel shipping method is used
|
39 |
+
*
|
40 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
41 |
+
* @return Iparcel_Logistics_Model_Quote_Address_Total_Magentotax
|
42 |
+
*/
|
43 |
+
public function collect(Mage_Sales_Model_Quote_Address $address)
|
44 |
+
{
|
45 |
+
if ($this->_getAbstract()->isIparcelShipping($address)) {
|
46 |
+
return;
|
47 |
+
} else {
|
48 |
+
return parent::collect($address);
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
app/code/community/Iparcel/Logistics/Model/Tax/Quote/Subtotal.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class to override Magento's tax rate
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Logistics
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Logistics_Model_Tax_Quote_Subtotal extends Mage_Tax_Model_Sales_Total_Quote_Subtotal
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Returns i-parcel's quote address abstract class
|
13 |
+
*
|
14 |
+
* @return Iparcel_Logistics_Model_Quote_Address_Total_Abstract
|
15 |
+
*/
|
16 |
+
private function _getAbstract()
|
17 |
+
{
|
18 |
+
$model = new Iparcel_Logistics_Model_Quote_Address_Total_Abstract;
|
19 |
+
return $model;
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Prevent's Magento's tax calculation if i-parcel shipping method is used
|
24 |
+
*
|
25 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
26 |
+
* @return object
|
27 |
+
*/
|
28 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
29 |
+
{
|
30 |
+
if ($this->_getAbstract()->isIparcelShipping($address)) {
|
31 |
+
return;
|
32 |
+
} else {
|
33 |
+
return parent::fetch($address);
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Prevent's Magento's tax display if i-parcel shipping method is used
|
39 |
+
*
|
40 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
41 |
+
* @return Iparcel_Logistics_Model_Quote_Address_Total_Magentotax
|
42 |
+
*/
|
43 |
+
public function collect(Mage_Sales_Model_Quote_Address $address)
|
44 |
+
{
|
45 |
+
if ($this->_getAbstract()->isIparcelShipping($address)) {
|
46 |
+
return;
|
47 |
+
} else {
|
48 |
+
return parent::collect($address);
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
app/code/community/Iparcel/Logistics/Model/Tax/Quote/Tax.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class to override Magento's tax rate
|
4 |
+
*
|
5 |
+
* @category Iparcel
|
6 |
+
* @package Iparcel_Logistics
|
7 |
+
* @author Bobby Burden <bburden@i-parcel.com>
|
8 |
+
*/
|
9 |
+
class Iparcel_Logistics_Model_Tax_Quote_Tax extends Mage_Tax_Model_Sales_Total_Quote_Tax
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Returns i-parcel's quote address abstract class
|
13 |
+
*
|
14 |
+
* @return Iparcel_Logistics_Model_Quote_Address_Total_Abstract
|
15 |
+
*/
|
16 |
+
private function _getAbstract()
|
17 |
+
{
|
18 |
+
$model = new Iparcel_Logistics_Model_Quote_Address_Total_Abstract;
|
19 |
+
return $model;
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Prevent's Magento's tax calculation if i-parcel shipping method is used
|
24 |
+
*
|
25 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
26 |
+
* @return object
|
27 |
+
*/
|
28 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
29 |
+
{
|
30 |
+
if ($this->_getAbstract()->isIparcelShipping($address)) {
|
31 |
+
return;
|
32 |
+
} else {
|
33 |
+
return parent::fetch($address);
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Prevent's Magento's tax display if i-parcel shipping method is used
|
39 |
+
*
|
40 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
41 |
+
* @return Iparcel_Logistics_Model_Quote_Address_Total_Magentotax
|
42 |
+
*/
|
43 |
+
public function collect(Mage_Sales_Model_Quote_Address $address)
|
44 |
+
{
|
45 |
+
if ($this->_getAbstract()->isIparcelShipping($address)) {
|
46 |
+
return;
|
47 |
+
} else {
|
48 |
+
return parent::collect($address);
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
app/code/community/Iparcel/Logistics/etc/config.xml
CHANGED
@@ -2,14 +2,35 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Iparcel_Logistics>
|
5 |
-
<version>1.0.
|
6 |
</Iparcel_Logistics>
|
7 |
</modules>
|
8 |
<global>
|
9 |
<models>
|
10 |
<iplogistics>
|
11 |
<class>Iparcel_Logistics_Model</class>
|
|
|
12 |
</iplogistics>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
</models>
|
14 |
<helpers>
|
15 |
<iplogistics>
|
@@ -70,6 +91,56 @@
|
|
70 |
</observers>
|
71 |
</core_block_abstract_to_html_before>
|
72 |
</events>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
</global>
|
74 |
<adminhtml>
|
75 |
<layout>
|
@@ -80,6 +151,15 @@
|
|
80 |
</updates>
|
81 |
</layout>
|
82 |
</adminhtml>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
<admin>
|
84 |
<routers>
|
85 |
<adminhtml>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Iparcel_Logistics>
|
5 |
+
<version>1.0.4</version>
|
6 |
</Iparcel_Logistics>
|
7 |
</modules>
|
8 |
<global>
|
9 |
<models>
|
10 |
<iplogistics>
|
11 |
<class>Iparcel_Logistics_Model</class>
|
12 |
+
<resourceModel>iplogistics_resource</resourceModel>
|
13 |
</iplogistics>
|
14 |
+
<iplogistics_resource>
|
15 |
+
<class>Iparcel_Logistics_Model_Resource</class>
|
16 |
+
<entities>
|
17 |
+
<api_quote>
|
18 |
+
<table>iparcel_logistics_api_quote</table>
|
19 |
+
</api_quote>
|
20 |
+
</entities>
|
21 |
+
</iplogistics_resource>
|
22 |
+
<sales>
|
23 |
+
<rewrite>
|
24 |
+
<quote_address_total_collector>Iparcel_Logistics_Model_Quote_Address_Total_Collector</quote_address_total_collector>
|
25 |
+
</rewrite>
|
26 |
+
</sales>
|
27 |
+
<tax>
|
28 |
+
<rewrite>
|
29 |
+
<sales_total_quote_shipping>Iparcel_Logistics_Model_Tax_Quote_Shipping</sales_total_quote_shipping>
|
30 |
+
<sales_total_quote_subtotal>Iparcel_Logistics_Model_Tax_Quote_Subtotal</sales_total_quote_subtotal>
|
31 |
+
<sales_total_quote_tax>Iparcel_Logistics_Model_Tax_Quote_Tax</sales_total_quote_tax>
|
32 |
+
</rewrite>
|
33 |
+
</tax>
|
34 |
</models>
|
35 |
<helpers>
|
36 |
<iplogistics>
|
91 |
</observers>
|
92 |
</core_block_abstract_to_html_before>
|
93 |
</events>
|
94 |
+
<sales>
|
95 |
+
<quote>
|
96 |
+
<totals>
|
97 |
+
<iparcel_tax>
|
98 |
+
<class>iplogistics/quote_address_total_tax</class>
|
99 |
+
<before>grand_total</before>
|
100 |
+
<after>shipping</after>
|
101 |
+
</iparcel_tax>
|
102 |
+
<iparcel_duty>
|
103 |
+
<class>iplogistics/quote_address_total_duty</class>
|
104 |
+
<before>grand_total</before>
|
105 |
+
<after>iparcel_tax</after>
|
106 |
+
</iparcel_duty>
|
107 |
+
</totals>
|
108 |
+
</quote>
|
109 |
+
<order_invoice>
|
110 |
+
<totals>
|
111 |
+
<iparcel_tax>
|
112 |
+
<class>iplogistics/order_invoice_total_tax</class>
|
113 |
+
</iparcel_tax>
|
114 |
+
<iparcel_duty>
|
115 |
+
<class>iplogistics/order_invoice_total_duty</class>
|
116 |
+
</iparcel_duty>
|
117 |
+
</totals>
|
118 |
+
</order_invoice>
|
119 |
+
<order_creditmemo>
|
120 |
+
<totals>
|
121 |
+
<iparcel_tax>
|
122 |
+
<class>iplogistics/order_creditmemo_total_tax</class>
|
123 |
+
</iparcel_tax>
|
124 |
+
<iparcel_duty>
|
125 |
+
<class>iplogistics/order_creditmemo_total_duty</class>
|
126 |
+
</iparcel_duty>
|
127 |
+
</totals>
|
128 |
+
</order_creditmemo>
|
129 |
+
</sales>
|
130 |
+
<fieldsets>
|
131 |
+
<sales_convert_quote_address>
|
132 |
+
<base_iparcel_duty_amount><to_order>*</to_order></base_iparcel_duty_amount>
|
133 |
+
<iparcel_duty_amount><to_order>*</to_order></iparcel_duty_amount>
|
134 |
+
<base_iparcel_tax_amount><to_order>*</to_order></base_iparcel_tax_amount>
|
135 |
+
<iparcel_tax_amount><to_order>*</to_order></iparcel_tax_amount>
|
136 |
+
</sales_convert_quote_address>
|
137 |
+
<sales_convert_order>
|
138 |
+
<base_iparcel_duty_amount><to_invoice>*</to_invoice><to_cm>*</to_cm></base_iparcel_duty_amount>
|
139 |
+
<iparcel_duty_amount><to_invoice>*</to_invoice><to_cm>*</to_cm></iparcel_duty_amount>
|
140 |
+
<base_iparcel_tax_amount><to_invoice>*</to_invoice><to_cm>*</to_cm></base_iparcel_tax_amount>
|
141 |
+
<iparcel_tax_amount><to_invoice>*</to_invoice><to_cm>*</to_cm></iparcel_tax_amount>
|
142 |
+
</sales_convert_order>
|
143 |
+
</fieldsets>
|
144 |
</global>
|
145 |
<adminhtml>
|
146 |
<layout>
|
151 |
</updates>
|
152 |
</layout>
|
153 |
</adminhtml>
|
154 |
+
<frontend>
|
155 |
+
<layout>
|
156 |
+
<updates>
|
157 |
+
<iplogistics>
|
158 |
+
<file>iplogistics.xml</file>
|
159 |
+
</iplogistics>
|
160 |
+
</updates>
|
161 |
+
</layout>
|
162 |
+
</frontend>
|
163 |
<admin>
|
164 |
<routers>
|
165 |
<adminhtml>
|
app/code/community/Iparcel/Logistics/etc/system.xml
CHANGED
@@ -121,5 +121,62 @@
|
|
121 |
</i-parcel>
|
122 |
</groups>
|
123 |
</carriers>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
</sections>
|
125 |
</config>
|
121 |
</i-parcel>
|
122 |
</groups>
|
123 |
</carriers>
|
124 |
+
<iparcel>
|
125 |
+
<groups>
|
126 |
+
<tax translate="label">
|
127 |
+
<label>Tax Intercepting</label>
|
128 |
+
<frontend_type>text</frontend_type>
|
129 |
+
<sort_order>15</sort_order>
|
130 |
+
<show_in_default>1</show_in_default>
|
131 |
+
<show_in_website>1</show_in_website>
|
132 |
+
<show_in_store>1</show_in_store>
|
133 |
+
<expanded>1</expanded>
|
134 |
+
<fields>
|
135 |
+
<mode translate="label">
|
136 |
+
<label>Mode</label>
|
137 |
+
<frontend_type>select</frontend_type>
|
138 |
+
<source_model>iplogistics/system_config_source_tax_mode</source_model>
|
139 |
+
<sort_order>0</sort_order>
|
140 |
+
<show_in_default>1</show_in_default>
|
141 |
+
<show_in_website>1</show_in_website>
|
142 |
+
<show_in_store>1</show_in_store>
|
143 |
+
</mode>
|
144 |
+
<tax_duty_label translate="label">
|
145 |
+
<label><![CDATA[Tax&Duty Label]]></label>
|
146 |
+
<frontend_type>text</frontend_type>
|
147 |
+
<sort_order>5</sort_order>
|
148 |
+
<show_in_default>1</show_in_default>
|
149 |
+
<show_in_website>1</show_in_website>
|
150 |
+
<show_in_store>1</show_in_store>
|
151 |
+
<depends>
|
152 |
+
<mode>1</mode>
|
153 |
+
</depends>
|
154 |
+
</tax_duty_label>
|
155 |
+
<tax_label translate="label">
|
156 |
+
<label>Tax Label</label>
|
157 |
+
<frontend_type>text</frontend_type>
|
158 |
+
<sort_order>10</sort_order>
|
159 |
+
<show_in_default>1</show_in_default>
|
160 |
+
<show_in_website>1</show_in_website>
|
161 |
+
<show_in_store>1</show_in_store>
|
162 |
+
<depends>
|
163 |
+
<mode>2</mode>
|
164 |
+
</depends>
|
165 |
+
</tax_label>
|
166 |
+
<duty_label translate="label">
|
167 |
+
<label>Duty Label</label>
|
168 |
+
<frontend_type>text</frontend_type>
|
169 |
+
<sort_order>15</sort_order>
|
170 |
+
<show_in_default>1</show_in_default>
|
171 |
+
<show_in_website>1</show_in_website>
|
172 |
+
<show_in_store>1</show_in_store>
|
173 |
+
<depends>
|
174 |
+
<mode>2</mode>
|
175 |
+
</depends>
|
176 |
+
</duty_label>
|
177 |
+
</fields>
|
178 |
+
</tax>
|
179 |
+
</groups>
|
180 |
+
</iparcel>
|
181 |
</sections>
|
182 |
</config>
|
app/code/community/Iparcel/Logistics/sql/iplogistics_setup/mysql4-upgrade-1.0.0-1.0.1.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = new Mage_Sales_Model_Resource_Setup('core_setup');
|
4 |
+
|
5 |
+
// Setup attributes for handling tax and duty for i-parcel shipped orders
|
6 |
+
$entities = array(
|
7 |
+
'quote_address',
|
8 |
+
'order',
|
9 |
+
'invoice',
|
10 |
+
'creditmemo'
|
11 |
+
);
|
12 |
+
$options = array(
|
13 |
+
'type' => Varien_Db_Ddl_Table::TYPE_DECIMAL,
|
14 |
+
'visible' => true,
|
15 |
+
'required' => false
|
16 |
+
);
|
17 |
+
foreach ($entities as $entity) {
|
18 |
+
$installer->addAttribute($entity, 'base_iparcel_duty_amount', $options);
|
19 |
+
$installer->addAttribute($entity, 'iparcel_duty_amount', $options);
|
20 |
+
$installer->addAttribute($entity, 'base_iparcel_tax_amount', $options);
|
21 |
+
$installer->addAttribute($entity, 'iparcel_tax_amount', $options);
|
22 |
+
}
|
23 |
+
$installer->endSetup();
|
app/code/community/Iparcel/Logistics/sql/iplogistics_setup/mysql4-upgrade-1.0.1-1.0.2.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
// Create a table to store tax & duty calculations
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
DROP TABLE IF EXISTS {$this->getTable('iplogistics/api_quote')};
|
9 |
+
CREATE TABLE {$this->getTable('iplogistics/api_quote')} (
|
10 |
+
`id` int(11) unsigned NOT NULL auto_increment,
|
11 |
+
`quote_id` varchar(255) NOT NULL,
|
12 |
+
`parcel_id` varchar(255) NOT NULL,
|
13 |
+
`service_levels` varchar(255) NOT NULL,
|
14 |
+
PRIMARY KEY (`id`)
|
15 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
16 |
+
");
|
17 |
+
|
18 |
+
$installer->endSetup();
|
app/code/community/Iparcel/Logistics/sql/iplogistics_setup/mysql4-upgrade-1.0.2-1.0.3.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Updates default Service Levels and names
|
4 |
+
*/
|
5 |
+
$installer = $this;
|
6 |
+
|
7 |
+
$installer->startSetup();
|
8 |
+
|
9 |
+
$data = array(
|
10 |
+
array(
|
11 |
+
'service_id' => 112,
|
12 |
+
'title' => 'UPS i-Parcel Express'
|
13 |
+
),
|
14 |
+
array(
|
15 |
+
'service_id' => 115,
|
16 |
+
'title' => 'UPS i-Parcel Select'
|
17 |
+
),
|
18 |
+
array(
|
19 |
+
'service_id' => 119,
|
20 |
+
'title' => 'UPS i-Parcel Saver'
|
21 |
+
),
|
22 |
+
array(
|
23 |
+
'service_id' => 211,
|
24 |
+
'title' => 'UPS Standard'
|
25 |
+
),
|
26 |
+
array(
|
27 |
+
'service_id' => 208,
|
28 |
+
'title' => 'UPS Expedited'
|
29 |
+
),
|
30 |
+
array(
|
31 |
+
'service_id' => 265,
|
32 |
+
'title' => 'UPS Saver'
|
33 |
+
),
|
34 |
+
array(
|
35 |
+
'service_id' => 207,
|
36 |
+
'title' => 'UPS Express'
|
37 |
+
),
|
38 |
+
array(
|
39 |
+
'service_id' => 254,
|
40 |
+
'title' => 'UPS Express Plus'
|
41 |
+
)
|
42 |
+
);
|
43 |
+
|
44 |
+
Mage::getModel('core/config_data')
|
45 |
+
->setScope('default')
|
46 |
+
->setScopeId(0)
|
47 |
+
->setPath('carriers/i-parcel/name')
|
48 |
+
->setValue(serialize($data))
|
49 |
+
->save();
|
50 |
+
|
51 |
+
$installer->endSetup();
|
app/code/community/Iparcel/Logistics/sql/iplogistics_setup/mysql4-upgrade-1.0.3-1.0.4.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
// Create a table to store tax & duty calculations
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
ALTER TABLE {$this->getTable('iplogistics/api_quote')}
|
9 |
+
MODIFY `service_levels` TEXT
|
10 |
+
");
|
11 |
+
|
12 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/iplogistics.xml
CHANGED
@@ -6,6 +6,7 @@
|
|
6 |
</action>
|
7 |
</reference>
|
8 |
</adminhtml_system_config_edit>
|
|
|
9 |
<adminhtml_iplogistics_shipment_split>
|
10 |
<reference name="content">
|
11 |
<block type="iplogistics/adminhtml_iplogistics_shipment_split" name="iplogistics_shipment_split">
|
@@ -19,4 +20,53 @@
|
|
19 |
</block>
|
20 |
</reference>
|
21 |
</adminhtml_iplogistics_shipment_split>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
</layout>
|
6 |
</action>
|
7 |
</reference>
|
8 |
</adminhtml_system_config_edit>
|
9 |
+
|
10 |
<adminhtml_iplogistics_shipment_split>
|
11 |
<reference name="content">
|
12 |
<block type="iplogistics/adminhtml_iplogistics_shipment_split" name="iplogistics_shipment_split">
|
20 |
</block>
|
21 |
</reference>
|
22 |
</adminhtml_iplogistics_shipment_split>
|
23 |
+
|
24 |
+
<adminhtml_sales_order_view>
|
25 |
+
<reference name="order_totals">
|
26 |
+
<block type="adminhtml/sales_order_totals_item" name="iplogistics_order_totals_duty" template="iplogistics/order/totals/duty.phtml"></block>
|
27 |
+
<block type="adminhtml/sales_order_totals_item" name="iplogistics_order_totals_tax" template="iplogistics/order/totals/tax.phtml"></block>
|
28 |
+
</reference>
|
29 |
+
</adminhtml_sales_order_view>
|
30 |
+
|
31 |
+
<adminhtml_sales_order_invoice_new>
|
32 |
+
<reference name="invoice_totals">
|
33 |
+
<block type="adminhtml/sales_order_totals_item" name="iplogistics_order_totals_duty" template="iplogistics/order/totals/duty.phtml"></block>
|
34 |
+
<block type="adminhtml/sales_order_totals_item" name="iplogistics_order_totals_tax" template="iplogistics/order/totals/tax.phtml"></block>
|
35 |
+
</reference>
|
36 |
+
</adminhtml_sales_order_invoice_new>
|
37 |
+
|
38 |
+
<adminhtml_sales_order_invoice_updateqty>
|
39 |
+
<reference name="invoice_totals">
|
40 |
+
<block type="adminhtml/sales_order_totals_item" name="iplogistics_order_totals_duty" template="iplogistics/order/totals/duty.phtml"></block>
|
41 |
+
<block type="adminhtml/sales_order_totals_item" name="iplogistics_order_totals_tax" template="iplogistics/order/totals/tax.phtml"></block>
|
42 |
+
</reference>
|
43 |
+
</adminhtml_sales_order_invoice_updateqty>
|
44 |
+
|
45 |
+
<adminhtml_sales_order_invoice_view>
|
46 |
+
<reference name="invoice_totals">
|
47 |
+
<block type="adminhtml/sales_order_totals_item" name="iplogistics_order_totals_duty" template="iplogistics/order/totals/duty.phtml"></block>
|
48 |
+
<block type="adminhtml/sales_order_totals_item" name="iplogistics_order_totals_tax" template="iplogistics/order/totals/tax.phtml"></block>
|
49 |
+
</reference>
|
50 |
+
</adminhtml_sales_order_invoice_view>
|
51 |
+
|
52 |
+
<adminhtml_sales_order_creditmemo_new>
|
53 |
+
<reference name="creditmemo_totals">
|
54 |
+
<block type="adminhtml/sales_order_totals_item" name="iplogistics_order_totals_duty" template="iplogistics/order/totals/duty.phtml"></block>
|
55 |
+
<block type="adminhtml/sales_order_totals_item" name="iplogistics_order_totals_tax" template="iplogistics/order/totals/tax.phtml"></block>
|
56 |
+
</reference>
|
57 |
+
</adminhtml_sales_order_creditmemo_new>
|
58 |
+
|
59 |
+
<adminhtml_sales_order_creditmemo_updateqty>
|
60 |
+
<reference name="creditmemo_totals">
|
61 |
+
<block type="adminhtml/sales_order_totals_item" name="iplogistics_order_totals_duty" template="iplogistics/order/totals/duty.phtml"></block>
|
62 |
+
<block type="adminhtml/sales_order_totals_item" name="iplogistics_order_totals_tax" template="iplogistics/order/totals/tax.phtml"></block>
|
63 |
+
</reference>
|
64 |
+
</adminhtml_sales_order_creditmemo_updateqty>
|
65 |
+
|
66 |
+
<adminhtml_sales_order_creditmemo_view>
|
67 |
+
<reference name="creditmemo_totals">
|
68 |
+
<block type="adminhtml/sales_order_totals_item" name="iplogistics_order_totals_duty" template="iplogistics/order/totals/duty.phtml"></block>
|
69 |
+
<block type="adminhtml/sales_order_totals_item" name="iplogistics_order_totals_tax" template="iplogistics/order/totals/tax.phtml"></block>
|
70 |
+
</reference>
|
71 |
+
</adminhtml_sales_order_creditmemo_view>
|
72 |
</layout>
|
app/design/adminhtml/default/default/template/iplogistics/order/totals/duty.phtml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $this->setPriceDataObject($this->getSource()) ?>
|
2 |
+
<?php if ((float) $this->getSource()->getIparcelDutyAmount()): ?>
|
3 |
+
<tr>
|
4 |
+
<td class="label"><?php echo Mage::helper('iplogistics')->getDutyLabel(); ?></td>
|
5 |
+
<td>
|
6 |
+
<?php echo $this->displayPrices($this->getSource()->getBaseIparcelDutyAmount(), $this->getSource()->getIparcelDutyAmount()); ?>
|
7 |
+
</td>
|
8 |
+
</tr>
|
9 |
+
<?php endif; ?>
|
app/design/adminhtml/default/default/template/iplogistics/order/totals/tax.phtml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $this->setPriceDataObject($this->getSource()) ?>
|
2 |
+
<?php if ((float) $this->getSource()->getIparcelTaxAmount()): ?>
|
3 |
+
<tr>
|
4 |
+
<td class="label"><?php echo Mage::helper('iplogistics')->getTaxLabel(); ?></td>
|
5 |
+
<td>
|
6 |
+
<?php echo $this->displayPrices($this->getSource()->getBaseIparcelTaxAmount(), $this->getSource()->getIparcelTaxAmount()); ?>
|
7 |
+
</td>
|
8 |
+
</tr>
|
9 |
+
<?php endif; ?>
|
app/design/frontend/base/default/layout/iplogistics.xml
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<sales_order_view>
|
4 |
+
<reference name="order_totals">
|
5 |
+
<block type="iplogistics/sales_order_totals_duty" name="iplogistics_sales_order_totals_duty"></block>
|
6 |
+
<block type="iplogistics/sales_order_totals_tax" name="iplogistics_sales_order_totals_tax"></block>
|
7 |
+
</reference>
|
8 |
+
</sales_order_view>
|
9 |
+
|
10 |
+
<sales_order_print>
|
11 |
+
<reference name="order_totals">
|
12 |
+
<block type="iplogistics/sales_order_totals_duty" name="iplogistics_sales_order_totals_duty"></block>
|
13 |
+
<block type="iplogistics/sales_order_totals_tax" name="iplogistics_sales_order_totals_tax"></block>
|
14 |
+
</reference>
|
15 |
+
</sales_order_print>
|
16 |
+
|
17 |
+
<sales_email_order_items>
|
18 |
+
<reference name="order_totals">
|
19 |
+
<block type="iplogistics/sales_order_totals_duty" name="iplogistics_sales_order_totals_duty"></block>
|
20 |
+
<block type="iplogistics/sales_order_totals_tax" name="iplogistics_sales_order_totals_tax"></block>
|
21 |
+
</reference>
|
22 |
+
</sales_email_order_items>
|
23 |
+
|
24 |
+
<sales_order_invoice>
|
25 |
+
<reference name="invoice_totals">
|
26 |
+
<block type="iplogistics/sales_order_totals_duty" name="iplogistics_sales_order_totals_duty"></block>
|
27 |
+
<block type="iplogistics/sales_order_totals_tax" name="iplogistics_sales_order_totals_tax"></block>
|
28 |
+
</reference>
|
29 |
+
</sales_order_invoice>
|
30 |
+
|
31 |
+
<sales_order_printinvoice>
|
32 |
+
<reference name="invoice_totals">
|
33 |
+
<block type="iplogistics/sales_order_totals_duty" name="iplogistics_sales_order_totals_duty"></block>
|
34 |
+
<block type="iplogistics/sales_order_totals_tax" name="iplogistics_sales_order_totals_tax"></block>
|
35 |
+
</reference>
|
36 |
+
</sales_order_printinvoice>
|
37 |
+
|
38 |
+
<sales_email_order_invoice_items>
|
39 |
+
<reference name="invoice_totals">
|
40 |
+
<block type="iplogistics/sales_order_totals_duty" name="iplogistics_sales_order_totals_duty"></block>
|
41 |
+
<block type="iplogistics/sales_order_totals_tax" name="iplogistics_sales_order_totals_tax"></block>
|
42 |
+
</reference>
|
43 |
+
</sales_email_order_invoice_items>
|
44 |
+
|
45 |
+
<sales_order_creditmemo>
|
46 |
+
<reference name="creditmemo_totals">
|
47 |
+
<block type="iplogistics/sales_order_totals_duty" name="iplogistics_sales_order_totals_duty"></block>
|
48 |
+
<block type="iplogistics/sales_order_totals_tax" name="iplogistics_sales_order_totals_tax"></block>
|
49 |
+
</reference>
|
50 |
+
</sales_order_creditmemo>
|
51 |
+
|
52 |
+
<sales_order_printcreditmemo>
|
53 |
+
<reference name="creditmemo_totals">
|
54 |
+
<block type="iplogistics/sales_order_totals_duty" name="iplogistics_sales_order_totals_duty"></block>
|
55 |
+
<block type="iplogistics/sales_order_totals_tax" name="iplogistics_sales_order_totals_tax"></block>
|
56 |
+
</reference>
|
57 |
+
</sales_order_printcreditmemo>
|
58 |
+
|
59 |
+
<sales_email_order_creditmemo_items>
|
60 |
+
<reference name="creditmemo_totals">
|
61 |
+
<block type="iplogistics/sales_order_totals_duty" name="iplogistics_sales_order_totals_duty"></block>
|
62 |
+
<block type="iplogistics/sales_order_totals_tax" name="iplogistics_sales_order_totals_tax"></block>
|
63 |
+
</reference>
|
64 |
+
</sales_email_order_creditmemo_items>
|
65 |
+
</layout>
|
app/etc/modules/Iparcel_Logistics.xml
CHANGED
@@ -6,6 +6,7 @@
|
|
6 |
<active>true</active>
|
7 |
<depends>
|
8 |
<Iparcel_All />
|
|
|
9 |
</depends>
|
10 |
</Iparcel_Logistics>
|
11 |
</modules>
|
6 |
<active>true</active>
|
7 |
<depends>
|
8 |
<Iparcel_All />
|
9 |
+
<Mage_Tax />
|
10 |
</depends>
|
11 |
</Iparcel_Logistics>
|
12 |
</modules>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>iparcel_logistics</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license>GPL</license>
|
7 |
<channel>community</channel>
|
@@ -12,12 +12,13 @@
|
|
12 |
<authors>
|
13 |
<author>
|
14 |
<name>Bobby Burden</name>
|
|
|
15 |
<email>bburden@i-parcel.com</email>
|
16 |
</author>
|
17 |
</authors>
|
18 |
-
<date>2015-
|
19 |
-
<time>
|
20 |
-
<contents><target name="mageweb"><dir name="app"><dir name="etc"><dir name="modules"><file name="Iparcel_Logistics.xml" hash="
|
21 |
<compatible/>
|
22 |
<dependencies>
|
23 |
<required>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>iparcel_logistics</name>
|
4 |
+
<version>1.0.4</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>GPL</license>
|
7 |
<channel>community</channel>
|
12 |
<authors>
|
13 |
<author>
|
14 |
<name>Bobby Burden</name>
|
15 |
+
<user>bburden</user>
|
16 |
<email>bburden@i-parcel.com</email>
|
17 |
</author>
|
18 |
</authors>
|
19 |
+
<date>2015-12-04</date>
|
20 |
+
<time>16:38:54</time>
|
21 |
+
<contents><target name="mageweb"><dir name="app"><dir name="etc"><dir name="modules"><file name="Iparcel_Logistics.xml" hash="2f375c30334e2d4a6bae03ccab808dd3"/><file name="Iparcel_All.xml" hash="89e4b47a6ac9aa0b82f70b1539d587ea"/></dir></dir><dir name="code"><dir name="community"><dir name="Iparcel"><dir name="Logistics"><dir name="Block"><dir name="Adminhtml"><dir name="Iplogistics"><dir name="Shipment"><dir name="Split"><file name="Form.php" hash="99e8ca49bb180c05bf05e44e41f880f7"/></dir><file name="Split.php" hash="848f88a16a03e5d58453e03e454a9a78"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Method.php" hash="09224de41e6bdb1fa951c631128fa2b9"/></dir></dir></dir></dir></dir><dir name="Sales"><dir name="Order"><dir name="Totals"><file name="Abstract.php" hash="e947a0fdfc0fdb3ce7fa7babb89937a2"/><file name="Duty.php" hash="afb0726fe989e1acc65aee33a7b627f6"/><file name="Tax.php" hash="6fe811b4600365d25bf9a51e4d953e0c"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Iplogistics"><dir name="Shipment"><file name="SplitController.php" hash="69ab4c55cc6436dc0fb2f6a722805c01"/></dir><file name="ShipmentController.php" hash="ebcac746bc97c046e71b0910e96174d9"/></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="8b8a4a0643ce23b42709f3b82e46e830"/><file name="config.xml" hash="ff30ff022517a50a29e51e2802d8594a"/><file name="system.xml" hash="2d358ff2e8711a9f626e75fd0a9a23ac"/></dir><dir name="Helper"><file name="Api.php" hash="b65dc36bddbb4d5f875b3c151d2034b5"/><file name="Data.php" hash="efe621ee5b8ec9f15419835a6dd20d73"/></dir><dir name="Model"><dir name="Api"><file name="Quote.php" hash="dd94fe794f8bff3c122e721ae28e2f5b"/></dir><dir name="Carrier"><file name="Iparcel.php" hash="117378acd7c0be96141819603b1d38bc"/></dir><file name="Observer.php" hash="e53f42252d7a333f24e48aef973c810c"/><dir name="Order"><dir name="Creditmemo"><dir name="Total"><file name="Duty.php" hash="d0fcc186046a33801ac5e77dc25a3152"/><file name="Tax.php" hash="2df3ee20703bcd793a2f214b7c30a057"/></dir></dir><dir name="Invoice"><dir name="Total"><file name="Duty.php" hash="8dbca3de53bdf5159cc21a889c0b84bc"/><file name="Tax.php" hash="d1b26d33237835d922c343e94cbefdae"/></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Abstract.php" hash="c8bd35b5d8cd34827e1de43e7ff2529d"/><file name="Collector.php" hash="11eb9174e5feea80a4b3c693dbc4edee"/><file name="Duty.php" hash="1997a432a12e19fcb90cd87fb673f8b7"/><file name="Tax.php" hash="41730f0644ba29cbc5731b1054697da6"/></dir></dir></dir><dir name="Resource"><dir name="Api"><file name="Quote.php" hash="ed97ba769a4807a7ac1152f9883b9e66"/></dir><dir name="Mysql4"><file name="Setup.php" hash="3eee28f86610e6cf1b83ee58b83d5e83"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Tax"><file name="Mode.php" hash="5c198e970795bdb3794ef8fd63380a4f"/></dir></dir></dir></dir><dir name="Tax"><dir name="Quote"><file name="Shipping.php" hash="06426983a284970284adbdf0221abeed"/><file name="Subtotal.php" hash="81b55a134b1cc6a45c920f40605a1fcb"/><file name="Tax.php" hash="ff7cd4a769646ed25aaab7c2cdc23775"/></dir></dir></dir><dir name="sql"><dir name="iplogistics_setup"><file name="mysql4-install-1.0.0.php" hash="69d5c2429cf5ee2d11e598f2137e7dc8"/><file name="mysql4-upgrade-1.0.0-1.0.1.php" hash="5f5645be5c8cd64394d8692e7fa847f9"/><file name="mysql4-upgrade-1.0.1-1.0.2.php" hash="a298c97b931d6dcf9cb6a70eb716b354"/><file name="mysql4-upgrade-1.0.2-1.0.3.php" hash="d9c7f2fafa7950aba5c0f23080a81e5f"/><file name="mysql4-upgrade-1.0.3-1.0.4.php" hash="9c0ccf88b7be483f52beb6a72156da63"/></dir></dir></dir><dir name="All"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Mapping"><file name="Button.php" hash="c522da3eac428059d7bf2543a4f4b131"/></dir></dir><dir name="Iparcel"><dir name="Logs"><file name="Grid.php" hash="dcd1776856b3eaacb0adde51c8f01c34"/></dir><file name="Logs.php" hash="4f8e3a643a459c0e39f6f6f7b7615596"/></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Iparcel"><file name="LogController.php" hash="e66d1e627d70a44fdb1574d541576069"/><file name="SyncController.php" hash="0955eb93d7d36fc95535a8da95b42142"/><dir name="Sync"><file name="AjaxController.php" hash="4f516b304798410b7b1678ae34f404cb"/></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="50bc0bee93b5612763321eae11cfdc51"/><file name="config.xml" hash="2d60b7d290d754d342699795ea2da500"/><file name="system.xml" hash="d95f41317f7c04ca4077534bdb7a2c74"/></dir><dir name="Helper"><file name="Api.php" hash="2199c96af216182dcb0fcc08d47c72e9"/><file name="Data.php" hash="4cfb227c77a5597bb21ba1ab1cbc65bd"/></dir><dir name="Model"><file name="Log.php" hash="aec9cf3cbde368b9429da4855982992b"/><dir name="System"><dir name="Config"><dir name="Catalog"><file name="Mapping.php" hash="f8cccb05d82033e1d45363909a0107ea"/></dir><dir name="Data"><dir name="Date"><file name="Monthday.php" hash="1209ecc1efae84ec2ba6b6f8a919471f"/><file name="Weekday.php" hash="ce94e8faef1aae79e88456efc3786c40"/></dir><dir name="Time"><file name="Hour.php" hash="00505288ba44bb0b0355c1ea98aa5197"/><file name="Minute.php" hash="c595bd08c07b4db4ace549ee7dcfcfd3"/></dir></dir><file name="Guid.php" hash="a255ee57a24272c082f4492bddca54a0"/><dir name="Script"><file name="Js.php" hash="b54b3065b94e442252fef4a60f3ba9e7"/></dir><dir name="Source"><dir name="Catalog"><dir name="Mapping"><dir name="Configurable"><file name="Price.php" hash="a0547977fc401041a17622997e7fe66c"/></dir><file name="Mode.php" hash="eb9f67b62a6e18359013a4339217295f"/></dir><dir name="Product"><dir name="Attribute"><file name="Boolean.php" hash="3e5ecb759dfe28afe943cf176f3b257e"/></dir><file name="Attribute.php" hash="10a03f729b05a3848d766b6d8961f8dd"/></dir></dir><dir name="Date"><file name="Weekday.php" hash="234308ffc0c0bc9071d11af6283b4101"/></dir><dir name="Sales"><dir name="Order"><file name="Status.php" hash="b66c1190e765bea7cf86aca5bb566059"/></dir></dir><dir name="Tax"><file name="Mode.php" hash="533825705da2b465a7b92485311d1078"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="iplogistics.xml" hash="dc215a898f4c73c61832b4f64ab2608b"/><file name="iparcel.xml" hash="c75b2082a2d5ceb3e507843ca793ea05"/></dir><dir name="template"><dir name="iplogistics"><dir name="order"><dir name="totals"><file name="duty.phtml" hash="0ea5054e7e70bd6d7b33bb46e0785bfb"/><file name="tax.phtml" hash="b208790d106afa82f2723c0d1ec12ed5"/></dir></dir><dir name="shipment"><dir name="split"><file name="form.phtml" hash="3f6284be75f13da03413d2d7aa96fdda"/><file name="items.phtml" hash="93be5dc4c1feae63a0dc751ae33420a7"/><dir name="renderer"><file name="default.phtml" hash="85053a7fe01567e023a30bbd0a03b27e"/></dir></dir></dir></dir><dir name="iparcel"><dir name="sync"><dir name="ajax"><file name="catalog.phtml" hash="ea1e0eb314efd5065d8afe1d8498a5ac"/><file name="checkitems.phtml" hash="cb3374eee0a9414539194cfc9bbf8c4c"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="iplogistics.xml" hash="01774751e5a2cd7a3356eb5ca8f39faf"/></dir></dir></dir></dir></dir></dir><dir name="js"><dir name="iparcel-logistics"><dir name="adminhtml"><file name="shipping-methods.js" hash="eca91e8a5cf152fce7af0eb5bf2991bb"/></dir></dir><dir name="iparcel"><dir name="adminhtml"><file name="sync.js" hash="57a9daf87ce1010765a6353823d08739"/></dir><file name="jQuery.js" hash="8fc25e27d42774aeae6edbc0a18b72aa"/></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="iparcel"><file name="ajaxSync.css" hash="c622b9e4b77589bc0f3c0555124d2751"/></dir></dir></dir></dir></dir></target></contents>
|
22 |
<compatible/>
|
23 |
<dependencies>
|
24 |
<required>
|