Version Notes
This is a stable version.
Download this release
Release Info
Developer | pureimagination |
Extension | PI_Fee |
Version | 0.1.4 |
Comparing to | |
See all releases |
Version 0.1.4
- app/code/community/PI/Fee/Block/Sales/Order/Total.php +65 -0
- app/code/community/PI/Fee/Helper/Data.php +8 -0
- app/code/community/PI/Fee/Model/Fee.php +15 -0
- app/code/community/PI/Fee/Model/Observer.php +28 -0
- app/code/community/PI/Fee/Model/Sales/Order/Total/Creditmemo/Fee.php +17 -0
- app/code/community/PI/Fee/Model/Sales/Order/Total/Invoice/Fee.php +24 -0
- app/code/community/PI/Fee/Model/Sales/Quote/Address/Total/Fee.php +53 -0
- app/code/community/PI/Fee/etc/config.xml +153 -0
- app/code/community/PI/Fee/etc/system.xml +36 -0
- app/code/community/PI/Fee/sql/fee_setup/mysql4-install-0.1.0.php +14 -0
- app/code/community/PI/Fee/sql/fee_setup/mysql4-upgrade-0.1.0-0.1.1.php +14 -0
- app/code/community/PI/Fee/sql/fee_setup/mysql4-upgrade-0.1.1-0.1.2.php +14 -0
- app/code/community/PI/Fee/sql/fee_setup/mysql4-upgrade-0.1.2-0.1.3.php +14 -0
- app/code/community/PI/Fee/sql/fee_setup/mysql4-upgrade-0.1.3-0.1.4.php +17 -0
- app/design/adminhtml/default/default/layout/fee.xml +56 -0
- app/design/adminhtml/default/default/template/fee/sales/order/refunded.phtml +16 -0
- app/design/adminhtml/default/default/template/fee/sales/order/total.phtml +9 -0
- app/design/frontend/base/default/layout/fee.xml +53 -0
- app/etc/modules/PI_Fee.xml +9 -0
- package.xml +18 -0
app/code/community/PI/Fee/Block/Sales/Order/Total.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class PI_Fee_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()->getBaseFeeAmount()) {
|
52 |
+
$source = $this->getSource();
|
53 |
+
$value = $source->getFeeAmount();
|
54 |
+
|
55 |
+
$this->getParentBlock()->addTotal(new Varien_Object(array(
|
56 |
+
'code' => 'fee',
|
57 |
+
'strong' => false,
|
58 |
+
'label' => Mage::helper('fee')->formatFee($value),
|
59 |
+
'value' => $source instanceof Mage_Sales_Model_Order_Creditmemo ? - $value : $value
|
60 |
+
)));
|
61 |
+
}
|
62 |
+
|
63 |
+
return $this;
|
64 |
+
}
|
65 |
+
}
|
app/code/community/PI/Fee/Helper/Data.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class PI_Fee_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
public function formatFee($amount){
|
6 |
+
return Mage::helper('fee')->__('Fee');
|
7 |
+
}
|
8 |
+
}
|
app/code/community/PI/Fee/Model/Fee.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class PI_Fee_Model_Fee extends Varien_Object{
|
3 |
+
|
4 |
+
public static function getFee(){
|
5 |
+
$feeAmt = Mage::getStoreConfig('checkout/fee/fee_amt');
|
6 |
+
return $feeAmt;
|
7 |
+
}
|
8 |
+
public static function canApply($address){
|
9 |
+
$setFee = Mage::getStoreConfig('checkout/fee/active');
|
10 |
+
if($setFee==1)
|
11 |
+
{
|
12 |
+
return true;
|
13 |
+
}
|
14 |
+
}
|
15 |
+
}
|
app/code/community/PI/Fee/Model/Observer.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class PI_Fee_Model_Observer{
|
3 |
+
public function invoiceSaveAfter(Varien_Event_Observer $observer)
|
4 |
+
{
|
5 |
+
$invoice = $observer->getEvent()->getInvoice();
|
6 |
+
if ($invoice->getBaseFeeAmount()) {
|
7 |
+
$order = $invoice->getOrder();
|
8 |
+
$order->setFeeAmountInvoiced($order->getFeeAmountInvoiced() + $invoice->getFeeAmount());
|
9 |
+
$order->setBaseFeeAmountInvoiced($order->getBaseFeeAmountInvoiced() + $invoice->getBaseFeeAmount());
|
10 |
+
}
|
11 |
+
return $this;
|
12 |
+
}
|
13 |
+
public function creditmemoSaveAfter(Varien_Event_Observer $observer)
|
14 |
+
{
|
15 |
+
/* @var $creditmemo Mage_Sales_Model_Order_Creditmemo */
|
16 |
+
$creditmemo = $observer->getEvent()->getCreditmemo();
|
17 |
+
if ($creditmemo->getFeeAmount()) {
|
18 |
+
$order = $creditmemo->getOrder();
|
19 |
+
$order->setFeeAmountRefunded($order->getFeeAmountRefunded() + $creditmemo->getFeeAmount());
|
20 |
+
$order->setBaseFeeAmountRefunded($order->getBaseFeeAmountRefunded() + $creditmemo->getBaseFeeAmount());
|
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()->getFeeAmount());
|
27 |
+
}
|
28 |
+
}
|
app/code/community/PI/Fee/Model/Sales/Order/Total/Creditmemo/Fee.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class PI_Fee_Model_Sales_Order_Total_Creditmemo_Fee 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 |
+
$feeAmountLeft = $order->getFeeAmountInvoiced() - $order->getFeeAmountRefunded();
|
8 |
+
$basefeeAmountLeft = $order->getBaseFeeAmountInvoiced() - $order->getBaseFeeAmountRefunded();
|
9 |
+
if ($basefeeAmountLeft > 0) {
|
10 |
+
$creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $feeAmountLeft);
|
11 |
+
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $basefeeAmountLeft);
|
12 |
+
$creditmemo->setFeeAmount($feeAmountLeft);
|
13 |
+
$creditmemo->setBaseFeeAmount($basefeeAmountLeft);
|
14 |
+
}
|
15 |
+
return $this;
|
16 |
+
}
|
17 |
+
}
|
app/code/community/PI/Fee/Model/Sales/Order/Total/Invoice/Fee.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class PI_Fee_Model_Sales_Order_Total_Invoice_Fee 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 |
+
$feeAmountLeft = $order->getFeeAmount() - $order->getFeeAmountInvoiced();
|
8 |
+
$baseFeeAmountLeft = $order->getBaseFeeAmount() - $order->getBaseFeeAmountInvoiced();
|
9 |
+
if (abs($baseFeeAmountLeft) < $invoice->getBaseGrandTotal()) {
|
10 |
+
$invoice->setGrandTotal($invoice->getGrandTotal() + $feeAmountLeft);
|
11 |
+
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseFeeAmountLeft);
|
12 |
+
} else {
|
13 |
+
$feeAmountLeft = $invoice->getGrandTotal() * -1;
|
14 |
+
$baseFeeAmountLeft = $invoice->getBaseGrandTotal() * -1;
|
15 |
+
|
16 |
+
$invoice->setGrandTotal(0);
|
17 |
+
$invoice->setBaseGrandTotal(0);
|
18 |
+
}
|
19 |
+
|
20 |
+
$invoice->setFeeAmount($feeAmountLeft);
|
21 |
+
$invoice->setBaseFeeAmount($baseFeeAmountLeft);
|
22 |
+
return $this;
|
23 |
+
}
|
24 |
+
}
|
app/code/community/PI/Fee/Model/Sales/Quote/Address/Total/Fee.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class PI_Fee_Model_Sales_Quote_Address_Total_Fee extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
3 |
+
protected $_code = 'fee';
|
4 |
+
|
5 |
+
public function collect(Mage_Sales_Model_Quote_Address $address)
|
6 |
+
{
|
7 |
+
parent::collect($address);
|
8 |
+
|
9 |
+
$this->_setAmount(0);
|
10 |
+
$this->_setBaseAmount(0);
|
11 |
+
|
12 |
+
$items = $this->_getAddressItems($address);
|
13 |
+
if (!count($items)) {
|
14 |
+
return $this; //this makes only address type shipping to come through
|
15 |
+
}
|
16 |
+
|
17 |
+
|
18 |
+
$quote = $address->getQuote();
|
19 |
+
|
20 |
+
if(PI_Fee_Model_Fee::canApply($address)){
|
21 |
+
$exist_amount = $quote->getFeeAmount();
|
22 |
+
$fee = PI_Fee_Model_Fee::getFee();
|
23 |
+
$balance = $fee - $exist_amount;
|
24 |
+
// $balance = $fee;
|
25 |
+
|
26 |
+
//$this->_setAmount($balance);
|
27 |
+
//$this->_setBaseAmount($balance);
|
28 |
+
|
29 |
+
$address->setFeeAmount($balance);
|
30 |
+
$address->setBaseFeeAmount($balance);
|
31 |
+
|
32 |
+
$quote->setFeeAmount($balance);
|
33 |
+
|
34 |
+
$address->setGrandTotal($address->getGrandTotal() + $address->getFeeAmount());
|
35 |
+
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseFeeAmount());
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
40 |
+
{
|
41 |
+
$setFee = Mage::getStoreConfig('checkout/fee/active');
|
42 |
+
if($setFee==1)
|
43 |
+
{
|
44 |
+
$amt = $address->getFeeAmount();
|
45 |
+
$address->addTotal(array(
|
46 |
+
'code'=>$this->getCode(),
|
47 |
+
'title'=>Mage::helper('fee')->__('Fee'),
|
48 |
+
'value'=> $amt
|
49 |
+
));
|
50 |
+
return $this;
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
app/code/community/PI/Fee/etc/config.xml
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<PI_Fee>
|
5 |
+
<version>0.1.4</version>
|
6 |
+
</PI_Fee>
|
7 |
+
</modules>
|
8 |
+
<adminhtml>
|
9 |
+
<layout>
|
10 |
+
<updates>
|
11 |
+
<fee>
|
12 |
+
<file>fee.xml</file>
|
13 |
+
</fee>
|
14 |
+
</updates>
|
15 |
+
</layout>
|
16 |
+
</adminhtml>
|
17 |
+
<frontend>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<fee>
|
21 |
+
<file>fee.xml</file>
|
22 |
+
</fee>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<global>
|
27 |
+
<sales>
|
28 |
+
<quote>
|
29 |
+
<totals>
|
30 |
+
<fee>
|
31 |
+
<class>fee/sales_quote_address_total_fee</class>
|
32 |
+
<!--renderer>fee/checkout_total</renderer-->
|
33 |
+
</fee>
|
34 |
+
</totals>
|
35 |
+
</quote>
|
36 |
+
<order_invoice>
|
37 |
+
<totals>
|
38 |
+
<fee>
|
39 |
+
<class>fee/sales_order_total_invoice_fee</class>
|
40 |
+
</fee>
|
41 |
+
</totals>
|
42 |
+
</order_invoice>
|
43 |
+
<order_creditmemo>
|
44 |
+
<totals>
|
45 |
+
<fee>
|
46 |
+
<class>fee/sales_order_total_creditmemo_fee</class>
|
47 |
+
</fee>
|
48 |
+
</totals>
|
49 |
+
</order_creditmemo>
|
50 |
+
</sales>
|
51 |
+
<events>
|
52 |
+
<paypal_prepare_line_items>
|
53 |
+
<observers>
|
54 |
+
<paypal_prepare_line_items>
|
55 |
+
<class>fee/observer</class>
|
56 |
+
<method>updatePaypalTotal</method>
|
57 |
+
</paypal_prepare_line_items>
|
58 |
+
</observers>
|
59 |
+
</paypal_prepare_line_items>
|
60 |
+
<sales_order_invoice_save_after>
|
61 |
+
<observers>
|
62 |
+
<sales_order_invoice_save_after>
|
63 |
+
<class>fee/observer</class>
|
64 |
+
<method>invoiceSaveAfter</method>
|
65 |
+
</sales_order_invoice_save_after>
|
66 |
+
</observers>
|
67 |
+
</sales_order_invoice_save_after>
|
68 |
+
<sales_order_creditmemo_save_after>
|
69 |
+
<observers>
|
70 |
+
<sales_order_creditmemo_save_after>
|
71 |
+
<class>fee/observer</class>
|
72 |
+
<method>creditmemoSaveAfter</method>
|
73 |
+
</sales_order_creditmemo_save_after>
|
74 |
+
</observers>
|
75 |
+
</sales_order_creditmemo_save_after>
|
76 |
+
</events>
|
77 |
+
<fieldsets>
|
78 |
+
<sales_convert_quote_address>
|
79 |
+
<fee_amount><to_order>*</to_order></fee_amount>
|
80 |
+
<base_fee_amount><to_order>*</to_order></base_fee_amount>
|
81 |
+
</sales_convert_quote_address>
|
82 |
+
</fieldsets>
|
83 |
+
<pdf>
|
84 |
+
<totals>
|
85 |
+
<fee translate="title">
|
86 |
+
<title>Fee</title>
|
87 |
+
<source_field>fee_amount</source_field>
|
88 |
+
<font_size>7</font_size>
|
89 |
+
<display_zero>0</display_zero>
|
90 |
+
<sort_order>650</sort_order>
|
91 |
+
<amount_prefix>-</amount_prefix>
|
92 |
+
</fee>
|
93 |
+
</totals>
|
94 |
+
</pdf>
|
95 |
+
<models>
|
96 |
+
<fee>
|
97 |
+
<class>PI_Fee_Model</class>
|
98 |
+
<resourceModel>fee_mysql4</resourceModel>
|
99 |
+
</fee>
|
100 |
+
<fee_mysql4>
|
101 |
+
<class>PI_Fee_Model_Mysql4</class>
|
102 |
+
<entities>
|
103 |
+
<fee>
|
104 |
+
<table>fee</table>
|
105 |
+
</fee>
|
106 |
+
</entities>
|
107 |
+
</fee_mysql4>
|
108 |
+
</models>
|
109 |
+
<resources>
|
110 |
+
<fee_setup>
|
111 |
+
<setup>
|
112 |
+
<module>PI_Fee</module>
|
113 |
+
</setup>
|
114 |
+
<connection>
|
115 |
+
<use>core_setup</use>
|
116 |
+
</connection>
|
117 |
+
</fee_setup>
|
118 |
+
<fee_write>
|
119 |
+
<connection>
|
120 |
+
<use>core_write</use>
|
121 |
+
</connection>
|
122 |
+
</fee_write>
|
123 |
+
<fee_read>
|
124 |
+
<connection>
|
125 |
+
<use>core_read</use>
|
126 |
+
</connection>
|
127 |
+
</fee_read>
|
128 |
+
</resources>
|
129 |
+
<blocks>
|
130 |
+
<fee>
|
131 |
+
<class>PI_Fee_Block</class>
|
132 |
+
</fee>
|
133 |
+
</blocks>
|
134 |
+
<helpers>
|
135 |
+
<fee>
|
136 |
+
<class>PI_Fee_Helper</class>
|
137 |
+
</fee>
|
138 |
+
</helpers>
|
139 |
+
</global>
|
140 |
+
<default>
|
141 |
+
<sales>
|
142 |
+
<totals_sort>
|
143 |
+
<fee>15</fee>
|
144 |
+
</totals_sort>
|
145 |
+
</sales>
|
146 |
+
<checkout> <!-- Name of section -->
|
147 |
+
<fee> <!-- Name of group -->
|
148 |
+
<active>1</active> <!-- Name of field -->
|
149 |
+
<fee_amt>10</fee_amt>
|
150 |
+
</fee>
|
151 |
+
</checkout>
|
152 |
+
</default>
|
153 |
+
</config>
|
app/code/community/PI/Fee/etc/system.xml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<checkout>
|
5 |
+
<groups>
|
6 |
+
<fee translate="label" module="fee">
|
7 |
+
<label>Add fee on grand total</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>5</sort_order>
|
10 |
+
<show_in_default>1</show_in_default>
|
11 |
+
<show_in_website>1</show_in_website>
|
12 |
+
<show_in_store>0</show_in_store>
|
13 |
+
<fields>
|
14 |
+
<active translate="label">
|
15 |
+
<label>Enabled</label>
|
16 |
+
<frontend_type>select</frontend_type>
|
17 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
18 |
+
<sort_order>1</sort_order>
|
19 |
+
<show_in_default>1</show_in_default>
|
20 |
+
<show_in_website>1</show_in_website>
|
21 |
+
<show_in_store>1</show_in_store>
|
22 |
+
</active>
|
23 |
+
<fee_amt translate="label">
|
24 |
+
<label>Fee Amount</label>
|
25 |
+
<frontend_type>text</frontend_type>
|
26 |
+
<sort_order>2</sort_order>
|
27 |
+
<show_in_default>1</show_in_default>
|
28 |
+
<show_in_website>1</show_in_website>
|
29 |
+
<show_in_store>1</show_in_store>
|
30 |
+
</fee_amt>
|
31 |
+
</fields>
|
32 |
+
</fee>
|
33 |
+
</groups>
|
34 |
+
</checkout>
|
35 |
+
</sections>
|
36 |
+
</config>
|
app/code/community/PI/Fee/sql/fee_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 `fee_amount` DECIMAL( 10, 2 ) NOT NULL;
|
10 |
+
ALTER TABLE `".$this->getTable('sales/order')."` ADD `base_fee_amount` DECIMAL( 10, 2 ) NOT NULL;
|
11 |
+
|
12 |
+
");
|
13 |
+
|
14 |
+
$installer->endSetup();
|
app/code/community/PI/Fee/sql/fee_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 `fee_amount` DECIMAL( 10, 2 ) NOT NULL;
|
10 |
+
ALTER TABLE `".$this->getTable('sales/quote_address')."` ADD `base_fee_amount` DECIMAL( 10, 2 ) NOT NULL;
|
11 |
+
|
12 |
+
");
|
13 |
+
|
14 |
+
$installer->endSetup();
|
app/code/community/PI/Fee/sql/fee_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 `fee_amount_invoiced` DECIMAL( 10, 2 ) NOT NULL;
|
10 |
+
ALTER TABLE `".$this->getTable('sales/order')."` ADD `base_fee_amount_invoiced` DECIMAL( 10, 2 ) NOT NULL;
|
11 |
+
|
12 |
+
");
|
13 |
+
|
14 |
+
$installer->endSetup();
|
app/code/community/PI/Fee/sql/fee_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 `fee_amount` DECIMAL( 10, 2 ) NOT NULL;
|
10 |
+
ALTER TABLE `".$this->getTable('sales/invoice')."` ADD `base_fee_amount` DECIMAL( 10, 2 ) NOT NULL;
|
11 |
+
|
12 |
+
");
|
13 |
+
|
14 |
+
$installer->endSetup();
|
app/code/community/PI/Fee/sql/fee_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 `fee_amount_refunded` DECIMAL( 10, 2 ) NOT NULL;
|
10 |
+
ALTER TABLE `".$this->getTable('sales/order')."` ADD `base_fee_amount_refunded` DECIMAL( 10, 2 ) NOT NULL;
|
11 |
+
|
12 |
+
ALTER TABLE `".$this->getTable('sales/creditmemo')."` ADD `fee_amount` DECIMAL( 10, 2 ) NOT NULL;
|
13 |
+
ALTER TABLE `".$this->getTable('sales/creditmemo')."` ADD `base_fee_amount` DECIMAL( 10, 2 ) NOT NULL;
|
14 |
+
|
15 |
+
");
|
16 |
+
|
17 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/fee.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="fee" template="fee/sales/order/total.phtml">
|
6 |
+
</block>
|
7 |
+
<block type="adminhtml/sales_order_totals_item" name="fee.refunded" template="fee/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="fee" template="fee/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="fee" template="fee/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="fee" template="fee/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="fee" template="fee/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="fee" template="fee/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="fee.refunded" template="fee/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/fee/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()->getFeeAmountRefunded()): ?>
|
3 |
+
<tr>
|
4 |
+
<td class="label"><strong><?php echo Mage::helper('fee')->__('Fee refunded to customer') ?></strong></td>
|
5 |
+
<td><strong><?php echo $this->getSource()->getFeeAmountRefunded(); ?></strong></td>
|
6 |
+
</tr>
|
7 |
+
<?php endif; ?>
|
8 |
+
<?php } else { ?>
|
9 |
+
<?php if ((float) $this->getSource()->getFeeAmount()): ?>
|
10 |
+
<tr>
|
11 |
+
<td class="label"><strong><?php echo Mage::helper('fee')->__('Fee Refunded') ?></strong></td>
|
12 |
+
<td><strong><?php echo $this->getSource()->getFeeAmount(); ?></strong></td>
|
13 |
+
</tr>
|
14 |
+
<?php endif;
|
15 |
+
}?>
|
16 |
+
|
app/design/adminhtml/default/default/template/fee/sales/order/total.phtml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $this->setPriceDataObject($this->getSource()) ?>
|
2 |
+
<?php if ((float) $this->getSource()->getFeeAmount()): ?>
|
3 |
+
<tr>
|
4 |
+
<td class="label"><?php echo Mage::helper('fee')->formatFee($this->getSource()->getFeeAmount()) ?></td>
|
5 |
+
<td>
|
6 |
+
<?php echo $this->displayPrices($this->getSource()->getBaseFeeAmount(), $this->getSource()->getFeeAmount()); ?>
|
7 |
+
</td>
|
8 |
+
</tr>
|
9 |
+
<?php endif; ?>
|
app/design/frontend/base/default/layout/fee.xml
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<sales_order_view>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="fee/sales_order_total" name="fee.sales.order.total" />
|
6 |
+
</reference>
|
7 |
+
<reference name="order_totals">
|
8 |
+
<block type="fee/sales_order_total" name="fee.sales.order.total" />
|
9 |
+
</reference>
|
10 |
+
</sales_order_view>
|
11 |
+
<sales_order_print>
|
12 |
+
<reference name="order_totals">
|
13 |
+
<block type="fee/sales_order_total" name="fee.sales.order.total" />
|
14 |
+
</reference>
|
15 |
+
</sales_order_print>
|
16 |
+
<sales_email_order_items>
|
17 |
+
<reference name="order_totals">
|
18 |
+
<block type="fee/sales_order_total" name="fee.sales.order.total" />
|
19 |
+
</reference>
|
20 |
+
</sales_email_order_items>
|
21 |
+
|
22 |
+
<sales_order_invoice>
|
23 |
+
<reference name="invoice_totals">
|
24 |
+
<block type="fee/sales_order_total" name="fee.sales.order.total" />
|
25 |
+
</reference>
|
26 |
+
</sales_order_invoice>
|
27 |
+
<sales_order_printinvoice>
|
28 |
+
<reference name="invoice_totals">
|
29 |
+
<block type="fee/sales_order_total" name="fee.sales.order.total" />
|
30 |
+
</reference>
|
31 |
+
</sales_order_printinvoice>
|
32 |
+
<sales_email_order_invoice_items>
|
33 |
+
<reference name="invoice_totals">
|
34 |
+
<block type="fee/sales_order_total" name="fee.sales.order.total" />
|
35 |
+
</reference>
|
36 |
+
</sales_email_order_invoice_items>
|
37 |
+
|
38 |
+
<sales_order_creditmemo>
|
39 |
+
<reference name="creditmemo_totals">
|
40 |
+
<block type="fee/sales_order_total" name="fee.sales.order.total" />
|
41 |
+
</reference>
|
42 |
+
</sales_order_creditmemo>
|
43 |
+
<sales_order_printcreditmemo>
|
44 |
+
<reference name="creditmemo_totals">
|
45 |
+
<block type="fee/sales_order_total" name="fee.sales.order.total" />
|
46 |
+
</reference>
|
47 |
+
</sales_order_printcreditmemo>
|
48 |
+
<sales_email_order_creditmemo_items>
|
49 |
+
<reference name="creditmemo_totals">
|
50 |
+
<block type="fee/sales_order_total" name="fee.sales.order.total" />
|
51 |
+
</reference>
|
52 |
+
</sales_email_order_creditmemo_items>
|
53 |
+
</layout>
|
app/etc/modules/PI_Fee.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<PI_Fee>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</PI_Fee>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>PI_Fee</name>
|
4 |
+
<version>0.1.4</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>This extension add an additional fee to grand total of the magento's checkout process.</summary>
|
10 |
+
<description>Using this extension you can easily add an additional fee on grand total.You can also change or disable this additional fee from admin.</description>
|
11 |
+
<notes>This is a stable version.</notes>
|
12 |
+
<authors><author><name>pureimagination</name><user>pureimagination</user><email>johncarter15oct@gmail.com</email></author></authors>
|
13 |
+
<date>2014-11-23</date>
|
14 |
+
<time>06:25:52</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="PI"><dir name="Fee"><dir name="Block"><dir name="Sales"><dir name="Order"><file name="Total.php" hash="0f4fe929a4c7f97176507379e7b22d98"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="5f402e4a5891c5285a54248a1c6d18dd"/></dir><dir name="Model"><file name="Fee.php" hash="45771aa1ee90c98952511591f4ec90b2"/><file name="Observer.php" hash="d6526586a4820da42132372646dde091"/><dir name="Sales"><dir name="Order"><dir name="Total"><dir name="Creditmemo"><file name="Fee.php" hash="11bfd9e806221dd15e5bd07ca0d15a13"/></dir><dir name="Invoice"><file name="Fee.php" hash="44871a880ef6af8782a8233b8c16f331"/></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Fee.php" hash="f23151ec6e24eafbe33cfd44b1d8ec4a"/></dir></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="2baad5a6d2d20b477f201bfb028a532e"/><file name="system.xml" hash="399254c912d9fe2932dbc7e6295cc02c"/></dir><dir name="sql"><dir name="fee_setup"><file name="mysql4-install-0.1.0.php" hash="f508931a7a4eed80560bb87889fc9b59"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="683617f1cf9d393ccd6459aa0976c6af"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="e3904443f5aa3d891ff66c1085d87ce9"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="ab135913c99bd5afd1d8d37eb192c33a"/><file name="mysql4-upgrade-0.1.3-0.1.4.php" hash="e024f48acdc691c388f409c5bc33eed3"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="PI_Fee.xml" hash="0c59169d1fa460aa01db3f5827ed7030"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="fee.xml" hash="96955d111e2a9014d5dc3d18201ddddf"/></dir><dir name="template"><dir name="fee"><dir name="sales"><dir name="order"><file name="refunded.phtml" hash="f4239d313366d75907a34b3342b35eb1"/><file name="total.phtml" hash="bbb080fb20415086d72719c1f1f613d4"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="fee.xml" hash="c996810fe61c41d2698b248fa6a9b2ec"/></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|