CashOnDelivery - Version 1.0.2

Version Notes

- Fixed missing COD Tax Fee for invoices containing configurable products

Download this release

Release Info

Developer Magento Core Team
Extension CashOnDelivery
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/community/Phoenix/CashOnDelivery/Model/Invoice/Tax.php CHANGED
@@ -21,9 +21,10 @@
21
  class Phoenix_CashOnDelivery_Model_Invoice_Tax extends Mage_Sales_Model_Order_Invoice_Total_Abstract
22
  {
23
  public function collect(Mage_Sales_Model_Order_Invoice $invoice)
24
- {
25
  $codTax = 0;
26
  $baseCodTax = 0;
 
27
 
28
  $includeCodTax = true;
29
  /**
@@ -44,11 +45,26 @@ class Phoenix_CashOnDelivery_Model_Invoice_Tax extends Mage_Sales_Model_Order_In
44
  $invoice->getOrder()->setBaseCodTaxAmountInvoice($baseCodTax);
45
  }
46
 
47
- //$invoice->setTaxAmount($invoice->getTaxAmount() + $codTax);
48
- //$invoice->setBaseTaxAmount($invoice->getBaseTaxAmount() + $baseCodTax);
 
 
 
 
 
 
 
 
 
 
 
49
 
50
- //$invoice->setGrandTotal($invoice->getGrandTotal() + $codTax);
51
- //$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseCodTax);
 
 
 
 
52
 
53
  return $this;
54
  }
21
  class Phoenix_CashOnDelivery_Model_Invoice_Tax extends Mage_Sales_Model_Order_Invoice_Total_Abstract
22
  {
23
  public function collect(Mage_Sales_Model_Order_Invoice $invoice)
24
+ {
25
  $codTax = 0;
26
  $baseCodTax = 0;
27
+ $order = $invoice->getOrder();
28
 
29
  $includeCodTax = true;
30
  /**
45
  $invoice->getOrder()->setBaseCodTaxAmountInvoice($baseCodTax);
46
  }
47
 
48
+ /**
49
+ * Not isLast() invoice case handling
50
+ * totalTax adjustment
51
+ * check Mage_Sales_Model_Order_Invoice_Total_Tax::collect()
52
+ */
53
+ $allowedTax = $order->getTaxAmount() - $order->getTaxInvoiced();
54
+ $allowedBaseTax = $order->getBaseTaxAmount() - $order->getBaseTaxInvoiced();
55
+ $totalTax = $invoice->getTaxAmount();
56
+ $baseTotalTax = $invoice->getBaseTaxAmount();
57
+ if (!$invoice->isLast()
58
+ && $allowedTax > $totalTax) {
59
+ $newTotalTax = min($allowedTax, $totalTax + $codTax);
60
+ $newBaseTotalTax = min($allowedBaseTax, $baseTotalTax + $baseCodTax);
61
 
62
+ $invoice->setTaxAmount($newTotalTax);
63
+ $invoice->setBaseTaxAmount($newBaseTotalTax);
64
+
65
+ $invoice->setGrandTotal($invoice->getGrandTotal() - $totalTax + $newTotalTax);
66
+ $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() - $baseTotalTax + $newBaseTotalTax);
67
+ }
68
 
69
  return $this;
70
  }
app/code/community/Phoenix/CashOnDelivery/etc/config.xml CHANGED
@@ -23,7 +23,7 @@
23
  <config>
24
  <modules>
25
  <Phoenix_CashOnDelivery>
26
- <version>1.0.1</version>
27
  </Phoenix_CashOnDelivery>
28
  </modules>
29
 
23
  <config>
24
  <modules>
25
  <Phoenix_CashOnDelivery>
26
+ <version>1.0.2</version>
27
  </Phoenix_CashOnDelivery>
28
  </modules>
29
 
package.xml CHANGED
@@ -1,19 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>CashOnDelivery</name>
4
- <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Cash on Delivery allows to book additional fee on delivery depending on inland or international delivery.</summary>
10
  <description>Cash on Delivery allows to book additional fee on delivery depending on inland or international delivery.</description>
11
- <notes>- Fixed wrong COD fee displaying on order info block when "Display Cod Fee" option
12
- is set to "Including Tax"</notes>
13
  <authors><author><name>Phoenix Medien</name><user>auto-converted</user><email>info@phoenix-medien.de</email></author></authors>
14
- <date>2010-12-28</date>
15
- <time>15:53:24</time>
16
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="cashondelivery.xml" hash="ebc981a800dabaae88d2756239cefe23"/></dir><dir name="template"><dir name="cashondelivery"><dir name="pdf"><file name="info.phtml" hash="b40f4cff0103aac523ef3699354d9eaf"/></dir><dir name="sales"><dir name="order"><dir name="create"><dir name="totals"><file name="cod.phtml" hash="7422de3104549c82730ce838ca1fe6ac"/></dir></dir></dir></dir><file name="form.phtml" hash="93353b0505440a40e58cdbe6eb21c1f3"/><file name="info.phtml" hash="fa71f954c15e6404ef29845910766811"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="cashondelivery.xml" hash="f36ebac7ddc1b545afc1b455f60ab32a"/></dir><dir name="template"><dir name="cashondelivery"><dir name="checkout"><file name="cod.phtml" hash="32f3b650a32f742cbe9e7393c241151c"/></dir><file name="form.phtml" hash="50dc6f9e3b64f86d3e13fa36521c3fd1"/><file name="info.phtml" hash="e4595a0b3161234b6f1998df7b668258"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Phoenix_CashOnDelivery.csv" hash="d03007b6a0ecdd299f4938005b270705"/></dir><dir name="el_GR"><file name="Phoenix_CashOnDelivery.csv" hash="707f2191bf6e6fcd7b416153dc67ff3c"/></dir><dir name="en_US"><file name="Phoenix_CashOnDelivery.csv" hash="cd2ec780c7269dc23eec86bd61405329"/></dir><dir name="pl_PL"><file name="Phoenix_CashOnDelivery.csv" hash="0645f849c401d9ec5a059f8cfaf50518"/></dir></target><target name="mageweb"><dir name="js"><dir name="phoenix"><dir name="cashondelivery"><file name="sales.js" hash="3d499a43715b0226ece4e795aeffc967"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_CashOnDelivery.xml" hash="e286992d6ecb97ba3d26a41ba1af79e1"/><file name="Phoenix_CashOnDelivery.xml" hash="399693025d037e98669e9495b5771a0b"/></dir></target><target name="magecommunity"><dir name="Phoenix"><dir name="CashOnDelivery"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Create"><dir name="Totals"><file name="Cod.php" hash="57b6ac50a1ab854e830c59f549418728"/></dir></dir><dir name="Creditmemo"><dir name="Totals"><file name="Cod.php" hash="519aadcd4036d02d46a42d38e2b20f24"/></dir></dir></dir></dir></dir><dir name="Checkout"><file name="Cod.php" hash="f086c179ff7e57fa8b90e0ddae279901"/></dir><dir name="Invoice"><dir name="Totals"><file name="Cod.php" hash="7c09dc9969f4b8a775f45978619a4789"/></dir></dir><dir name="Order"><dir name="Totals"><file name="Cod.php" hash="8682a4dc107a8c9c2ec82f521def3e3d"/></dir></dir><file name="Form.php" hash="98db85c8cd1c61518e916ae8b009d4b4"/><file name="Info.php" hash="2e179e95f534db2a2ba4474d8ff36710"/></dir><dir name="etc"><file name="config.xml" hash="49baf087a4bfe743b0b2db4e82a87934"/><file name="system.xml" hash="06688dc2945813fc4e796f037de7617b"/></dir><dir name="Helper"><file name="Data.php" hash="62821c4614045998d03c7e167cab6e0c"/></dir><dir name="Model"><dir name="Creditmemo"><file name="Total.php" hash="1d1606f8730d37136e4f5824d7561986"/></dir><dir name="Invoice"><file name="Tax.php" hash="6dabfceef13cb28937eba62e62044796"/><file name="Total.php" hash="3de53861c195c311615537eadcefd5dd"/></dir><dir name="Quote"><file name="TaxTotal.php" hash="b16472223336a13d6a65208a24ad108e"/><file name="Total.php" hash="fe214ba546ded26725618c3eabd1c3ff"/></dir><dir name="Sales"><dir name="Pdf"><file name="Cod.php" hash="259719c22d34e0a21c439d2d1b56e787"/></dir></dir><dir name="Source"><file name="AvailableShipmentMethods.php" hash="2959c8ac25cd736b4c3c12eb67ed39d2"/></dir><file name="CashOnDelivery.php" hash="efd189f4b7f2a6dfb6d2b551d5870911"/><file name="Observer.php" hash="a94ab8c10c4360c005b72a948ba14964"/></dir><dir name="sql"><dir name="cashondelivery_setup"><file name="mysql4-install-0.2.0.php" hash="d463e6ab6241dbc43486755a49efffa2"/><file name="mysql4-upgrade-0.2.0-0.2.1.php" hash="4dc5e368cc4e123e56a20a3ff66288c1"/><file name="mysql4-upgrade-0.3.2-0.3.3.php" hash="10f0c3c3c4941e3b1dab19270a24d5cf"/><file name="mysql4-upgrade-0.4.6-0.4.7.php" hash="22b07cb1ada2c86de4777f859f73ed85"/></dir></dir></dir></dir></target></contents>
17
  <compatible/>
18
  <dependencies/>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>CashOnDelivery</name>
4
+ <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Cash on Delivery allows to book additional fee on delivery depending on inland or international delivery.</summary>
10
  <description>Cash on Delivery allows to book additional fee on delivery depending on inland or international delivery.</description>
11
+ <notes>- Fixed missing COD Tax Fee for invoices containing configurable products</notes>
 
12
  <authors><author><name>Phoenix Medien</name><user>auto-converted</user><email>info@phoenix-medien.de</email></author></authors>
13
+ <date>2011-04-14</date>
14
+ <time>16:18:57</time>
15
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="cashondelivery.xml" hash="ebc981a800dabaae88d2756239cefe23"/></dir><dir name="template"><dir name="cashondelivery"><dir name="pdf"><file name="info.phtml" hash="b40f4cff0103aac523ef3699354d9eaf"/></dir><dir name="sales"><dir name="order"><dir name="create"><dir name="totals"><file name="cod.phtml" hash="7422de3104549c82730ce838ca1fe6ac"/></dir></dir></dir></dir><file name="form.phtml" hash="93353b0505440a40e58cdbe6eb21c1f3"/><file name="info.phtml" hash="fa71f954c15e6404ef29845910766811"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="cashondelivery.xml" hash="f36ebac7ddc1b545afc1b455f60ab32a"/></dir><dir name="template"><dir name="cashondelivery"><dir name="checkout"><file name="cod.phtml" hash="32f3b650a32f742cbe9e7393c241151c"/></dir><file name="form.phtml" hash="50dc6f9e3b64f86d3e13fa36521c3fd1"/><file name="info.phtml" hash="e4595a0b3161234b6f1998df7b668258"/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Phoenix_CashOnDelivery.csv" hash="d03007b6a0ecdd299f4938005b270705"/></dir><dir name="el_GR"><file name="Phoenix_CashOnDelivery.csv" hash="707f2191bf6e6fcd7b416153dc67ff3c"/></dir><dir name="en_US"><file name="Phoenix_CashOnDelivery.csv" hash="cd2ec780c7269dc23eec86bd61405329"/></dir><dir name="pl_PL"><file name="Phoenix_CashOnDelivery.csv" hash="0645f849c401d9ec5a059f8cfaf50518"/></dir></target><target name="mageweb"><dir name="js"><dir name="phoenix"><dir name="cashondelivery"><file name="sales.js" hash="3d499a43715b0226ece4e795aeffc967"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_CashOnDelivery.xml" hash="e286992d6ecb97ba3d26a41ba1af79e1"/><file name="Phoenix_CashOnDelivery.xml" hash="399693025d037e98669e9495b5771a0b"/></dir></target><target name="magecommunity"><dir name="Phoenix"><dir name="CashOnDelivery"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Create"><dir name="Totals"><file name="Cod.php" hash="57b6ac50a1ab854e830c59f549418728"/></dir></dir><dir name="Creditmemo"><dir name="Totals"><file name="Cod.php" hash="519aadcd4036d02d46a42d38e2b20f24"/></dir></dir></dir></dir></dir><dir name="Checkout"><file name="Cod.php" hash="f086c179ff7e57fa8b90e0ddae279901"/></dir><dir name="Invoice"><dir name="Totals"><file name="Cod.php" hash="7c09dc9969f4b8a775f45978619a4789"/></dir></dir><dir name="Order"><dir name="Totals"><file name="Cod.php" hash="8682a4dc107a8c9c2ec82f521def3e3d"/></dir></dir><file name="Form.php" hash="98db85c8cd1c61518e916ae8b009d4b4"/><file name="Info.php" hash="2e179e95f534db2a2ba4474d8ff36710"/></dir><dir name="etc"><file name="config.xml" hash="15752a0dd0d7e6fb7e11fc97676bfcc4"/><file name="system.xml" hash="06688dc2945813fc4e796f037de7617b"/></dir><dir name="Helper"><file name="Data.php" hash="62821c4614045998d03c7e167cab6e0c"/></dir><dir name="Model"><dir name="Creditmemo"><file name="Total.php" hash="1d1606f8730d37136e4f5824d7561986"/></dir><dir name="Invoice"><file name="Tax.php" hash="e472d859623f7de7829aa2579cc54462"/><file name="Total.php" hash="3de53861c195c311615537eadcefd5dd"/></dir><dir name="Quote"><file name="TaxTotal.php" hash="b16472223336a13d6a65208a24ad108e"/><file name="Total.php" hash="fe214ba546ded26725618c3eabd1c3ff"/></dir><dir name="Sales"><dir name="Pdf"><file name="Cod.php" hash="259719c22d34e0a21c439d2d1b56e787"/></dir></dir><dir name="Source"><file name="AvailableShipmentMethods.php" hash="2959c8ac25cd736b4c3c12eb67ed39d2"/></dir><file name="CashOnDelivery.php" hash="efd189f4b7f2a6dfb6d2b551d5870911"/><file name="Observer.php" hash="a94ab8c10c4360c005b72a948ba14964"/></dir><dir name="sql"><dir name="cashondelivery_setup"><file name="mysql4-install-0.2.0.php" hash="d463e6ab6241dbc43486755a49efffa2"/><file name="mysql4-upgrade-0.2.0-0.2.1.php" hash="4dc5e368cc4e123e56a20a3ff66288c1"/><file name="mysql4-upgrade-0.3.2-0.3.3.php" hash="10f0c3c3c4941e3b1dab19270a24d5cf"/><file name="mysql4-upgrade-0.4.6-0.4.7.php" hash="22b07cb1ada2c86de4777f859f73ed85"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>