Easy_Donation - Version 0.1.1

Version Notes

- Donation amount displayed in view order page
- Fixed paypal donation amount issue.

Download this release

Release Info

Developer Weblineindia
Extension Easy_Donation
Version 0.1.1
Comparing to
See all releases


Code changes from version 0.1.0 to 0.1.1

app/code/local/Wli/Donation/controllers/Adminhtml/DonationController.php CHANGED
@@ -14,7 +14,7 @@ class Wli_Donation_Adminhtml_DonationController extends Mage_Adminhtml_Controlle
14
 
15
  public function indexAction() {
16
  $this->_initAction();
17
- //$this->_addContent($this->getLayout()->createBlock('donation/adminhtml_donation'));
18
  $this->renderLayout();
19
  }
20
 
14
 
15
  public function indexAction() {
16
  $this->_initAction();
17
+ $this->_addContent($this->getLayout()->createBlock('donation/adminhtml_donation'));
18
  $this->renderLayout();
19
  }
20
 
app/code/local/Wli/Donation/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Wli_Donation>
5
- <version>0.1.0</version>
6
  </Wli_Donation>
7
  </modules>
8
  <frontend>
2
  <config>
3
  <modules>
4
  <Wli_Donation>
5
+ <version>0.1.1</version>
6
  </Wli_Donation>
7
  </modules>
8
  <frontend>
app/code/local/Wli/Donation/etc/config.xml~ ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Wli_Donation>
5
+ <version>0.1.0</version>
6
+ </Wli_Donation>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <donation>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Wli_Donation</module>
14
+ <frontName>donation</frontName>
15
+ </args>
16
+ </donation>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <donation>
21
+ <file>donation.xml</file>
22
+ </donation>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <admin>
27
+ <routers>
28
+ <donation>
29
+ <use>admin</use>
30
+ <args>
31
+ <module>Wli_Donation</module>
32
+ <frontName>donation</frontName>
33
+ </args>
34
+ </donation>
35
+ </routers>
36
+ </admin>
37
+ <adminhtml>
38
+ <menu>
39
+ <donation module="donation">
40
+ <title>Donation</title>
41
+ <sort_order>70</sort_order>
42
+
43
+ <children>
44
+ <wli_donation module="donation">
45
+ <title>Donation List</title>
46
+ <sort_order>1</sort_order>
47
+ <action>donation/adminhtml_donation</action>
48
+ </wli_donation>
49
+ </children>
50
+ </donation>
51
+
52
+
53
+
54
+ </menu>
55
+ <acl>
56
+ <resources>
57
+ <all>
58
+ <title>Allow Everything</title>
59
+ </all>
60
+ <admin>
61
+ <children>
62
+ <donation>
63
+ <title>Donation Module</title>
64
+ <sort_order>200</sort_order>
65
+ </donation>
66
+ </children>
67
+ </admin>
68
+ </resources>
69
+ </acl>
70
+ <layout>
71
+ <updates>
72
+ <donation>
73
+ <file>donation.xml</file>
74
+ </donation>
75
+ </updates>
76
+ </layout>
77
+ </adminhtml>
78
+
79
+ <global>
80
+ <models>
81
+ <donation>
82
+ <class>Wli_Donation_Model</class>
83
+ <resourceModel>donation_mysql4</resourceModel>
84
+ </donation>
85
+ <donation_mysql4>
86
+ <class>Wli_Donation_Model_Mysql4</class>
87
+ <entities>
88
+ <donation>
89
+ <table>donation</table>
90
+ </donation>
91
+ </entities>
92
+ </donation_mysql4>
93
+ </models>
94
+ <resources>
95
+ <donation_setup>
96
+ <setup>
97
+ <module>Wli_Donation</module>
98
+ </setup>
99
+ <connection>
100
+ <use>core_setup</use>
101
+ </connection>
102
+ </donation_setup>
103
+ <donation_write>
104
+ <connection>
105
+ <use>core_write</use>
106
+ </connection>
107
+ </donation_write>
108
+ <donation_read>
109
+ <connection>
110
+ <use>core_read</use>
111
+ </connection>
112
+ </donation_read>
113
+ </resources>
114
+ <blocks>
115
+ <donation>
116
+ <class>Wli_Donation_Block</class>
117
+ </donation>
118
+ </blocks>
119
+ <helpers>
120
+ <donation>
121
+ <class>Wli_Donation_Helper</class>
122
+ </donation>
123
+ </helpers>
124
+ </global>
125
+ </config>
app/code/local/Wli/Donation/sql/donation_setup/{mysql4-install-0.1.0.php → mysql4-install-0.1.1.php} RENAMED
File without changes
app/code/local/Wli/Wlicheckout/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Wli_Wlicheckout>
5
- <version>0.1.0</version>
6
  </Wli_Wlicheckout>
7
  </modules>
8
  <frontend>
2
  <config>
3
  <modules>
4
  <Wli_Wlicheckout>
5
+ <version>0.1.1</version>
6
  </Wli_Wlicheckout>
7
  </modules>
8
  <frontend>
app/code/local/Wli/Wlipaypal/Model/Standard.php ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Paypal
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Model to calculate grand total or an order
29
+ *
30
+ * @category Wli
31
+ * @package Wlipaypal
32
+ * @author Weblineindia Team
33
+ */
34
+
35
+
36
+ require_once 'Mage/Paypal/Model/Standard.php';
37
+ class Wli_Wlipaypal_Model_Standard extends Mage_Payment_Model_Method_Abstract
38
+ {
39
+ protected $_code = Mage_Paypal_Model_Config::METHOD_WPS;
40
+ protected $_formBlockType = 'paypal/standard_form';
41
+ protected $_infoBlockType = 'paypal/payment_info';
42
+ protected $_isInitializeNeeded = true;
43
+ protected $_canUseInternal = false;
44
+ protected $_canUseForMultishipping = false;
45
+
46
+ /**
47
+ * Config instance
48
+ * @var Mage_Paypal_Model_Config
49
+ */
50
+ protected $_config = null;
51
+
52
+ /**
53
+ * Whether method is available for specified currency
54
+ *
55
+ * @param string $currencyCode
56
+ * @return bool
57
+ */
58
+ public function canUseForCurrency($currencyCode)
59
+ {
60
+ return $this->getConfig()->isCurrencyCodeSupported($currencyCode);
61
+ }
62
+
63
+ /**
64
+ * Get paypal session namespace
65
+ *
66
+ * @return Mage_Paypal_Model_Session
67
+ */
68
+ public function getSession()
69
+ {
70
+ return Mage::getSingleton('paypal/session');
71
+ }
72
+
73
+ /**
74
+ * Get checkout session namespace
75
+ *
76
+ * @return Mage_Checkout_Model_Session
77
+ */
78
+ public function getCheckout()
79
+ {
80
+ return Mage::getSingleton('checkout/session');
81
+ }
82
+
83
+ /**
84
+ * Get current quote
85
+ *
86
+ * @return Mage_Sales_Model_Quote
87
+ */
88
+ public function getQuote()
89
+ {
90
+ return $this->getCheckout()->getQuote();
91
+ }
92
+
93
+ /**
94
+ * Create main block for standard form
95
+ *
96
+ */
97
+ public function createFormBlock($name)
98
+ {
99
+ $block = $this->getLayout()->createBlock('paypal/standard_form', $name)
100
+ ->setMethod('paypal_standard')
101
+ ->setPayment($this->getPayment())
102
+ ->setTemplate('paypal/standard/form.phtml');
103
+
104
+ return $block;
105
+ }
106
+
107
+ /**
108
+ * Return Order place redirect url
109
+ *
110
+ * @return string
111
+ */
112
+ public function getOrderPlaceRedirectUrl()
113
+ {
114
+ return Mage::getUrl('paypal/standard/redirect', array('_secure' => true));
115
+ }
116
+
117
+ /**
118
+ * Return form field array
119
+ *
120
+ * @return array
121
+ */
122
+ public function getStandardCheckoutFormFields()
123
+ {
124
+ $orderIncrementId = $this->getCheckout()->getLastRealOrderId();
125
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
126
+ /* @var $api Mage_Paypal_Model_Api_Standard */
127
+ $api = Mage::getModel('paypal/api_standard')->setConfigObject($this->getConfig());
128
+ $api->setOrderId($orderIncrementId)
129
+ ->setCurrencyCode($order->getBaseCurrencyCode())
130
+ //->setPaymentAction()
131
+ ->setOrder($order)
132
+ ->setNotifyUrl(Mage::getUrl('paypal/ipn/'))
133
+ ->setReturnUrl(Mage::getUrl('paypal/standard/success'))
134
+ ->setCancelUrl(Mage::getUrl('paypal/standard/cancel'));
135
+
136
+ // export address
137
+ $isOrderVirtual = $order->getIsVirtual();
138
+ $address = $isOrderVirtual ? $order->getBillingAddress() : $order->getShippingAddress();
139
+ if ($isOrderVirtual) {
140
+ $api->setNoShipping(true);
141
+ } elseif ($address->validate()) {
142
+ $api->setAddress($address);
143
+ }
144
+
145
+ // add cart totals and line items
146
+ $api->setPaypalCart(Mage::getModel('paypal/cart', array($order)))
147
+ ->setIsLineItemsEnabled($this->_config->lineItemsEnabled)
148
+ ;
149
+
150
+ // echo $order->getGrandTotal(); exit;
151
+ $api->setCartSummary($this->_getAggregatedCartSummary());
152
+
153
+ //$result['amount'] = round($order->getGrandTotal(), 2);
154
+ $api->setLocale($api->getLocaleCode());
155
+ $result = $api->getStandardCheckoutRequest();
156
+
157
+ // Custom logic for the donation amount to be added in grand total
158
+
159
+ $j = 0;
160
+ $items = $order->getAllItems();
161
+ foreach ($items as $itemId => $item)
162
+ {
163
+ $j ++;
164
+ $result['amount_'.$j] = round($item->getPrice(), 2);
165
+ }
166
+ // end
167
+ if($order->getShippingAmount()>0)
168
+ {
169
+ $finalamount=$order->getGrandTotal()-$order->getShippingAmount();
170
+ }
171
+ else
172
+ {
173
+ $finalamount=$order->getGrandTotal();
174
+ }
175
+ $result['amount'] = number_format($finalamount, 2);
176
+ return $result;
177
+ }
178
+
179
+ /**
180
+ * Instantiate state and set it to state object
181
+ * @param string $paymentAction
182
+ * @param Varien_Object
183
+ */
184
+ public function initialize($paymentAction, $stateObject)
185
+ {
186
+ $state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
187
+ $stateObject->setState($state);
188
+ $stateObject->setStatus('pending_payment');
189
+ $stateObject->setIsNotified(false);
190
+ }
191
+
192
+ /**
193
+ * Config instance getter
194
+ * @return Mage_Paypal_Model_Config
195
+ */
196
+ public function getConfig()
197
+ {
198
+ if (null === $this->_config) {
199
+ $params = array($this->_code);
200
+ if ($store = $this->getStore()) {
201
+ $params[] = is_object($store) ? $store->getId() : $store;
202
+ }
203
+ $this->_config = Mage::getModel('paypal/config', $params);
204
+ }
205
+ return $this->_config;
206
+ }
207
+
208
+ /**
209
+ * Check whether payment method can be used
210
+ * @param Mage_Sales_Model_Quote
211
+ * @return bool
212
+ */
213
+ public function isAvailable($quote = null)
214
+ {
215
+ if (parent::isAvailable($quote) && $this->getConfig()->isMethodAvailable()) {
216
+ return true;
217
+ }
218
+ return false;
219
+ }
220
+
221
+ /**
222
+ * Custom getter for payment configuration
223
+ *
224
+ * @param string $field
225
+ * @param int $storeId
226
+ * @return mixed
227
+ */
228
+ public function getConfigData($field, $storeId = null)
229
+ {
230
+ return $this->getConfig()->$field;
231
+ }
232
+
233
+ /**
234
+ * Aggregated cart summary label getter
235
+ *
236
+ * @return string
237
+ */
238
+ private function _getAggregatedCartSummary()
239
+ {
240
+ if ($this->_config->lineItemsSummary) {
241
+ return $this->_config->lineItemsSummary;
242
+ }
243
+ return Mage::app()->getStore($this->getStore())->getFrontendName();
244
+ }
245
+ }
app/code/local/Wli/Wlipaypal/Model/Standard.php~ ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Paypal
23
+ * @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Model to calculate grand total or an order
29
+ *
30
+ * @category Wli
31
+ * @package Wlipaypal
32
+ * @author Weblineindia Team
33
+ */
34
+
35
+
36
+ require_once 'Mage/Paypal/Model/Standard.php';
37
+ class Wli_Wlipaypal_Model_Standard extends Mage_Payment_Model_Method_Abstract
38
+ {
39
+ /**
40
+ * Return form field array
41
+ *
42
+ * @return array
43
+ */
44
+ public function getStandardCheckoutFormFields()
45
+ {
46
+
47
+ print_r($_POST); exit;
48
+ $orderIncrementId = $this->getCheckout()->getLastRealOrderId();
49
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
50
+ /* @var $api Mage_Paypal_Model_Api_Standard */
51
+ $api = Mage::getModel('paypal/api_standard')->setConfigObject($this->getConfig());
52
+ $api->setOrderId($orderIncrementId)
53
+ ->setCurrencyCode($order->getBaseCurrencyCode())
54
+ //->setPaymentAction()
55
+ ->setOrder($order)
56
+ ->setNotifyUrl(Mage::getUrl('paypal/ipn/'))
57
+ ->setReturnUrl(Mage::getUrl('paypal/standard/success'))
58
+ ->setCancelUrl(Mage::getUrl('paypal/standard/cancel'));
59
+
60
+ // export address
61
+ $isOrderVirtual = $order->getIsVirtual();
62
+ $address = $isOrderVirtual ? $order->getBillingAddress() : $order->getShippingAddress();
63
+ if ($isOrderVirtual) {
64
+ $api->setNoShipping(true);
65
+ } elseif ($address->validate()) {
66
+ $api->setAddress($address);
67
+ }
68
+
69
+ // add cart totals and line items
70
+ $api->setPaypalCart(Mage::getModel('paypal/cart', array($order)))
71
+ ->setIsLineItemsEnabled($this->_config->lineItemsEnabled)
72
+ ;
73
+
74
+ echo $order->getGrandTotal(); exit;
75
+ $api->setCartSummary($this->_getAggregatedCartSummary());
76
+
77
+ //$result['amount'] = round($order->getGrandTotal(), 2);
78
+ $api->setLocale($api->getLocaleCode());
79
+ $result = $api->getStandardCheckoutRequest();
80
+
81
+ // Custom logic for the donation amount to be added in grand total
82
+ $result['amount'] = round($order->getGrandTotal(), 2);
83
+ $j = 0;
84
+ $items = $order->getAllItems();
85
+ foreach ($items as $itemId => $item)
86
+ {
87
+ $j ++;
88
+ $result['amount_'.$j] = round($item->getPrice(), 2);
89
+ }
90
+ // end
91
+
92
+ return $result;
93
+ }
94
+ }
app/code/local/Wli/Wlipaypal/etc/config.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <config>
3
+ <modules>
4
+ <Wli_Wlipaypal>
5
+ <version>0.1.1</version>
6
+ </Wli_Wlipaypal>
7
+ </modules>
8
+ <global>
9
+
10
+ <models>
11
+ <paypal>
12
+ <rewrite>
13
+ <standard>Wli_Wlipaypal_Model_Standard</standard>
14
+
15
+ </rewrite>
16
+ </paypal>
17
+ </models>
18
+ </global>
19
+ </config>
app/code/local/Wli/Wlipaypal/etc/config.xml~ ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <config>
3
+ <modules>
4
+ <Wli_Wlipaypal>
5
+ <version>0.1.0</version>
6
+ </Wli_Wlipaypal>
7
+ </modules>
8
+ <global>
9
+
10
+ <models>
11
+ <paypal>
12
+ <rewrite>
13
+ <standard>Wli_Wlipaypal_Model_Standard</standard>
14
+
15
+ </rewrite>
16
+ </paypal>
17
+ </models>
18
+ </global>
19
+ </config>
app/code/local/Wli/Wlisales/Model/Quote/Address/Total/Grand.php CHANGED
@@ -43,20 +43,17 @@ class Wli_Wlisales_Model_Quote_Address_Total_Grand extends Mage_Sales_Model_Quot
43
  */
44
  public function collect(Mage_Sales_Model_Quote_Address $address)
45
  {
46
-
47
- //echo "goes here in grand"; exit;
48
  $grandTotal = $address->getGrandTotal();
49
  $baseGrandTotal = $address->getBaseGrandTotal();
50
-
51
  $store = $address->getQuote()->getStore();
52
  $totals = array_sum($address->getAllTotalAmounts());
53
  $totals = $store->roundPrice($totals);
54
- $donationTotal = $address->getDonationAmount();
55
  $baseTotals = array_sum($address->getAllBaseTotalAmounts());
56
  $baseTotals = $store->roundPrice($baseTotals);
57
 
58
  $address->setGrandTotal($grandTotal+$totals+$donationTotal);
59
- $address->setBaseGrandTotal($baseGrandTotal+$baseTotals);
60
  return $this;
61
  }
62
 
43
  */
44
  public function collect(Mage_Sales_Model_Quote_Address $address)
45
  {
 
 
46
  $grandTotal = $address->getGrandTotal();
47
  $baseGrandTotal = $address->getBaseGrandTotal();
 
48
  $store = $address->getQuote()->getStore();
49
  $totals = array_sum($address->getAllTotalAmounts());
50
  $totals = $store->roundPrice($totals);
51
+ $donationTotal = $address->getDonationAmount();
52
  $baseTotals = array_sum($address->getAllBaseTotalAmounts());
53
  $baseTotals = $store->roundPrice($baseTotals);
54
 
55
  $address->setGrandTotal($grandTotal+$totals+$donationTotal);
56
+ $address->setBaseGrandTotal($baseGrandTotal+$baseTotals+$donationTotal);
57
  return $this;
58
  }
59
 
app/code/local/Wli/Wlisales/Sales/Order/Total.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Excellence_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/local/Wli/Wlisales/etc/config.xml CHANGED
@@ -2,9 +2,18 @@
2
  <config>
3
  <modules>
4
  <Wli_Wlisales>
5
- <version>0.1.0</version>
6
  </Wli_Wlisales>
7
  </modules>
 
 
 
 
 
 
 
 
 
8
  <global>
9
  <sales>
10
  <quote>
2
  <config>
3
  <modules>
4
  <Wli_Wlisales>
5
+ <version>0.1.1</version>
6
  </Wli_Wlisales>
7
  </modules>
8
+ <adminhtml>
9
+ <layout>
10
+ <updates>
11
+ <wlisales>
12
+ <file>wlisales.xml</file>
13
+ </wlisales>
14
+ </updates>
15
+ </layout>
16
+ </adminhtml>
17
  <global>
18
  <sales>
19
  <quote>
app/code/local/Wli/Wlisales/etc/config.xml~ CHANGED
@@ -5,15 +5,32 @@
5
  <version>0.1.0</version>
6
  </Wli_Wlisales>
7
  </modules>
 
 
 
 
 
 
 
 
 
8
  <global>
9
-
 
 
 
 
 
 
 
 
 
10
  <models>
11
  <sales>
12
- <rewrite>
13
- <quote_address_total_donation>Wli_Wlisales_Model_Quote_Address_Total_Donation</quote_address_total_donation>
14
- <quote_address_total_grand>Wli_Wlisales_Model_Quote_Address_Total_Grand</quote_address_total_grand>
15
- </rewrite>
16
- </sales>
17
  </models>
18
  </global>
19
  </config>
5
  <version>0.1.0</version>
6
  </Wli_Wlisales>
7
  </modules>
8
+ <adminhtml>
9
+ <layout>
10
+ <updates>
11
+ <wlisales>
12
+ <file>wlisales.xml</file>
13
+ </wlisales>
14
+ </updates>
15
+ </layout>
16
+ </adminhtml>
17
  <global>
18
+ <sales>
19
+ <quote>
20
+ <totals>
21
+ <donation>
22
+ <class>Wli_Wlisales_Model_Quote_Address_Total_Donation</class>
23
+ <before>grand_total</before>
24
+ </donation>
25
+ </totals>
26
+ </quote>
27
+ </sales>
28
  <models>
29
  <sales>
30
+ <rewrite>
31
+ <quote_address_total_grand>Wli_Wlisales_Model_Quote_Address_Total_Grand</quote_address_total_grand>
32
+ </rewrite>
33
+ </sales>
 
34
  </models>
35
  </global>
36
  </config>
app/design/adminhtml/default/default/layout/donation.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0"?>
2
- <layout version="0.1.0">
3
- <donation_adminhtml_donation_index>
4
- <reference name="content">
5
- <block type="donation/adminhtml_donation" name="donation" />
6
- </reference>
7
- </donation_adminhtml_donation_index>
8
- </layout>
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/layout/wlisales.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
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="wlisales" template="wlisales/sales/order/total.phtml">
6
+ </block>
7
+
8
+ </reference>
9
+ </adminhtml_sales_order_view>
10
+
11
+ </layout>
app/design/adminhtml/default/default/template/wlisales/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/wlisales/sales/order/total.phtml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $orderId = $this->getRequest()->getParam('order_id');
3
+ $order = Mage::getModel('sales/order')->load($orderId);
4
+ $IncrementId = $order->getIncrementId();
5
+ $DonationModel=Mage::getModel('donation/donation')->getCollection();
6
+ $DonationModel->addFieldToFilter('order_id ', $IncrementId);
7
+ $DonationDetails = $DonationModel->getFirstItem();
8
+ $DonationAmount = $DonationDetails->getDonationAmount();
9
+
10
+ ?>
11
+ <?php if(isset($DonationAmount) && !empty($DonationAmount)):?>
12
+ <tr><td class="label"><strong>Donation</strong></td><td>$<?php echo number_format($DonationAmount, 2)?></td></tr><tr>
13
+ <?php endif;?>
app/design/adminhtml/default/default/template/wlisales/sales/order/total.phtml~ ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $orderId = $this->getRequest()->getParam('order_id');
3
+ $order = Mage::getModel('sales/order')->load($orderId);
4
+ $IncrementId = $order->getIncrementId();
5
+ $DonationModel=Mage::getModel('donation/donation')->getCollection();
6
+ $DonationModel->addFieldToFilter('order_id ', $IncrementId);
7
+ $DonationDetails = $DonationModel->getFirstItem();
8
+ $DonationAmount = $DonationDetails->getDonationAmount();
9
+
10
+ ?>
11
+ <?php if(isset($DonationAmount) && !empty($DonationAmount)):?>
12
+ <tr><td class="label">sadasf<strong>Donation</strong></td><td>$<?php echo number_format($DonationAmount, 2)?></td></tr><tr>
13
+ <?php endif;?>
app/etc/modules/Wli_Donation.xml CHANGED
@@ -5,25 +5,5 @@
5
  <active>true</active>
6
  <codePool>local</codePool>
7
  </Wli_Donation>
8
- <Wli_Distributors>
9
- <active>true</active>
10
- <codePool>local</codePool>
11
- </Wli_Distributors>
12
- <Wli_Manufacturers>
13
- <active>true</active>
14
- <codePool>local</codePool>
15
- </Wli_Manufacturers>
16
- <Wli_Dispatched>
17
- <active>true</active>
18
- <codePool>local</codePool>
19
- </Wli_Dispatched>
20
- <Wli_Collarinventory>
21
- <active>true</active>
22
- <codePool>local</codePool>
23
- </Wli_Collarinventory>
24
- <Wli_Returnlogs>
25
- <active>true</active>
26
- <codePool>local</codePool>
27
- </Wli_Returnlogs>
28
- </modules>
29
- </config>
5
  <active>true</active>
6
  <codePool>local</codePool>
7
  </Wli_Donation>
8
+ </modules>
9
+ </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/etc/modules/Wli_Wlipaypal.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Wli_Wlipaypal>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Wli_Wlipaypal>
8
+ </modules>
9
+ </config>
media/images/icon-help.png DELETED
Binary file
package.xml CHANGED
@@ -1,34 +1,19 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Easy_Donation</name>
4
- <version>0.1.0</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Donation extension allow users to donate funds before checkout for the charity purpose </summary>
10
- <description>&lt;h2&gt;Checkout Tool for Easy Donation&lt;/h2&gt;&#xD;
11
- &#xD;
12
- &lt;p&gt;&lt;span&gt;We&#x2019;ve created a checkout easy donation tool which easily integrates into your checkout process with no impact on IT and Operations and at no cost - so you can stay focused on your core business. This is a customized tool extended of core magento checkout process for customers to round up their change or add an extra dollar to their balance for donation to a charity as administrator has defined the cause for charity, distribute them to the corresponding non-profits.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&#xD;
13
- &#xD;
14
- &lt;h3&gt;Better Business&lt;/h3&gt;&#xD;
15
- &lt;p&gt;&lt;span&gt;&lt;strong&gt;People talk and you should too&lt;/strong&gt;&lt;/span&gt;:&amp;nbsp;Implementing a donation tool is something to be proud of. Your customers, partners and suppliers want to know about the good you&#x2019;re doing in your communities and theirs. Our module gives you the opportunity to easily and effectively support the charities you and your customers care about most.&lt;/p&gt;&#xD;
16
- &#xD;
17
- &lt;h3&gt;Enjoyment&lt;/h3&gt;&#xD;
18
- &lt;p&gt;Science has proven doing good makes us feel great. Give yourself and your employees the chance to be more creative, involved and exhilarated by making a difference through easy donations.&lt;/p&gt;&#xD;
19
- &#xD;
20
- &#xD;
21
- &lt;h3&gt;Ready Made and Easy to Implement&lt;/h3&gt;&#xD;
22
- &lt;p&gt;Admin just will have to install the module using connect manager, module will be installed and will work at the checkout process there no extra developer efforts needed.&lt;/p&gt;&#xD;
23
- &#xD;
24
- &lt;h3&gt;Native look and feel&lt;/h3&gt;&#xD;
25
- &lt;p&gt;Integration into your shopping cart will be seamless. This Magento Extension has flexible parameters allowing it to be completely customized to the layout of your site.&lt;/p&gt;</description>
26
- <notes>magento 1.6, 1.7 to 1.8.1 version checkout tool for donations&#xD;
27
- </notes>
28
- <authors><author><name>Weblineindia</name><user>Weblineindia</user><email>partners@weblineindia.com</email></author></authors>
29
- <date>2014-03-04</date>
30
- <time>09:19:24</time>
31
- <contents><target name="magelocal"><dir name="Wli"><dir name="Donation"><dir name="Block"><dir name="Adminhtml"><dir name="Donation"><file name="Grid.php" hash="2b16a143853b19c8eec39d2de082551b"/><dir name="Renderer"><file name="Order.php" hash="c130752765eda9fbc8f148cf91e2d8da"/></dir></dir><file name="Donation.php" hash="2d7cafce99bd09db0a63da5aa64ca382"/></dir></dir><dir name="Helper"><file name="Data.php" hash="57e09b77eb2b9f0dbb59695d53565019"/></dir><dir name="Model"><file name="Donation.php" hash="2622350356a46fe03f0768378edd1a54"/><dir name="Mysql4"><dir name="Donation"><file name="Collection.php" hash="1d8709aef31b4d90c91c8ab7e9d2ebb2"/></dir><file name="Donation.php" hash="b636c69f64dfdf817af37fe4e4b94a04"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="DonationController.php" hash="f1aa9164643ef6d9774054e7c2bf14e5"/></dir><file name="IndexController.php" hash="0a41965289f5afb0cbc70cc2d183be2f"/></dir><dir name="etc"><file name="config.xml" hash="6c571040b3b58aff40079f634175f2bd"/></dir><dir name="sql"><dir name="donation_setup"><file name="mysql4-install-0.1.0.php" hash="c83106a41f6de950c658205f959a6add"/></dir></dir></dir><dir name="Wlicheckout"><dir name="controllers"><file name="OnepageController.php" hash="f6c42430a0cc0cf57ce20529e3ad9899"/><file name="OnepageController.php~" hash="edb607cd85edc4a50214c44d37688516"/></dir><dir name="etc"><file name="config.xml" hash="9d0193a96762e8a18f69a3c996a364e4"/><file name="config.xml~" hash="9d0193a96762e8a18f69a3c996a364e4"/></dir></dir><dir name="Wlisales"><dir name="Model"><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Donation.php" hash="04724618110e6ce515309a721614cded"/><file name="Donation.php~" hash="b9a386b3f7db1ec3c9a3bd7874ba3954"/><file name="Grand.php" hash="bb98cf9abb6ff7394561d29c0d07f7af"/><file name="Grand.php~" hash="bb98cf9abb6ff7394561d29c0d07f7af"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="1fc1289f359223444388201632ebe9a8"/><file name="config.xml~" hash="510baaf2055c3f07a80040612ada0463"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wli_Donation.xml" hash="ffc3c156ac21aa4fcd46a05079496abd"/><file name="Wli_Wlicheckout.xml" hash="92ea9463eb23e3debdf0652b53510d92"/><file name="Wli_Wlisales.xml" hash="68abb6d4020ee32b36dc5798b0fa2541"/></dir></target><target name="magemedia"><dir name="images"><file name="icon-help.png" hash="ffe6d5044a6004e47862a4de5c480b3c"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="donation.xml" hash="9f711a3394d210794af9217370ddbada"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="wli"><dir name="donation"><dir name="checkout"><file name="cart.phtml" hash="a3202fc5954ec9d3aa44b079971b9ce7"/></dir></dir></dir></dir><dir name="layout"><file name="donation.xml" hash="1cd13ec23f6feb67292fad255b65db8d"/></dir></dir></dir></dir></target></contents>
32
  <compatible/>
33
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
34
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Easy_Donation</name>
4
+ <version>0.1.1</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Easy Donate</summary>
10
+ <description>Easy Donate</description>
11
+ <notes>- Donation amount displayed in view order page&#xD;
12
+ - Fixed paypal donation amount issue.</notes>
13
+ <authors><author><name>Weblineindia</name><user>weblineindia</user><email>partners@weblineindia.com</email></author></authors>
14
+ <date>2014-08-04</date>
15
+ <time>14:25:42</time>
16
+ <contents><target name="mageetc"><dir name="modules"><file name="Wli_Donation.xml" hash="6965df2858d765309a524a4bd5ee233a"/><file name="Wli_Wlicheckout.xml" hash="92ea9463eb23e3debdf0652b53510d92"/><file name="Wli_Wlipaypal.xml" hash="56e0daf3cc753a7612ceac60c901fab0"/><file name="Wli_Wlisales.xml" hash="68abb6d4020ee32b36dc5798b0fa2541"/></dir></target><target name="magelocal"><dir name="Wli"><dir name="Donation"><dir name="Block"><dir name="Adminhtml"><dir name="Donation"><file name="Grid.php" hash="2b16a143853b19c8eec39d2de082551b"/><dir name="Renderer"><file name="Order.php" hash="c130752765eda9fbc8f148cf91e2d8da"/></dir></dir><file name="Donation.php" hash="2d7cafce99bd09db0a63da5aa64ca382"/></dir></dir><dir name="Helper"><file name="Data.php" hash="57e09b77eb2b9f0dbb59695d53565019"/></dir><dir name="Model"><file name="Donation.php" hash="2622350356a46fe03f0768378edd1a54"/><dir name="Mysql4"><dir name="Donation"><file name="Collection.php" hash="1d8709aef31b4d90c91c8ab7e9d2ebb2"/></dir><file name="Donation.php" hash="b636c69f64dfdf817af37fe4e4b94a04"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="DonationController.php" hash="b30e6cd02c96ce39149373c6f7cbbe1a"/></dir><file name="IndexController.php" hash="0a41965289f5afb0cbc70cc2d183be2f"/></dir><dir name="etc"><file name="config.xml" hash="636646fef9883d34559a5ba4331de9f3"/><file name="config.xml~" hash="6c571040b3b58aff40079f634175f2bd"/></dir><dir name="sql"><dir name="donation_setup"><file name="mysql4-install-0.1.1.php" hash="c83106a41f6de950c658205f959a6add"/></dir></dir></dir><dir name="Wlicheckout"><dir name="controllers"><file name="OnepageController.php" hash="f6c42430a0cc0cf57ce20529e3ad9899"/><file name="OnepageController.php~" hash="edb607cd85edc4a50214c44d37688516"/></dir><dir name="etc"><file name="config.xml" hash="44a4d4aa25fb9fa653b17c2f9e4f792f"/><file name="config.xml~" hash="9d0193a96762e8a18f69a3c996a364e4"/></dir></dir><dir name="Wlipaypal"><dir name="Model"><file name="Standard.php" hash="e59851fb598bcc0fb9d483f366184eed"/><file name="Standard.php~" hash="556b98ca6370990b2e528f6d0d93deb3"/></dir><dir name="etc"><file name="config.xml" hash="40603ff49465d1c8242ee800a417ca74"/><file name="config.xml~" hash="7910ba527b1810c88f3b2b4e0d8befb5"/></dir></dir><dir name="Wlisales"><dir name="Model"><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Donation.php" hash="04724618110e6ce515309a721614cded"/><file name="Donation.php~" hash="b9a386b3f7db1ec3c9a3bd7874ba3954"/><file name="Grand.php" hash="c73d7c3d16aea089fd2d69fa36c07a4f"/><file name="Grand.php~" hash="bb98cf9abb6ff7394561d29c0d07f7af"/></dir></dir></dir></dir><dir name="Sales"><dir name="Order"><file name="Total.php" hash="7261089e09ce12cf4afb192dea00ece3"/></dir></dir><dir name="etc"><file name="config.xml" hash="65eee65879784534bd1b2c5970e571b3"/><file name="config.xml~" hash="7f3d3ba84443f926a7a99860613e63f6"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="wlisales.xml" hash="7dccd3192a631673661a7e017f350487"/></dir><dir name="template"><dir name="wlisales"><dir name="sales"><dir name="order"><file name="refunded.phtml" hash="f4239d313366d75907a34b3342b35eb1"/><file name="total.phtml" hash="e2b034b4217b4001dd40dd9b4dae00e1"/><file name="total.phtml~" hash="57206b7df217d21555828f3487fa695c"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="donation.xml" hash="1cd13ec23f6feb67292fad255b65db8d"/></dir><dir name="template"><dir name="wli"><dir name="donation"><dir name="checkout"><file name="cart.phtml" hash="a3202fc5954ec9d3aa44b079971b9ce7"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  <compatible/>
18
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
19
  </package>