SSTech_Extracharge - Version 1.0.0

Version Notes

Release version 1.0.0

Download this release

Release Info

Developer SSTech
Extension SSTech_Extracharge
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (22) hide show
  1. app/code/community/SSTech/Extracharge/Block/Sales/Order/Total.php +65 -0
  2. app/code/community/SSTech/Extracharge/Helper/Data.php +8 -0
  3. app/code/community/SSTech/Extracharge/Model/Extracharge.php +17 -0
  4. app/code/community/SSTech/Extracharge/Model/Observer.php +28 -0
  5. app/code/community/SSTech/Extracharge/Model/Sales/Order/Total/Creditmemo/Extracharge.php +17 -0
  6. app/code/community/SSTech/Extracharge/Model/Sales/Order/Total/Invoice/Extracharge.php +24 -0
  7. app/code/community/SSTech/Extracharge/Model/Sales/Quote/Address/Total/Extracharge.php +49 -0
  8. app/code/community/SSTech/Extracharge/etc/adminhtml.xml +49 -0
  9. app/code/community/SSTech/Extracharge/etc/config.xml +172 -0
  10. app/code/community/SSTech/Extracharge/etc/system.xml +86 -0
  11. app/code/community/SSTech/Extracharge/sql/extracharge_setup/mysql4-install-0.1.0.php +14 -0
  12. app/code/community/SSTech/Extracharge/sql/extracharge_setup/mysql4-upgrade-0.1.0-0.1.1.php +14 -0
  13. app/code/community/SSTech/Extracharge/sql/extracharge_setup/mysql4-upgrade-0.1.1-0.1.2.php +14 -0
  14. app/code/community/SSTech/Extracharge/sql/extracharge_setup/mysql4-upgrade-0.1.2-0.1.3.php +14 -0
  15. app/code/community/SSTech/Extracharge/sql/extracharge_setup/mysql4-upgrade-0.1.3-0.1.4.php +17 -0
  16. app/design/adminhtml/default/default/layout/extracharge.xml +56 -0
  17. app/design/adminhtml/default/default/template/extracharge/sales/order/refunded.phtml +16 -0
  18. app/design/adminhtml/default/default/template/extracharge/sales/order/total.phtml +9 -0
  19. app/design/frontend/base/default/layout/extracharge.xml +51 -0
  20. app/design/frontend/base/default/template/extracharge/extracharge.phtml +5 -0
  21. app/etc/modules/SSTech_Extracharge.xml +9 -0
  22. package.xml +18 -0
app/code/community/SSTech/Extracharge/Block/Sales/Order/Total.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class SSTech_Extracharge_Block_Sales_Order_Total extends Mage_Core_Block_Template
3
+ {
4
+ /**
5
+ * Get label cell tag properties
6
+ *
7
+ * @return string
8
+ */
9
+ public function getLabelProperties()
10
+ {
11
+ return $this->getParentBlock()->getLabelProperties();
12
+ }
13
+
14
+ /**
15
+ * Get order store object
16
+ *
17
+ * @return Mage_Sales_Model_Order
18
+ */
19
+ public function getOrder()
20
+ {
21
+ return $this->getParentBlock()->getOrder();
22
+ }
23
+
24
+ /**
25
+ * Get totals source object
26
+ *
27
+ * @return Mage_Sales_Model_Order
28
+ */
29
+ public function getSource()
30
+ {
31
+ return $this->getParentBlock()->getSource();
32
+ }
33
+
34
+ /**
35
+ * Get value cell tag properties
36
+ *
37
+ * @return string
38
+ */
39
+ public function getValueProperties()
40
+ {
41
+ return $this->getParentBlock()->getValueProperties();
42
+ }
43
+
44
+ /**
45
+ * Initialize reward points totals
46
+ *
47
+ * @return Enterprise_Reward_Block_Sales_Order_Total
48
+ */
49
+ public function initTotals()
50
+ {
51
+ if ((float) $this->getOrder()->getBaseExtrachargeAmount()) {
52
+ $source = $this->getSource();
53
+ $value = $source->getExtrachargeAmount();
54
+
55
+ $this->getParentBlock()->addTotal(new Varien_Object(array(
56
+ 'code' => 'extracharge',
57
+ 'strong' => false,
58
+ 'label' => Mage::helper('extracharge')->formatExtracharge($value),
59
+ 'value' => $source instanceof Mage_Sales_Model_Order_Creditmemo ? - $value : $value
60
+ )));
61
+ }
62
+
63
+ return $this;
64
+ }
65
+ }
app/code/community/SSTech/Extracharge/Helper/Data.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SSTech_Extracharge_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ public function formatExtracharge($amount){
6
+ return Mage::helper('extracharge')->__('Extracharge');
7
+ }
8
+ }
app/code/community/SSTech/Extracharge/Model/Extracharge.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class SSTech_Extracharge_Model_Extracharge extends Varien_Object{
3
+ const FEE_AMOUNT = 'extracharge/extracharge/extracharge';
4
+ const XML_PATH_ENABLED = "extracharge/extracharge/enabled";
5
+
6
+ public static function getExtracharge(){
7
+ if(Mage::getStoreConfigFlag(self::XML_PATH_ENABLED)){
8
+ $extracharge = Mage::getStoreConfig(self::FEE_AMOUNT);
9
+ return $extracharge;
10
+ }
11
+ }
12
+ public static function canApply($address){
13
+
14
+ return true;
15
+
16
+ }
17
+ }
app/code/community/SSTech/Extracharge/Model/Observer.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class SSTech_Extracharge_Model_Observer{
3
+ public function invoiceSaveAfter(Varien_Event_Observer $observer)
4
+ {
5
+ $invoice = $observer->getEvent()->getInvoice();
6
+ if ($invoice->getBaseExtrachargeAmount()) {
7
+ $order = $invoice->getOrder();
8
+ $order->setExtrachargeAmountInvoiced($order->getExtrachargeAmountInvoiced() + $invoice->getExtrachargeAmount());
9
+ $order->setBaseExtrachargeAmountInvoiced($order->getBaseExtrachargeAmountInvoiced() + $invoice->getBaseExtrachargeAmount());
10
+ }
11
+ return $this;
12
+ }
13
+ public function creditmemoSaveAfter(Varien_Event_Observer $observer)
14
+ {
15
+
16
+ $creditmemo = $observer->getEvent()->getCreditmemo();
17
+ if ($creditmemo->getExtrachargeAmount()) {
18
+ $order = $creditmemo->getOrder();
19
+ $order->setExtrachargeAmountRefunded($order->getExtrachargeAmountRefunded() + $creditmemo->getExtrachargeAmount());
20
+ $order->setBaseExtrachargeAmountRefunded($order->getBaseExtrachargeAmountRefunded() + $creditmemo->getBaseExtrachargeAmount());
21
+ }
22
+ return $this;
23
+ }
24
+ public function updatePaypalTotal($evt){
25
+ $cart = $evt->getPaypalCart();
26
+ $cart->updateTotal(Mage_Paypal_Model_Cart::TOTAL_SUBTOTAL,$cart->getSalesEntity()->getExtrachargeAmount());
27
+ }
28
+ }
app/code/community/SSTech/Extracharge/Model/Sales/Order/Total/Creditmemo/Extracharge.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class SSTech_Extracharge_Model_Sales_Order_Total_Creditmemo_Extracharge extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
3
+ {
4
+ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
5
+ {
6
+ $order = $creditmemo->getOrder();
7
+ $extrachargeAmountLeft = $order->getExtrachargeAmountInvoiced() - $order->getExtrachargeAmountRefunded();
8
+ $baseextrachargeAmountLeft = $order->getBaseExtrachargeAmountInvoiced() - $order->getBaseExtrachargeAmountRefunded();
9
+ if ($baseextrachargeAmountLeft > 0) {
10
+ $creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $extrachargeAmountLeft);
11
+ $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $baseextrachargeAmountLeft);
12
+ $creditmemo->setExtrachargeAmount($extrachargeAmountLeft);
13
+ $creditmemo->setBaseExtrachargeAmount($baseextrachargeAmountLeft);
14
+ }
15
+ return $this;
16
+ }
17
+ }
app/code/community/SSTech/Extracharge/Model/Sales/Order/Total/Invoice/Extracharge.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class SSTech_Extracharge_Model_Sales_Order_Total_Invoice_Extracharge extends Mage_Sales_Model_Order_Invoice_Total_Abstract
3
+ {
4
+ public function collect(Mage_Sales_Model_Order_Invoice $invoice)
5
+ {
6
+ $order = $invoice->getOrder();
7
+ $extrachargeAmountLeft = $order->getExtrachargeAmount() - $order->getExtrachargeAmountInvoiced();
8
+ $baseExtrachargeAmountLeft = $order->getBaseExtrachargeAmount() - $order->getBaseExtrachargeAmountInvoiced();
9
+ if (abs($baseExtrachargeAmountLeft) < $invoice->getBaseGrandTotal()) {
10
+ $invoice->setGrandTotal($invoice->getGrandTotal() + $extrachargeAmountLeft);
11
+ $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseExtrachargeAmountLeft);
12
+ } else {
13
+ $extrachargeAmountLeft = $invoice->getGrandTotal() * -1;
14
+ $baseExtrachargeAmountLeft = $invoice->getBaseGrandTotal() * -1;
15
+
16
+ $invoice->setGrandTotal(0);
17
+ $invoice->setBaseGrandTotal(0);
18
+ }
19
+
20
+ $invoice->setExtrachargeAmount($extrachargeAmountLeft);
21
+ $invoice->setBaseExtrachargeAmount($baseExtrachargeAmountLeft);
22
+ return $this;
23
+ }
24
+ }
app/code/community/SSTech/Extracharge/Model/Sales/Quote/Address/Total/Extracharge.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class SSTech_Extracharge_Model_Sales_Quote_Address_Total_Extracharge extends Mage_Sales_Model_Quote_Address_Total_Abstract{
3
+ protected $_code = 'extracharge';
4
+ const ADD_TITLE = 'extracharge/extracharge/addtitle';
5
+
6
+ public function collect(Mage_Sales_Model_Quote_Address $address)
7
+ {
8
+ parent::collect($address);
9
+
10
+ $this->_setAmount(0);
11
+ $this->_setBaseAmount(0);
12
+
13
+ $items = $this->_getAddressItems($address);
14
+ if (!count($items)) {
15
+ return $this; //this makes only address type shipping to come through
16
+ }
17
+
18
+
19
+ $quote = $address->getQuote();
20
+
21
+ if(SSTech_Extracharge_Model_Extracharge::canApply($address)){
22
+ $exist_amount = $quote->getExtrachargeAmount();
23
+ $extracharge = SSTech_Extracharge_Model_Extracharge::getExtracharge();
24
+ $balance = $extracharge - $exist_amount;
25
+
26
+ $address->setExtrachargeAmount($balance);
27
+ $address->setBaseExtrachargeAmount($balance);
28
+
29
+ $quote->setExtrachargeAmount($balance);
30
+
31
+ $address->setGrandTotal($address->getGrandTotal() + $address->getExtrachargeAmount());
32
+ $address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseExtrachargeAmount());
33
+ }
34
+ }
35
+
36
+ public function fetch(Mage_Sales_Model_Quote_Address $address)
37
+ {
38
+ $addtitle = Mage::getStoreConfig(self::ADD_TITLE);
39
+ $amt = $address->getExtrachargeAmount();
40
+ if($amt > 0){
41
+ $address->addTotal(array(
42
+ 'code'=>$this->getCode(),
43
+ 'title'=>$addtitle,
44
+ 'value'=> $amt
45
+ ));
46
+ }
47
+ return $this;
48
+ }
49
+ }
app/code/community/SSTech/Extracharge/etc/adminhtml.xml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-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
+ * @category Mage
23
+ * @package Mage_Contacts
24
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <acl>
30
+ <resources>
31
+ <admin>
32
+ <children>
33
+ <system>
34
+ <children>
35
+ <config>
36
+ <children>
37
+ <extracharge translate="title" module="extracharge">
38
+ <title>Extracharge Section</title>
39
+ <sort_order>0</sort_order>
40
+ </extracharge>
41
+ </children>
42
+ </config>
43
+ </children>
44
+ </system>
45
+ </children>
46
+ </admin>
47
+ </resources>
48
+ </acl>
49
+ </config>
app/code/community/SSTech/Extracharge/etc/config.xml ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <SSTech_Extracharge>
5
+ <version>0.1.4</version>
6
+ </SSTech_Extracharge>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <extracharge>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>SSTech_Extracharge</module>
14
+ <frontName>extracharge</frontName>
15
+ </args>
16
+ </extracharge>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <extracharge>
21
+ <file>extracharge.xml</file>
22
+ </extracharge>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <admin>
27
+ <routers>
28
+ <extracharge>
29
+ <use>admin</use>
30
+ <args>
31
+ <module>SSTech_Extracharge</module>
32
+ <frontName>extracharge</frontName>
33
+ </args>
34
+ </extracharge>
35
+ </routers>
36
+ </admin>
37
+ <adminhtml>
38
+ <layout>
39
+ <updates>
40
+ <extracharge>
41
+ <file>extracharge.xml</file>
42
+ </extracharge>
43
+ </updates>
44
+ </layout>
45
+ </adminhtml>
46
+ <global>
47
+ <sales>
48
+ <quote>
49
+ <totals>
50
+ <extracharge>
51
+ <class>extracharge/sales_quote_address_total_extracharge</class>
52
+ <!-- <renderer>extracharge/checkout_total</renderer> -->
53
+ </extracharge>
54
+ </totals>
55
+ </quote>
56
+ <order_invoice>
57
+ <totals>
58
+ <extracharge>
59
+ <class>extracharge/sales_order_total_invoice_extracharge</class>
60
+ </extracharge>
61
+ </totals>
62
+ </order_invoice>
63
+ <order_creditmemo>
64
+ <totals>
65
+ <extracharge>
66
+ <class>extracharge/sales_order_total_creditmemo_extracharge</class>
67
+ </extracharge>
68
+ </totals>
69
+ </order_creditmemo>
70
+ </sales>
71
+ <events>
72
+ <paypal_prepare_line_items>
73
+ <observers>
74
+ <paypal_prepare_line_items>
75
+ <class>extracharge/observer</class>
76
+ <method>updatePaypalTotal</method>
77
+ </paypal_prepare_line_items>
78
+ </observers>
79
+ </paypal_prepare_line_items>
80
+ <sales_order_invoice_save_after>
81
+ <observers>
82
+ <sales_order_invoice_save_after>
83
+ <class>extracharge/observer</class>
84
+ <method>invoiceSaveAfter</method>
85
+ </sales_order_invoice_save_after>
86
+ </observers>
87
+ </sales_order_invoice_save_after>
88
+ <sales_order_creditmemo_save_after>
89
+ <observers>
90
+ <sales_order_creditmemo_save_after>
91
+ <class>extracharge/observer</class>
92
+ <method>creditmemoSaveAfter</method>
93
+ </sales_order_creditmemo_save_after>
94
+ </observers>
95
+ </sales_order_creditmemo_save_after>
96
+ </events>
97
+ <fieldsets>
98
+ <sales_convert_quote_address>
99
+ <extracharge_amount><to_order>*</to_order></extracharge_amount>
100
+ <base_extracharge_amount><to_order>*</to_order></base_extracharge_amount>
101
+ </sales_convert_quote_address>
102
+ </fieldsets>
103
+ <pdf>
104
+ <totals>
105
+ <extracharge translate="title">
106
+ <title>Extracharge</title>
107
+ <source_field>extracharge_amount</source_field>
108
+ <font_size>7</font_size>
109
+ <display_zero>0</display_zero>
110
+ <sort_order>650</sort_order>
111
+ <amount_prefix>-</amount_prefix>
112
+ </extracharge>
113
+ </totals>
114
+ </pdf>
115
+ <models>
116
+ <extracharge>
117
+ <class>SSTech_Extracharge_Model</class>
118
+ <resourceModel>extracharge_mysql4</resourceModel>
119
+ </extracharge>
120
+ <extracharge_mysql4>
121
+ <class>SSTech_Extracharge_Model_Mysql4</class>
122
+ <entities>
123
+ <extracharge>
124
+ <table>extracharge</table>
125
+ </extracharge>
126
+ </entities>
127
+ </extracharge_mysql4>
128
+ </models>
129
+ <resources>
130
+ <extracharge_setup>
131
+ <setup>
132
+ <module>SSTech_Extracharge</module>
133
+ </setup>
134
+ <connection>
135
+ <use>core_setup</use>
136
+ </connection>
137
+ </extracharge_setup>
138
+ <extracharge_write>
139
+ <connection>
140
+ <use>core_write</use>
141
+ </connection>
142
+ </extracharge_write>
143
+ <extracharge_read>
144
+ <connection>
145
+ <use>core_read</use>
146
+ </connection>
147
+ </extracharge_read>
148
+ </resources>
149
+ <blocks>
150
+ <extracharge>
151
+ <class>SSTech_Extracharge_Block</class>
152
+ </extracharge>
153
+ </blocks>
154
+ <helpers>
155
+ <extracharge>
156
+ <class>SSTech_Extracharge_Helper</class>
157
+ </extracharge>
158
+ </helpers>
159
+ </global>
160
+ <default>
161
+ <!-- <sales>
162
+ <totals_sort>
163
+ <extracharge>15</extracharge>
164
+ </totals_sort>
165
+ </sales> -->
166
+ <!-- <extracharge>
167
+ <extracharge>
168
+ <addtitle><![CDATA[Extra Charge]]></addtitle>
169
+ </extracharge>
170
+ </extracharge> -->
171
+ </default>
172
+ </config>
app/code/community/SSTech/Extracharge/etc/system.xml ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-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
+ * @category Mage
23
+ * @package Mage_Contacts
24
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+ -->
28
+ <config>
29
+ <tabs>
30
+ <extracharge translate="label" module="extracharge">
31
+ <label>SStech</label>
32
+ <sort_order>0</sort_order>
33
+ </extracharge>
34
+ </tabs>
35
+ <sections>
36
+ <extracharge translate="label" module="extracharge">
37
+ <label>Extra Charges</label>
38
+ <tab>extracharge</tab>
39
+ <frontend_type>text</frontend_type>
40
+ <sort_order>0</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ <groups>
45
+ <extracharge translate="label">
46
+ <label>Extra Charges</label>
47
+ <frontend_type>text</frontend_type>
48
+ <sort_order>0</sort_order>
49
+ <show_in_default>1</show_in_default>
50
+ <show_in_website>1</show_in_website>
51
+ <show_in_store>1</show_in_store>
52
+ <fields>
53
+ <enabled translate="label">
54
+ <label>Enable Extra Charges Us</label>
55
+ <frontend_type>select</frontend_type>
56
+ <source_model>adminhtml/system_config_source_yesno</source_model>
57
+ <backend_model>contacts/system_config_backend_links</backend_model>
58
+ <sort_order>10</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ </enabled>
63
+ <extracharge translate="label">
64
+ <label>Add Extra Charges </label>
65
+ <comment>add charge amount</comment>
66
+ <frontend_type>text</frontend_type>
67
+ <sort_order>0</sort_order>
68
+ <show_in_default>1</show_in_default>
69
+ <show_in_website>1</show_in_website>
70
+ <show_in_store>1</show_in_store>
71
+ </extracharge>
72
+ <addtitle translate="label">
73
+ <label>Add Your Own Title </label>
74
+ <comment>add your own Label which will show at all end</comment>
75
+ <frontend_type>text</frontend_type>
76
+ <sort_order>0</sort_order>
77
+ <show_in_default>1</show_in_default>
78
+ <show_in_website>1</show_in_website>
79
+ <show_in_store>1</show_in_store>
80
+ </addtitle>
81
+ </fields>
82
+ </extracharge>
83
+ </groups>
84
+ </extracharge>
85
+ </sections>
86
+ </config>
app/code/community/SSTech/Extracharge/sql/extracharge_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ ALTER TABLE `".$this->getTable('sales/order')."` ADD `extracharge_amount` DECIMAL( 10, 2 ) NOT NULL;
10
+ ALTER TABLE `".$this->getTable('sales/order')."` ADD `base_extracharge_amount` DECIMAL( 10, 2 ) NOT NULL;
11
+
12
+ ");
13
+
14
+ $installer->endSetup();
app/code/community/SSTech/Extracharge/sql/extracharge_setup/mysql4-upgrade-0.1.0-0.1.1.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ ALTER TABLE `".$this->getTable('sales/quote_address')."` ADD `extracharge_amount` DECIMAL( 10, 2 ) NOT NULL;
10
+ ALTER TABLE `".$this->getTable('sales/quote_address')."` ADD `base_extracharge_amount` DECIMAL( 10, 2 ) NOT NULL;
11
+
12
+ ");
13
+
14
+ $installer->endSetup();
app/code/community/SSTech/Extracharge/sql/extracharge_setup/mysql4-upgrade-0.1.1-0.1.2.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ ALTER TABLE `".$this->getTable('sales/order')."` ADD `extracharge_amount_invoiced` DECIMAL( 10, 2 ) NOT NULL;
10
+ ALTER TABLE `".$this->getTable('sales/order')."` ADD `base_extracharge_amount_invoiced` DECIMAL( 10, 2 ) NOT NULL;
11
+
12
+ ");
13
+
14
+ $installer->endSetup();
app/code/community/SSTech/Extracharge/sql/extracharge_setup/mysql4-upgrade-0.1.2-0.1.3.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ ALTER TABLE `".$this->getTable('sales/invoice')."` ADD `extracharge_amount` DECIMAL( 10, 2 ) NOT NULL;
10
+ ALTER TABLE `".$this->getTable('sales/invoice')."` ADD `base_extracharge_amount` DECIMAL( 10, 2 ) NOT NULL;
11
+
12
+ ");
13
+
14
+ $installer->endSetup();
app/code/community/SSTech/Extracharge/sql/extracharge_setup/mysql4-upgrade-0.1.3-0.1.4.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ ALTER TABLE `".$this->getTable('sales/order')."` ADD `extracharge_amount_refunded` DECIMAL( 10, 2 ) NOT NULL;
10
+ ALTER TABLE `".$this->getTable('sales/order')."` ADD `base_extracharge_amount_refunded` DECIMAL( 10, 2 ) NOT NULL;
11
+
12
+ ALTER TABLE `".$this->getTable('sales/creditmemo')."` ADD `extracharge_amount` DECIMAL( 10, 2 ) NOT NULL;
13
+ ALTER TABLE `".$this->getTable('sales/creditmemo')."` ADD `base_extracharge_amount` DECIMAL( 10, 2 ) NOT NULL;
14
+
15
+ ");
16
+
17
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/extracharge.xml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <adminhtml_sales_order_view>
4
+ <reference name="order_totals">
5
+ <block type="adminhtml/sales_order_totals_item" name="extracharge" template="extracharge/sales/order/total.phtml">
6
+ </block>
7
+ <block type="adminhtml/sales_order_totals_item" name="extracharge.refunded" template="extracharge/sales/order/refunded.phtml">
8
+ <action method="setDisplayArea"><area>footer</area></action>
9
+ <action method="setAfterCondition"><condition>last</condition></action>
10
+ </block>
11
+ </reference>
12
+ </adminhtml_sales_order_view>
13
+
14
+ <adminhtml_sales_order_invoice_new>
15
+ <reference name="invoice_totals">
16
+ <block type="adminhtml/sales_order_totals_item" name="extracharge" template="extracharge/sales/order/total.phtml">
17
+ </block>
18
+ </reference>
19
+ </adminhtml_sales_order_invoice_new>
20
+
21
+ <adminhtml_sales_order_invoice_updateqty>
22
+ <reference name="invoice_totals">
23
+ <block type="adminhtml/sales_order_totals_item" name="extracharge" template="extracharge/sales/order/total.phtml">
24
+ </block>
25
+ </reference>
26
+ </adminhtml_sales_order_invoice_updateqty>
27
+
28
+ <adminhtml_sales_order_invoice_view>
29
+ <reference name="invoice_totals">
30
+ <block type="adminhtml/sales_order_totals_item" name="extracharge" template="extracharge/sales/order/total.phtml">
31
+ </block>
32
+ </reference>
33
+ </adminhtml_sales_order_invoice_view>
34
+
35
+ <adminhtml_sales_order_creditmemo_new>
36
+ <reference name="creditmemo_totals">
37
+ <block type="adminhtml/sales_order_totals_item" name="extracharge" template="extracharge/sales/order/total.phtml">
38
+ </block>
39
+ </reference>
40
+ </adminhtml_sales_order_creditmemo_new>
41
+
42
+ <adminhtml_sales_order_creditmemo_updateqty>
43
+ <reference name="creditmemo_totals">
44
+ <block type="adminhtml/sales_order_totals_item" name="extracharge" template="extracharge/sales/order/total.phtml">
45
+ </block>
46
+ </reference>
47
+ </adminhtml_sales_order_creditmemo_updateqty>
48
+
49
+ <adminhtml_sales_order_creditmemo_view>
50
+ <reference name="creditmemo_totals">
51
+ <block type="adminhtml/sales_order_totals_item" name="extracharge.refunded" template="extracharge/sales/order/refunded.phtml">
52
+ <action method="setDisplayArea"><area>footer</area></action>
53
+ </block>
54
+ </reference>
55
+ </adminhtml_sales_order_creditmemo_view>
56
+ </layout>
app/design/adminhtml/default/default/template/extracharge/sales/order/refunded.phtml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if($this->getSource() instanceof Mage_Sales_Model_Order){ ?>
2
+ <?php if ((float) $this->getSource()->getExtrachargeAmountRefunded()): ?>
3
+ <tr>
4
+ <td class="label"><strong><?php echo Mage::helper('extracharge')->__('Extracharge refunded to customer') ?></strong></td>
5
+ <td><strong><?php echo $this->getSource()->getExtrachargeAmountRefunded(); ?></strong></td>
6
+ </tr>
7
+ <?php endif; ?>
8
+ <?php } else { ?>
9
+ <?php if ((float) $this->getSource()->getExtrachargeAmount()): ?>
10
+ <tr>
11
+ <td class="label"><strong><?php echo Mage::helper('extracharge')->__('Extracharge Refunded') ?></strong></td>
12
+ <td><strong><?php echo $this->getSource()->getExtrachargeAmount(); ?></strong></td>
13
+ </tr>
14
+ <?php endif;
15
+ }?>
16
+
app/design/adminhtml/default/default/template/extracharge/sales/order/total.phtml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php $this->setPriceDataObject($this->getSource()) ?>
2
+ <?php if ((float) $this->getSource()->getExtrachargeAmount()): ?>
3
+ <tr>
4
+ <td class="label"><?php echo Mage::helper('extracharge')->formatExtracharge($this->getSource()->getExtrachargeAmount()) ?></td>
5
+ <td>
6
+ <?php echo $this->displayPrices($this->getSource()->getBaseExtrachargeAmount(), $this->getSource()->getExtrachargeAmount()); ?>
7
+ </td>
8
+ </tr>
9
+ <?php endif; ?>
app/design/frontend/base/default/layout/extracharge.xml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?xml version="1.0"?>
3
+ <layout version="0.1.0">
4
+ <sales_order_view>
5
+ <reference name="order_totals">
6
+ <block type="extracharge/sales_order_total" name="extracharge.sales.order.total" />
7
+ </reference>
8
+ </sales_order_view>
9
+ <sales_order_print>
10
+ <reference name="order_totals">
11
+ <block type="extracharge/sales_order_total" name="extracharge.sales.order.total" />
12
+ </reference>
13
+ </sales_order_print>
14
+ <sales_email_order_items>
15
+ <reference name="order_totals">
16
+ <block type="extracharge/sales_order_total" name="extracharge.sales.order.total" />
17
+ </reference>
18
+ </sales_email_order_items>
19
+
20
+ <sales_order_invoice>
21
+ <reference name="invoice_totals">
22
+ <block type="extracharge/sales_order_total" name="extracharge.sales.order.total" />
23
+ </reference>
24
+ </sales_order_invoice>
25
+ <sales_order_printinvoice>
26
+ <reference name="invoice_totals">
27
+ <block type="extracharge/sales_order_total" name="extracharge.sales.order.total" />
28
+ </reference>
29
+ </sales_order_printinvoice>
30
+ <sales_email_order_invoice_items>
31
+ <reference name="invoice_totals">
32
+ <block type="extracharge/sales_order_total" name="extracharge.sales.order.total" />
33
+ </reference>
34
+ </sales_email_order_invoice_items>
35
+
36
+ <sales_order_creditmemo>
37
+ <reference name="creditmemo_totals">
38
+ <block type="extracharge/sales_order_total" name="extracharge.sales.order.total" />
39
+ </reference>
40
+ </sales_order_creditmemo>
41
+ <sales_order_printcreditmemo>
42
+ <reference name="creditmemo_totals">
43
+ <block type="extracharge/sales_order_total" name="extracharge.sales.order.total" />
44
+ </reference>
45
+ </sales_order_printcreditmemo>
46
+ <sales_email_order_creditmemo_items>
47
+ <reference name="creditmemo_totals">
48
+ <block type="extracharge/sales_order_total" name="extracharge.sales.order.total" />
49
+ </reference>
50
+ </sales_email_order_creditmemo_items>
51
+ </layout>
app/design/frontend/base/default/template/extracharge/extracharge.phtml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <!--Code added to call the Template File -->
2
+ <h4><?php echo $this->__('Module List') ?></h4>
3
+
4
+
5
+
app/etc/modules/SSTech_Extracharge.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <SSTech_Extracharge>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </SSTech_Extracharge>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>SSTech_Extracharge</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This Extension will help Client to add Extra Charges in Total based on the policy </summary>
10
+ <description>Module will help to add Extra Charges based on the Policy based on the Client website </description>
11
+ <notes>Release version 1.0.0</notes>
12
+ <authors><author><name>SSTech</name><user>SSTech</user><email>sandynareshg@gmail.com</email></author></authors>
13
+ <date>2014-03-22</date>
14
+ <time>09:55:54</time>
15
+ <contents><target name="magecommunity"><dir name="SSTech"><dir name="Extracharge"><dir name="Block"><dir name="Sales"><dir name="Order"><file name="Total.php" hash="6d65d73a014cea17ea5e68535b7524ad"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="7e6c35b697d30f1e58feac0bc0ae0166"/></dir><dir name="Model"><file name="Extracharge.php" hash="129f1be306dd1bd36ca6fe3cf215822c"/><file name="Observer.php" hash="37aae100a4e0a852a48e1c4e93c74965"/><dir name="Sales"><dir name="Order"><dir name="Total"><dir name="Creditmemo"><file name="Extracharge.php" hash="f8c73ea73fac067a2f91320753d4d809"/></dir><dir name="Invoice"><file name="Extracharge.php" hash="a09935c8d785c6666aaccb94b27dfc5c"/></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Extracharge.php" hash="0f9e87ea55c554b63f1a0ec04bcc2c8c"/></dir></dir></dir></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="432c7a8d523f89c251c61d2d307a8784"/><file name="config.xml" hash="661a1493de84ea4f83735db184d19db4"/><file name="system.xml" hash="d883699bd75298fcf616d487bf6ff608"/></dir><dir name="sql"><dir name="extracharge_setup"><file name="mysql4-install-0.1.0.php" hash="e46237d15848e74f00c42272901db957"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="f29b6081b0e38b485714d3e84421896c"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="2d0bbab37bbfd189403cc78bff8cfc7f"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="8ddb679b397844f988f9f6ddcef48463"/><file name="mysql4-upgrade-0.1.3-0.1.4.php" hash="0a36c9ccc0c51972f42a6db065e0646a"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SSTech_Extracharge.xml" hash="141da3744620193ae9ada2aa3c0669cf"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="extracharge.xml" hash="7691aea9fdcb8561aee65708c82fdf2e"/></dir><dir name="template"><dir name="extracharge"><dir name="sales"><dir name="order"><file name="refunded.phtml" hash="8f8836c2a3c51d27fbbbbd7af50d980b"/><file name="total.phtml" hash="7d91e26b4d7e16c70866c56bfa6b2d0d"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="extracharge.xml" hash="2a2fbc7982250839b9a7e093b5f6a1f3"/></dir><dir name="template"><dir name="extracharge"><file name="extracharge.phtml" hash="ade7866905ec0c9e4ad823d830ed307b"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.17</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>