Easy_Donation - Version 0.1.0

Version Notes

magento 1.6, 1.7 to 1.8.1 version checkout tool for donations

Download this release

Release Info

Developer Weblineindia
Extension Easy_Donation
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (29) hide show
  1. app/code/local/Wli/Donation/Block/Adminhtml/Donation.php +21 -0
  2. app/code/local/Wli/Donation/Block/Adminhtml/Donation/Grid.php +85 -0
  3. app/code/local/Wli/Donation/Block/Adminhtml/Donation/Renderer/Order.php +23 -0
  4. app/code/local/Wli/Donation/Helper/Data.php +5 -0
  5. app/code/local/Wli/Donation/Model/Donation.php +40 -0
  6. app/code/local/Wli/Donation/Model/Mysql4/Donation.php +9 -0
  7. app/code/local/Wli/Donation/Model/Mysql4/Donation/Collection.php +10 -0
  8. app/code/local/Wli/Donation/controllers/Adminhtml/DonationController.php +33 -0
  9. app/code/local/Wli/Donation/controllers/IndexController.php +22 -0
  10. app/code/local/Wli/Donation/etc/config.xml +125 -0
  11. app/code/local/Wli/Donation/sql/donation_setup/mysql4-install-0.1.0.php +35 -0
  12. app/code/local/Wli/Wlicheckout/controllers/OnepageController.php +259 -0
  13. app/code/local/Wli/Wlicheckout/controllers/OnepageController.php~ +156 -0
  14. app/code/local/Wli/Wlicheckout/etc/config.xml +19 -0
  15. app/code/local/Wli/Wlicheckout/etc/config.xml~ +19 -0
  16. app/code/local/Wli/Wlisales/Model/Quote/Address/Total/Donation.php +183 -0
  17. app/code/local/Wli/Wlisales/Model/Quote/Address/Total/Donation.php~ +182 -0
  18. app/code/local/Wli/Wlisales/Model/Quote/Address/Total/Grand.php +63 -0
  19. app/code/local/Wli/Wlisales/Model/Quote/Address/Total/Grand.php~ +63 -0
  20. app/code/local/Wli/Wlisales/etc/config.xml +27 -0
  21. app/code/local/Wli/Wlisales/etc/config.xml~ +19 -0
  22. app/design/adminhtml/default/default/layout/donation.xml +8 -0
  23. app/design/frontend/default/default/layout/donation.xml +12 -0
  24. app/design/frontend/default/default/template/wli/donation/checkout/cart.phtml +182 -0
  25. app/etc/modules/Wli_Donation.xml +29 -0
  26. app/etc/modules/Wli_Wlicheckout.xml +9 -0
  27. app/etc/modules/Wli_Wlisales.xml +9 -0
  28. media/images/icon-help.png +0 -0
  29. package.xml +34 -0
app/code/local/Wli/Donation/Block/Adminhtml/Donation.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Donation List admin grid container
4
+ *
5
+ * @author Weblineindia
6
+ */
7
+ class Wli_Donation_Block_Adminhtml_Donation extends Mage_Adminhtml_Block_Widget_Grid_Container
8
+ {
9
+ /**
10
+ * Block constructor
11
+ */
12
+ public function __construct()
13
+ {
14
+ $this->_controller = 'adminhtml_donation';
15
+ $this->_blockGroup = 'donation';
16
+ $this->_headerText = Mage::helper('donation')->__('Donation Details');
17
+ // $this->_removeButton = Mage::helper('donation')->__('Add Item');
18
+ parent::__construct();
19
+ $this->removeButton('add');
20
+ }
21
+ }
app/code/local/Wli/Donation/Block/Adminhtml/Donation/Grid.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Wli_Donation_Block_Adminhtml_Donation_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('donationGrid');
9
+ // This is the primary key of the database
10
+ $this->setDefaultSort('donation_id');
11
+ $this->setDefaultDir('ASC');
12
+ $this->setSaveParametersInSession(true);
13
+ $this->setUseAjax(true);
14
+ }
15
+
16
+ protected function _prepareCollection()
17
+ {
18
+ $collection = Mage::getModel('donation/donation')->getCollection();
19
+ $this->setCollection($collection);
20
+ return parent::_prepareCollection();
21
+ }
22
+
23
+ protected function _prepareColumns()
24
+ {
25
+ $this->addColumn('donation_id', array(
26
+ 'header' => Mage::helper('donation')->__('ID'),
27
+ 'align' =>'right',
28
+ 'width' => '50px',
29
+ 'index' => 'donation_id',
30
+ ));
31
+
32
+ $this->addColumn('order_id', array(
33
+ 'header' => Mage::helper('donation')->__('Order ID'),
34
+ 'align' =>'left',
35
+ 'index' => 'order_id',
36
+ 'filter' => false,
37
+ 'sortable' => false,
38
+ 'renderer' => 'donation/adminhtml_donation_renderer_order'
39
+
40
+ ));
41
+
42
+ /*
43
+ $this->addColumn('content', array(
44
+ 'header' => Mage::helper('<module>')->__('Item Content'),
45
+ 'width' => '150px',
46
+ 'index' => 'content',
47
+ ));
48
+ */
49
+
50
+ $this->addColumn('donation_amount', array(
51
+ 'header' => Mage::helper('donation')->__('Donation Amount'),
52
+ 'align' => 'left',
53
+ 'index' => 'donation_amount',
54
+ ));
55
+
56
+ $this->addColumn('customer_firstname', array(
57
+ 'header' => Mage::helper('donation')->__('Customer FirstName'),
58
+ 'align' => 'left',
59
+ 'index' => 'customer_firstname',
60
+ ));
61
+
62
+
63
+ $this->addColumn('customer_lastname', array(
64
+ 'header' => Mage::helper('donation')->__('Customer LastName'),
65
+ 'align' => 'left',
66
+ 'index' => 'customer_lastname',
67
+ ));
68
+
69
+ $this->addColumn('customer_email', array(
70
+ 'header' => Mage::helper('donation')->__('Customer Email'),
71
+ 'align' => 'left',
72
+ 'index' => 'customer_email',
73
+ ));
74
+
75
+ return parent::_prepareColumns();
76
+ }
77
+
78
+
79
+ public function getGridUrl()
80
+ {
81
+ return $this->getUrl('*/*/grid', array('_current'=>true));
82
+ }
83
+
84
+
85
+ }
app/code/local/Wli/Donation/Block/Adminhtml/Donation/Renderer/Order.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Wli_Donation_Block_Adminhtml_Donation_Renderer_Order extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
+ {
4
+ /**
5
+ * @return Distributor Name
6
+ */
7
+ public function render(Varien_Object $row)
8
+ {
9
+
10
+ $order_id = $row['order_id'];
11
+ $orderId = Mage::getModel('sales/order')
12
+ ->loadByIncrementId($order_id)
13
+ ->getEntityId();
14
+ $order_id_link = Mage::helper('adminhtml')->getUrl('adminhtml/sales_order/view', array('order_id' => $orderId));
15
+
16
+ $html = '<div>';
17
+ $html .= '<span>'?> <a href="<?php echo $order_id_link;?>" title="Order Id"><?php echo $order_id;?></a><?php '</span>';
18
+ $html .= '</div>';
19
+ return $html;
20
+
21
+ }
22
+ }
23
+ ?>
app/code/local/Wli/Donation/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Wli_Donation_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+
5
+ }
app/code/local/Wli/Donation/Model/Donation.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Wli_Donation_Model_Donation extends Mage_Core_Model_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('donation/donation');
9
+ }
10
+ /**
11
+ * @param array $fieldArray, string $tableName.
12
+ * @param $fieldArray key === table column
13
+ * insert data into $tableName.
14
+ */
15
+ public function insert($fieldArray,$tableName)
16
+ {
17
+ $query_append = null;
18
+ $query_append .= "INSERT INTO `".Mage::getConfig()->getTablePrefix()."".$tableName."` ";
19
+ foreach($fieldArray as $key => $val)
20
+ {
21
+ $query_append_field .= "`$key`".',';
22
+ $query_append_values .= "'$val'".',';
23
+ }
24
+ $query_append .= '('.rtrim($query_append_field,",").') VALUES ('.rtrim($query_append_values,",").')';
25
+
26
+ $this->executeSql($query_append);
27
+ }
28
+ /**
29
+ * @param string $query
30
+ * excute query in database table
31
+ */
32
+ public function executeSql($query)
33
+ {
34
+ // fetch write database connection that is used in Mage_Core module
35
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
36
+
37
+ // now $write is an instance of Zend_Db_Adapter_Abstract
38
+ $write->query("$query");
39
+ }
40
+ }
app/code/local/Wli/Donation/Model/Mysql4/Donation.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Wli_Donation_Model_Mysql4_Donation extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('donation/donation', 'donation_id');
8
+ }
9
+ }
app/code/local/Wli/Donation/Model/Mysql4/Donation/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Wli_Donation_Model_Mysql4_Donation_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ //parent::__construct();
8
+ $this->_init('donation/donation');
9
+ }
10
+ }
app/code/local/Wli/Donation/controllers/Adminhtml/DonationController.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Wli_Donation_Adminhtml_DonationController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+
6
+ protected function _initAction()
7
+ {
8
+
9
+ $this->loadLayout()
10
+ ->_setActiveMenu('donation/wli_donation')
11
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Donation Details'));
12
+ return $this;
13
+ }
14
+
15
+ public function indexAction() {
16
+ $this->_initAction();
17
+ //$this->_addContent($this->getLayout()->createBlock('donation/adminhtml_donation'));
18
+ $this->renderLayout();
19
+ }
20
+
21
+
22
+ /**
23
+ * Product grid for AJAX request.
24
+ * Sort and filter result for example.
25
+ */
26
+ public function gridAction()
27
+ {
28
+ $this->loadLayout();
29
+ $this->getResponse()->setBody(
30
+ $this->getLayout()->createBlock('donation/adminhtml_donation_grid')->toHtml()
31
+ );
32
+ }
33
+ }
app/code/local/Wli/Donation/controllers/IndexController.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Wli_Donation_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $this->loadLayout();
7
+ $this->renderLayout();
8
+ }
9
+ public function donationPostAction()
10
+ {
11
+
12
+ $donationamount = $this->getRequest()->getParam('donation_amount');
13
+
14
+ $Quotes = Mage::getModel('sales/quote');
15
+
16
+ Mage::getSingleton('core/session')->setDonationAmount($donationamount);
17
+
18
+ $this->_redirect('checkout/cart/');
19
+
20
+
21
+ }
22
+ }
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 ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+
9
+ DROP TABLE IF EXISTS {$this->getTable('donation')};
10
+ CREATE TABLE {$this->getTable('donation')} (
11
+ `donation_id` int(11) unsigned NOT NULL auto_increment,
12
+ `order_id` int(11) NOT NULL,
13
+ `donation_amount` varchar(25) NOT NULL,
14
+ `customer_firstname` varchar(50) NOT NULL,
15
+ `customer_lastname` varchar(50) NOT NULL,
16
+ `customer_email` varchar(50) NOT NULL,
17
+ PRIMARY KEY (`donation_id`)
18
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
19
+
20
+ ");
21
+
22
+ Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
23
+
24
+ $staticBlock = array(
25
+ 'title' => 'Donation Help',
26
+ 'identifier' => 'donation_help',
27
+ 'content' => 'Demo Text for easy donate tool tip, Please check the cms static block {donation_help} to change the content.',
28
+ 'is_active' => 1,
29
+ 'stores' => array(0)
30
+ );
31
+ Mage::getModel('cms/block')->setData($staticBlock)->save();
32
+
33
+
34
+ $installer->endSetup();
35
+
app/code/local/Wli/Wlicheckout/controllers/OnepageController.php ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Checkout
23
+ * @copyright Copyright (c) 2013 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
+ * Onepage controller for checkout
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Checkout
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ require_once 'Mage/Checkout/controllers/OnepageController.php';
35
+ class Wli_Wlicheckout_OnepageController extends Mage_Checkout_OnepageController
36
+ {
37
+ /**
38
+ * Create order action
39
+ */
40
+ public function saveOrderAction()
41
+ {
42
+ $m= new Mage;
43
+ $version= substr($m->getVersion(),2,1);
44
+
45
+
46
+ if($version > 7)
47
+ {
48
+
49
+ if (!$this->_validateFormKey()) {
50
+ $this->_redirect('*/*');
51
+ return;
52
+ }
53
+
54
+ if ($this->_expireAjax()) {
55
+ return;
56
+ }
57
+
58
+ $result = array();
59
+ try {
60
+ $requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds();
61
+ if ($requiredAgreements) {
62
+ $postedAgreements = array_keys($this->getRequest()->getPost('agreement', array()));
63
+ $diff = array_diff($requiredAgreements, $postedAgreements);
64
+ if ($diff) {
65
+ $result['success'] = false;
66
+ $result['error'] = true;
67
+ $result['error_messages'] = $this->__('Please agree to all the terms and conditions before placing the order.');
68
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
69
+ return;
70
+ }
71
+ }
72
+
73
+ $data = $this->getRequest()->getPost('payment', array());
74
+ if ($data) {
75
+ $data['checks'] = Mage_Payment_Model_Method_Abstract::CHECK_USE_CHECKOUT
76
+ | Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_COUNTRY
77
+ | Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_CURRENCY
78
+ | Mage_Payment_Model_Method_Abstract::CHECK_ORDER_TOTAL_MIN_MAX
79
+ | Mage_Payment_Model_Method_Abstract::CHECK_ZERO_TOTAL;
80
+ $this->getOnepage()->getQuote()->getPayment()->importData($data);
81
+ }
82
+
83
+ $this->getOnepage()->saveOrder();
84
+
85
+ // get order id and customer data for donation module by chirag
86
+
87
+ $customerData = Mage::getSingleton('customer/session')->getCustomer();
88
+ $customer_id = $customerData->getId();
89
+ $customer_data = Mage::getModel('customer/customer')->load($customer_id)->getData();
90
+
91
+ $order = new Mage_Sales_Model_Order();
92
+
93
+ $incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
94
+
95
+ $donationamount = Mage::getSingleton('core/session')->getDonationAmount();
96
+
97
+ $donationdata = array();
98
+ $donationdata['order_id'] = $incrementId;
99
+ $donationdata['donation_amount'] = $donationamount;
100
+ $donationdata['customer_firstname'] = $customer_data['firstname'];
101
+ $donationdata['customer_lastname'] = $customer_data['lastname'];
102
+ $donationdata['customer_email'] = $customer_data['email'];
103
+
104
+ Mage::getModel('donation/donation')->insert($donationdata,'donation');
105
+
106
+ $redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl();
107
+
108
+ $result['success'] = true;
109
+ $result['error'] = false;
110
+ } catch (Mage_Payment_Model_Info_Exception $e) {
111
+ $message = $e->getMessage();
112
+ if (!empty($message)) {
113
+ $result['error_messages'] = $message;
114
+ }
115
+ $result['goto_section'] = 'payment';
116
+ $result['update_section'] = array(
117
+ 'name' => 'payment-method',
118
+ 'html' => $this->_getPaymentMethodsHtml()
119
+ );
120
+ } catch (Mage_Core_Exception $e) {
121
+ Mage::logException($e);
122
+ Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
123
+ $result['success'] = false;
124
+ $result['error'] = true;
125
+ $result['error_messages'] = $e->getMessage();
126
+
127
+ $gotoSection = $this->getOnepage()->getCheckout()->getGotoSection();
128
+ if ($gotoSection) {
129
+ $result['goto_section'] = $gotoSection;
130
+ $this->getOnepage()->getCheckout()->setGotoSection(null);
131
+ }
132
+ $updateSection = $this->getOnepage()->getCheckout()->getUpdateSection();
133
+ if ($updateSection) {
134
+ if (isset($this->_sectionUpdateFunctions[$updateSection])) {
135
+ $updateSectionFunction = $this->_sectionUpdateFunctions[$updateSection];
136
+ $result['update_section'] = array(
137
+ 'name' => $updateSection,
138
+ 'html' => $this->$updateSectionFunction()
139
+ );
140
+ }
141
+ $this->getOnepage()->getCheckout()->setUpdateSection(null);
142
+ }
143
+ } catch (Exception $e) {
144
+ Mage::logException($e);
145
+ Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
146
+ $result['success'] = false;
147
+ $result['error'] = true;
148
+ $result['error_messages'] = $this->__('There was an error processing your order. Please contact us or try again later.');
149
+ }
150
+ $this->getOnepage()->getQuote()->save();
151
+
152
+ /**
153
+ * when there is redirect to third party, we don't want to save order yet.
154
+ * we will save the order in return action.
155
+ */
156
+ if (isset($redirectUrl)) {
157
+ $result['redirect'] = $redirectUrl;
158
+ }
159
+
160
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
161
+ }else
162
+ {
163
+ if ($this->_expireAjax()) {
164
+ return;
165
+ }
166
+
167
+ $result = array();
168
+ try {
169
+ if ($requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds()) {
170
+ $postedAgreements = array_keys($this->getRequest()->getPost('agreement', array()));
171
+ if ($diff = array_diff($requiredAgreements, $postedAgreements)) {
172
+ $result['success'] = false;
173
+ $result['error'] = true;
174
+ $result['error_messages'] = $this->__('Please agree to all the terms and conditions before placing the order.');
175
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
176
+ return;
177
+ }
178
+ }
179
+ if ($data = $this->getRequest()->getPost('payment', false)) {
180
+ $this->getOnepage()->getQuote()->getPayment()->importData($data);
181
+ }
182
+ $this->getOnepage()->saveOrder();
183
+
184
+ // get order id and customer data for donation module by chirag
185
+
186
+ $customerData = Mage::getSingleton('customer/session')->getCustomer();
187
+ $customer_id = $customerData->getId();
188
+ $customer_data = Mage::getModel('customer/customer')->load($customer_id)->getData();
189
+
190
+ $order = new Mage_Sales_Model_Order();
191
+
192
+ $incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
193
+
194
+ $donationamount = Mage::getSingleton('core/session')->getDonationAmount();
195
+
196
+ $donationdata = array();
197
+ $donationdata['order_id'] = $incrementId;
198
+ $donationdata['donation_amount'] = $donationamount;
199
+ $donationdata['customer_firstname'] = $customer_data['firstname'];
200
+ $donationdata['customer_lastname'] = $customer_data['lastname'];
201
+ $donationdata['customer_email'] = $customer_data['email'];
202
+
203
+ Mage::getModel('donation/donation')->insert($donationdata,'donation');
204
+
205
+ $redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl();
206
+ $result['success'] = true;
207
+ $result['error'] = false;
208
+ } catch (Mage_Payment_Model_Info_Exception $e) {
209
+ $message = $e->getMessage();
210
+ if( !empty($message) ) {
211
+ $result['error_messages'] = $message;
212
+ }
213
+ $result['goto_section'] = 'payment';
214
+ $result['update_section'] = array(
215
+ 'name' => 'payment-method',
216
+ 'html' => $this->_getPaymentMethodsHtml()
217
+ );
218
+ } catch (Mage_Core_Exception $e) {
219
+ Mage::logException($e);
220
+ Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
221
+ $result['success'] = false;
222
+ $result['error'] = true;
223
+ $result['error_messages'] = $e->getMessage();
224
+
225
+ if ($gotoSection = $this->getOnepage()->getCheckout()->getGotoSection()) {
226
+ $result['goto_section'] = $gotoSection;
227
+ $this->getOnepage()->getCheckout()->setGotoSection(null);
228
+ }
229
+
230
+ if ($updateSection = $this->getOnepage()->getCheckout()->getUpdateSection()) {
231
+ if (isset($this->_sectionUpdateFunctions[$updateSection])) {
232
+ $updateSectionFunction = $this->_sectionUpdateFunctions[$updateSection];
233
+ $result['update_section'] = array(
234
+ 'name' => $updateSection,
235
+ 'html' => $this->$updateSectionFunction()
236
+ );
237
+ }
238
+ $this->getOnepage()->getCheckout()->setUpdateSection(null);
239
+ }
240
+ } catch (Exception $e) {
241
+ Mage::logException($e);
242
+ Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
243
+ $result['success'] = false;
244
+ $result['error'] = true;
245
+ $result['error_messages'] = $this->__('There was an error processing your order. Please contact us or try again later.');
246
+ }
247
+ $this->getOnepage()->getQuote()->save();
248
+ /**
249
+ * when there is redirect to third party, we don't want to save order yet.
250
+ * we will save the order in return action.
251
+ */
252
+ if (isset($redirectUrl)) {
253
+ $result['redirect'] = $redirectUrl;
254
+ }
255
+
256
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
257
+ }
258
+ }
259
+ }
app/code/local/Wli/Wlicheckout/controllers/OnepageController.php~ ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Checkout
23
+ * @copyright Copyright (c) 2013 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
+ * Onepage controller for checkout
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Checkout
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ require_once 'Mage/Checkout/controllers/OnepageController.php';
35
+ class Wli_Wlicheckout_OnepageController extends Mage_Checkout_OnepageController
36
+ {
37
+ /**
38
+ * Create order action
39
+ */
40
+ public function saveOrderAction()
41
+ {
42
+ if (!$this->_validateFormKey()) {
43
+ $this->_redirect('*/*');
44
+ return;
45
+ }
46
+
47
+ if ($this->_expireAjax()) {
48
+ return;
49
+ }
50
+
51
+ $result = array();
52
+ try {
53
+ $requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds();
54
+ if ($requiredAgreements) {
55
+ $postedAgreements = array_keys($this->getRequest()->getPost('agreement', array()));
56
+ $diff = array_diff($requiredAgreements, $postedAgreements);
57
+ if ($diff) {
58
+ $result['success'] = false;
59
+ $result['error'] = true;
60
+ $result['error_messages'] = $this->__('Please agree to all the terms and conditions before placing the order.');
61
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
62
+ return;
63
+ }
64
+ }
65
+
66
+ $data = $this->getRequest()->getPost('payment', array());
67
+ if ($data) {
68
+ $data['checks'] = Mage_Payment_Model_Method_Abstract::CHECK_USE_CHECKOUT
69
+ | Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_COUNTRY
70
+ | Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_CURRENCY
71
+ | Mage_Payment_Model_Method_Abstract::CHECK_ORDER_TOTAL_MIN_MAX
72
+ | Mage_Payment_Model_Method_Abstract::CHECK_ZERO_TOTAL;
73
+ $this->getOnepage()->getQuote()->getPayment()->importData($data);
74
+ }
75
+
76
+ $this->getOnepage()->saveOrder();
77
+
78
+ // get order id and customer data for donation module by chirag
79
+
80
+ $customerData = Mage::getSingleton('customer/session')->getCustomer();
81
+ $customer_id = $customerData->getId();
82
+ $customer_data = Mage::getModel('customer/customer')->load($customer_id)->getData();
83
+
84
+ $order = new Mage_Sales_Model_Order();
85
+
86
+ $incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
87
+
88
+ $donationamount = Mage::getSingleton('core/session')->getDonationAmount();
89
+
90
+ $donationdata = array();
91
+ $donationdata['order_id'] = $incrementId;
92
+ $donationdata['donation_amount'] = $donationamount;
93
+ $donationdata['customer_firstname'] = $customer_data['firstname'];
94
+ $donationdata['customer_lastname'] = $customer_data['lastname'];
95
+ $donationdata['customer_email'] = $customer_data['email'];
96
+
97
+ Mage::getModel('donation/donation')->insert($donationdata,'donation');
98
+
99
+ $redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl();
100
+
101
+ $result['success'] = true;
102
+ $result['error'] = false;
103
+ } catch (Mage_Payment_Model_Info_Exception $e) {
104
+ $message = $e->getMessage();
105
+ if (!empty($message)) {
106
+ $result['error_messages'] = $message;
107
+ }
108
+ $result['goto_section'] = 'payment';
109
+ $result['update_section'] = array(
110
+ 'name' => 'payment-method',
111
+ 'html' => $this->_getPaymentMethodsHtml()
112
+ );
113
+ } catch (Mage_Core_Exception $e) {
114
+ Mage::logException($e);
115
+ Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
116
+ $result['success'] = false;
117
+ $result['error'] = true;
118
+ $result['error_messages'] = $e->getMessage();
119
+
120
+ $gotoSection = $this->getOnepage()->getCheckout()->getGotoSection();
121
+ if ($gotoSection) {
122
+ $result['goto_section'] = $gotoSection;
123
+ $this->getOnepage()->getCheckout()->setGotoSection(null);
124
+ }
125
+ $updateSection = $this->getOnepage()->getCheckout()->getUpdateSection();
126
+ if ($updateSection) {
127
+ if (isset($this->_sectionUpdateFunctions[$updateSection])) {
128
+ $updateSectionFunction = $this->_sectionUpdateFunctions[$updateSection];
129
+ $result['update_section'] = array(
130
+ 'name' => $updateSection,
131
+ 'html' => $this->$updateSectionFunction()
132
+ );
133
+ }
134
+ $this->getOnepage()->getCheckout()->setUpdateSection(null);
135
+ }
136
+ } catch (Exception $e) {
137
+ Mage::logException($e);
138
+ Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
139
+ $result['success'] = false;
140
+ $result['error'] = true;
141
+ $result['error_messages'] = $this->__('There was an error processing your order. Please contact us or try again later.');
142
+ }
143
+ $this->getOnepage()->getQuote()->save();
144
+
145
+ /**
146
+ * when there is redirect to third party, we don't want to save order yet.
147
+ * we will save the order in return action.
148
+ */
149
+ if (isset($redirectUrl)) {
150
+ $result['redirect'] = $redirectUrl;
151
+ }
152
+
153
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
154
+
155
+ }
156
+ }
app/code/local/Wli/Wlicheckout/etc/config.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Wli_Wlicheckout>
5
+ <version>0.1.0</version>
6
+ </Wli_Wlicheckout>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <checkout>
11
+ <args>
12
+ <modules>
13
+ <Wli_Wlicheckout before="Mage_Checkout">Wli_Wlicheckout</Wli_Wlicheckout>
14
+ </modules>
15
+ </args>
16
+ </checkout>
17
+ </routers>
18
+ </frontend>
19
+ </config>
app/code/local/Wli/Wlicheckout/etc/config.xml~ ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Wli_Wlicheckout>
5
+ <version>0.1.0</version>
6
+ </Wli_Wlicheckout>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <checkout>
11
+ <args>
12
+ <modules>
13
+ <Wli_Wlicheckout before="Mage_Checkout">Wli_Wlicheckout</Wli_Wlicheckout>
14
+ </modules>
15
+ </args>
16
+ </checkout>
17
+ </routers>
18
+ </frontend>
19
+ </config>
app/code/local/Wli/Wlisales/Model/Quote/Address/Total/Donation.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Sales
23
+ * @copyright Copyright (c) 2013 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
+ class Wli_Wlisales_Model_Quote_Address_Total_Donation extends Mage_Sales_Model_Quote_Address_Total_Abstract
29
+ {
30
+ public function __construct()
31
+ {
32
+
33
+ $this->setCode('donation');
34
+ }
35
+
36
+ /**
37
+ * Collect totals information about shipping
38
+ *
39
+ * @param Mage_Sales_Model_Quote_Address $address
40
+ * @return Mage_Sales_Model_Quote_Address_Total_Shipping
41
+ */
42
+ public function collect(Mage_Sales_Model_Quote_Address $address)
43
+ {
44
+
45
+ $quote = $address->getQuote();
46
+ $eventArgs = array(
47
+ 'website_id'=>Mage::app()->getStore($quote->getStoreId())->getWebsiteId(),
48
+ 'customer_group_id'=>$quote->getCustomerGroupId(),
49
+ 'coupon_code'=>$quote->getCouponCode(),
50
+ );
51
+
52
+ $address->setFreeShipping(0);
53
+ $totalDiscountAmount = 0;
54
+ $subtotalWithDiscount= 0;
55
+ $baseTotalDiscountAmount = 0;
56
+ $baseSubtotalWithDiscount= 0;
57
+
58
+ $items = $address->getAllItems();
59
+ if (!count($items)) {
60
+ $address->setDiscountAmount($totalDiscountAmount);
61
+ $address->setSubtotalWithDiscount($subtotalWithDiscount);
62
+ $address->setBaseDiscountAmount($baseTotalDiscountAmount);
63
+ $address->setBaseSubtotalWithDiscount($baseSubtotalWithDiscount);
64
+ return $this;
65
+ }
66
+
67
+ $hasDiscount = false;
68
+ foreach ($items as $item) {
69
+ if ($item->getNoDiscount()) {
70
+ $item->setDiscountAmount(0);
71
+ $item->setBaseDiscountAmount(0);
72
+ $item->setRowTotalWithDiscount($item->getRowTotal());
73
+ $item->setBaseRowTotalWithDiscount($item->getRowTotal());
74
+
75
+ $subtotalWithDiscount+=$item->getRowTotal();
76
+ $baseSubtotalWithDiscount+=$item->getBaseRowTotal();
77
+ }
78
+ else {
79
+ /**
80
+ * Child item discount we calculate for parent
81
+ */
82
+ if ($item->getParentItemId()) {
83
+ continue;
84
+ }
85
+
86
+ /**
87
+ * Composite item discount calculation
88
+ */
89
+
90
+ if ($item->getHasChildren() && $item->isChildrenCalculated()) {
91
+ foreach ($item->getChildren() as $child) {
92
+ $eventArgs['item'] = $child;
93
+ Mage::dispatchEvent('sales_quote_address_discount_item', $eventArgs);
94
+
95
+ if ($child->getDiscountAmount() || $child->getFreeShipping()) {
96
+ $hasDiscount = true;
97
+ }
98
+
99
+ /**
100
+ * Parent free shipping we apply to all children
101
+ */
102
+ if ($item->getFreeShipping()) {
103
+ $child->setFreeShipping($item->getFreeShipping());
104
+ }
105
+
106
+ /**
107
+ * @todo Parent discount we apply for all children without discount
108
+ */
109
+ if (!$child->getDiscountAmount() && $item->getDiscountPercent()) {
110
+
111
+ }
112
+ $totalDiscountAmount += $child->getDiscountAmount();//*$item->getQty();
113
+ $baseTotalDiscountAmount += $child->getBaseDiscountAmount();//*$item->getQty();
114
+
115
+ $child->setRowTotalWithDiscount($child->getRowTotal()-$child->getDiscountAmount());
116
+ $child->setBaseRowTotalWithDiscount($child->getBaseRowTotal()-$child->getBaseDiscountAmount());
117
+
118
+ $subtotalWithDiscount+=$child->getRowTotalWithDiscount();
119
+ $baseSubtotalWithDiscount+=$child->getBaseRowTotalWithDiscount();
120
+ }
121
+ }
122
+ else {
123
+ $eventArgs['item'] = $item;
124
+ Mage::dispatchEvent('sales_quote_address_discount_item', $eventArgs);
125
+
126
+ if ($item->getDiscountAmount() || $item->getFreeShipping()) {
127
+ $hasDiscount = true;
128
+ }
129
+ $totalDiscountAmount += $item->getDiscountAmount();
130
+ $baseTotalDiscountAmount += $item->getBaseDiscountAmount();
131
+
132
+ $item->setRowTotalWithDiscount($item->getRowTotal()-$item->getDiscountAmount());
133
+ $item->setBaseRowTotalWithDiscount($item->getBaseRowTotal()-$item->getBaseDiscountAmount());
134
+
135
+ $subtotalWithDiscount+=$item->getRowTotalWithDiscount();
136
+ $baseSubtotalWithDiscount+=$item->getBaseRowTotalWithDiscount();
137
+ }
138
+ }
139
+ }
140
+ $address->setDonationAmount(Mage::getSingleton('core/session')->getDonationAmount());
141
+ $address->setSubtotalWithDiscount($subtotalWithDiscount);
142
+ $address->setBaseDiscountAmount($baseTotalDiscountAmount);
143
+ $address->setBaseSubtotalWithDiscount($baseSubtotalWithDiscount);
144
+
145
+ $address->setGrandTotal($address->getGrandTotal() - $address->getDiscountAmount());
146
+ $address->setBaseGrandTotal($address->getBaseGrandTotal()-$address->getBaseDiscountAmount());
147
+ return $this;
148
+ }
149
+
150
+ /**
151
+ * Add shipping totals information to address object
152
+ *
153
+ * @param Mage_Sales_Model_Quote_Address $address
154
+ * @return Mage_Sales_Model_Quote_Address_Total_Shipping
155
+ */
156
+ public function fetch(Mage_Sales_Model_Quote_Address $address)
157
+ {
158
+ $amount = $address->getDonationAmount();
159
+ if ($amount!=0) {
160
+ $title = Mage::helper('sales')->__('Donation');
161
+ $code = $address->getCouponCode();
162
+ if (strlen($code)) {
163
+ $title = Mage::helper('sales')->__('Donation (%s)', $code);
164
+ }
165
+ $address->addTotal(array(
166
+ 'code'=>$this->getCode(),
167
+ 'title'=>$title,
168
+ 'value'=>$amount
169
+ ));
170
+ }
171
+ return $this;
172
+ }
173
+
174
+ /**
175
+ * Get Shipping label
176
+ *
177
+ * @return string
178
+ */
179
+ public function getLabel()
180
+ {
181
+ return Mage::helper('sales')->__('Donation');
182
+ }
183
+ }
app/code/local/Wli/Wlisales/Model/Quote/Address/Total/Donation.php~ ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Sales
23
+ * @copyright Copyright (c) 2013 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
+ class Wli_Wlisales_Model_Quote_Address_Total_Donation extends Mage_Sales_Model_Quote_Address_Total_Abstract
29
+ {
30
+ public function __construct()
31
+ {
32
+
33
+ $this->setCode('donation');
34
+ }
35
+
36
+ /**
37
+ * Collect totals information about shipping
38
+ *
39
+ * @param Mage_Sales_Model_Quote_Address $address
40
+ * @return Mage_Sales_Model_Quote_Address_Total_Shipping
41
+ */
42
+ public function collect(Mage_Sales_Model_Quote_Address $address)
43
+ {
44
+ $quote = $address->getQuote();
45
+ $eventArgs = array(
46
+ 'website_id'=>Mage::app()->getStore($quote->getStoreId())->getWebsiteId(),
47
+ 'customer_group_id'=>$quote->getCustomerGroupId(),
48
+ 'coupon_code'=>$quote->getCouponCode(),
49
+ );
50
+
51
+ $address->setFreeShipping(0);
52
+ $totalDiscountAmount = 0;
53
+ $subtotalWithDiscount= 0;
54
+ $baseTotalDiscountAmount = 0;
55
+ $baseSubtotalWithDiscount= 0;
56
+
57
+ $items = $address->getAllItems();
58
+ if (!count($items)) {
59
+ $address->setDiscountAmount($totalDiscountAmount);
60
+ $address->setSubtotalWithDiscount($subtotalWithDiscount);
61
+ $address->setBaseDiscountAmount($baseTotalDiscountAmount);
62
+ $address->setBaseSubtotalWithDiscount($baseSubtotalWithDiscount);
63
+ return $this;
64
+ }
65
+
66
+ $hasDiscount = false;
67
+ foreach ($items as $item) {
68
+ if ($item->getNoDiscount()) {
69
+ $item->setDiscountAmount(0);
70
+ $item->setBaseDiscountAmount(0);
71
+ $item->setRowTotalWithDiscount($item->getRowTotal());
72
+ $item->setBaseRowTotalWithDiscount($item->getRowTotal());
73
+
74
+ $subtotalWithDiscount+=$item->getRowTotal();
75
+ $baseSubtotalWithDiscount+=$item->getBaseRowTotal();
76
+ }
77
+ else {
78
+ /**
79
+ * Child item discount we calculate for parent
80
+ */
81
+ if ($item->getParentItemId()) {
82
+ continue;
83
+ }
84
+
85
+ /**
86
+ * Composite item discount calculation
87
+ */
88
+
89
+ if ($item->getHasChildren() && $item->isChildrenCalculated()) {
90
+ foreach ($item->getChildren() as $child) {
91
+ $eventArgs['item'] = $child;
92
+ Mage::dispatchEvent('sales_quote_address_discount_item', $eventArgs);
93
+
94
+ if ($child->getDiscountAmount() || $child->getFreeShipping()) {
95
+ $hasDiscount = true;
96
+ }
97
+
98
+ /**
99
+ * Parent free shipping we apply to all children
100
+ */
101
+ if ($item->getFreeShipping()) {
102
+ $child->setFreeShipping($item->getFreeShipping());
103
+ }
104
+
105
+ /**
106
+ * @todo Parent discount we apply for all children without discount
107
+ */
108
+ if (!$child->getDiscountAmount() && $item->getDiscountPercent()) {
109
+
110
+ }
111
+ $totalDiscountAmount += $child->getDiscountAmount();//*$item->getQty();
112
+ $baseTotalDiscountAmount += $child->getBaseDiscountAmount();//*$item->getQty();
113
+
114
+ $child->setRowTotalWithDiscount($child->getRowTotal()-$child->getDiscountAmount());
115
+ $child->setBaseRowTotalWithDiscount($child->getBaseRowTotal()-$child->getBaseDiscountAmount());
116
+
117
+ $subtotalWithDiscount+=$child->getRowTotalWithDiscount();
118
+ $baseSubtotalWithDiscount+=$child->getBaseRowTotalWithDiscount();
119
+ }
120
+ }
121
+ else {
122
+ $eventArgs['item'] = $item;
123
+ Mage::dispatchEvent('sales_quote_address_discount_item', $eventArgs);
124
+
125
+ if ($item->getDiscountAmount() || $item->getFreeShipping()) {
126
+ $hasDiscount = true;
127
+ }
128
+ $totalDiscountAmount += $item->getDiscountAmount();
129
+ $baseTotalDiscountAmount += $item->getBaseDiscountAmount();
130
+
131
+ $item->setRowTotalWithDiscount($item->getRowTotal()-$item->getDiscountAmount());
132
+ $item->setBaseRowTotalWithDiscount($item->getBaseRowTotal()-$item->getBaseDiscountAmount());
133
+
134
+ $subtotalWithDiscount+=$item->getRowTotalWithDiscount();
135
+ $baseSubtotalWithDiscount+=$item->getBaseRowTotalWithDiscount();
136
+ }
137
+ }
138
+ }
139
+ $address->setDonationAmount(Mage::getSingleton('core/session')->getDonationAmount());
140
+ $address->setSubtotalWithDiscount($subtotalWithDiscount);
141
+ $address->setBaseDiscountAmount($baseTotalDiscountAmount);
142
+ $address->setBaseSubtotalWithDiscount($baseSubtotalWithDiscount);
143
+
144
+ $address->setGrandTotal($address->getGrandTotal() - $address->getDiscountAmount());
145
+ $address->setBaseGrandTotal($address->getBaseGrandTotal()-$address->getBaseDiscountAmount());
146
+ return $this;
147
+ }
148
+
149
+ /**
150
+ * Add shipping totals information to address object
151
+ *
152
+ * @param Mage_Sales_Model_Quote_Address $address
153
+ * @return Mage_Sales_Model_Quote_Address_Total_Shipping
154
+ */
155
+ public function fetch(Mage_Sales_Model_Quote_Address $address)
156
+ {
157
+ $amount = $address->getDonationAmount();
158
+ if ($amount!=0) {
159
+ $title = Mage::helper('sales')->__('Donation');
160
+ $code = $address->getCouponCode();
161
+ if (strlen($code)) {
162
+ $title = Mage::helper('sales')->__('Donation (%s)', $code);
163
+ }
164
+ $address->addTotal(array(
165
+ 'code'=>$this->getCode(),
166
+ 'title'=>$title,
167
+ 'value'=>$amount
168
+ ));
169
+ }
170
+ return $this;
171
+ }
172
+
173
+ /**
174
+ * Get Shipping label
175
+ *
176
+ * @return string
177
+ */
178
+ public function getLabel()
179
+ {
180
+ return Mage::helper('sales')->__('Donation');
181
+ }
182
+ }
app/code/local/Wli/Wlisales/Model/Quote/Address/Total/Grand.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Sales
23
+ * @copyright Copyright (c) 2013 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 Wlisales
32
+ * @author Weblineindia Team
33
+ */
34
+ require_once 'Mage/Sales/Model/Quote/Address/Total/Grand.php';
35
+
36
+ class Wli_Wlisales_Model_Quote_Address_Total_Grand extends Mage_Sales_Model_Quote_Address_Total_Grand
37
+ {
38
+ /**
39
+ * Collect grand total address amount
40
+ *
41
+ * @param Mage_Sales_Model_Quote_Address $address
42
+ * @return Mage_Sales_Model_Quote_Address_Total_Grand
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
+
63
+ }
app/code/local/Wli/Wlisales/Model/Quote/Address/Total/Grand.php~ ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Sales
23
+ * @copyright Copyright (c) 2013 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 Wlisales
32
+ * @author Weblineindia Team
33
+ */
34
+ require_once 'Mage/Sales/Model/Quote/Address/Total/Grand.php';
35
+
36
+ class Wli_Wlisales_Model_Quote_Address_Total_Grand extends Mage_Sales_Model_Quote_Address_Total_Grand
37
+ {
38
+ /**
39
+ * Collect grand total address amount
40
+ *
41
+ * @param Mage_Sales_Model_Quote_Address $address
42
+ * @return Mage_Sales_Model_Quote_Address_Total_Grand
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
+
63
+ }
app/code/local/Wli/Wlisales/etc/config.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <config>
3
+ <modules>
4
+ <Wli_Wlisales>
5
+ <version>0.1.0</version>
6
+ </Wli_Wlisales>
7
+ </modules>
8
+ <global>
9
+ <sales>
10
+ <quote>
11
+ <totals>
12
+ <donation>
13
+ <class>Wli_Wlisales_Model_Quote_Address_Total_Donation</class>
14
+ <before>grand_total</before>
15
+ </donation>
16
+ </totals>
17
+ </quote>
18
+ </sales>
19
+ <models>
20
+ <sales>
21
+ <rewrite>
22
+ <quote_address_total_grand>Wli_Wlisales_Model_Quote_Address_Total_Grand</quote_address_total_grand>
23
+ </rewrite>
24
+ </sales>
25
+ </models>
26
+ </global>
27
+ </config>
app/code/local/Wli/Wlisales/etc/config.xml~ ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <config>
3
+ <modules>
4
+ <Wli_Wlisales>
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>
app/design/adminhtml/default/default/layout/donation.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
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/frontend/default/default/layout/donation.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <layout version="0.1.0">
3
+
4
+ <checkout_cart_index translate="label">
5
+ <reference name="checkout.cart">
6
+ <action method="setTemplate">
7
+ <template>wli/donation/checkout/cart.phtml</template>
8
+ </action>
9
+
10
+ </reference>
11
+ </checkout_cart_index>
12
+ </layout>
app/design/frontend/default/default/template/wli/donation/checkout/cart.phtml ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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 design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * Shopping cart template
30
+ *
31
+ * @see Mage_Checkout_Block_Cart
32
+ */
33
+ ?>
34
+
35
+
36
+ <div class="cart">
37
+ <div class="page-title title-buttons">
38
+ <h1><?php echo $this->__('Shopping Cart') ?></h1>
39
+ <?php if(!$this->hasError()): ?>
40
+ <ul class="checkout-types">
41
+ <?php foreach ($this->getMethods('top_methods') as $method): ?>
42
+ <?php if ($methodHtml = $this->getMethodHtml($method)): ?>
43
+ <li><?php echo $methodHtml; ?></li>
44
+ <?php endif; ?>
45
+ <?php endforeach; ?>
46
+ </ul>
47
+ <?php endif; ?>
48
+ </div>
49
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
50
+ <?php echo $this->getChildHtml('form_before') ?>
51
+ <form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post">
52
+ <?php echo $this->getBlockHtml('formkey'); ?>
53
+ <fieldset>
54
+ <table id="shopping-cart-table" class="data-table cart-table">
55
+ <col width="1" />
56
+ <col />
57
+ <col width="1" />
58
+ <?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
59
+ <col width="1" />
60
+ <?php endif ?>
61
+ <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
62
+ <col width="1" />
63
+ <?php endif; ?>
64
+ <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
65
+ <col width="1" />
66
+ <?php endif; ?>
67
+ <col width="1" />
68
+ <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
69
+ <col width="1" />
70
+ <?php endif; ?>
71
+ <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
72
+ <col width="1" />
73
+ <?php endif; ?>
74
+ <col width="1" />
75
+
76
+ <?php $mergedCells = ($this->helper('tax')->displayCartBothPrices() ? 2 : 1); ?>
77
+ <thead>
78
+ <tr>
79
+ <th rowspan="<?php echo $mergedCells; ?>">&nbsp;</th>
80
+ <th rowspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Product Name') ?></span></th>
81
+ <th rowspan="<?php echo $mergedCells; ?>"></th>
82
+ <?php if ($this->helper('wishlist')->isAllowInCart()) : ?>
83
+ <th rowspan="<?php echo $mergedCells; ?>" class="a-center"><span class="nobr"><?php echo $this->__('Move to Wishlist') ?></span></th>
84
+ <?php endif ?>
85
+ <th class="a-center" colspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Unit Price') ?></span></th>
86
+ <th rowspan="<?php echo $mergedCells; ?>" class="a-center"><?php echo $this->__('Qty') ?></th>
87
+ <th class="a-center" colspan="<?php echo $mergedCells; ?>"><?php echo $this->__('Subtotal') ?></th>
88
+ <th rowspan="<?php echo $mergedCells; ?>" class="a-center">&nbsp;</th>
89
+ </tr>
90
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
91
+ <tr>
92
+ <th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
93
+ <th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
94
+ <th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
95
+ <th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
96
+ </tr>
97
+ <?php endif; ?>
98
+ </thead>
99
+ <tfoot>
100
+ <tr>
101
+ <td colspan="50" class="a-right">
102
+ <?php if($this->getContinueShoppingUrl()): ?>
103
+ <button type="button" title="<?php echo $this->__('Continue Shopping') ?>" class="button btn-continue" onclick="setLocation('<?php echo $this->getContinueShoppingUrl() ?>')"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
104
+ <?php endif; ?>
105
+ <button type="submit" name="update_cart_action" value="update_qty" title="<?php echo $this->__('Update Shopping Cart'); ?>" class="button btn-update"><span><span><?php echo $this->__('Update Shopping Cart'); ?></span></span></button>
106
+ <button type="submit" name="update_cart_action" value="empty_cart" title="<?php echo $this->__('Clear Shopping Cart'); ?>" class="button btn-empty" id="empty_cart_button"><span><span><?php echo $this->__('Clear Shopping Cart'); ?></span></span></button>
107
+ <!--[if lt IE 8]>
108
+ <input type="hidden" id="update_cart_action_container" />
109
+ <script type="text/javascript">
110
+ //<![CDATA[
111
+ Event.observe(window, 'load', function()
112
+ {
113
+ // Internet Explorer (lt 8) does not support value attribute in button elements
114
+ $emptyCartButton = $('empty_cart_button');
115
+ $cartActionContainer = $('update_cart_action_container');
116
+ if ($emptyCartButton && $cartActionContainer) {
117
+ Event.observe($emptyCartButton, 'click', function()
118
+ {
119
+ $emptyCartButton.setAttribute('name', 'update_cart_action_temp');
120
+ $cartActionContainer.setAttribute('name', 'update_cart_action');
121
+ $cartActionContainer.setValue('empty_cart');
122
+ });
123
+ }
124
+
125
+ });
126
+ //]]>
127
+ </script>
128
+ <![endif]-->
129
+ </td>
130
+ </tr>
131
+ </tfoot>
132
+ <tbody>
133
+ <?php foreach($this->getItems() as $_item): ?>
134
+ <?php echo $this->getItemHtml($_item) ?>
135
+ <?php endforeach ?>
136
+ </tbody>
137
+ </table>
138
+ <script type="text/javascript">decorateTable('shopping-cart-table')</script>
139
+ </fieldset>
140
+ </form>
141
+ <div class="cart-collaterals">
142
+ <div class="col2-set">
143
+ <div class="col-1">
144
+ <?php echo $this->getChildHtml('crosssell') ?>
145
+ </div>
146
+ <div class="col-2">
147
+ <form id="discount-coupon-form" action="<?php echo $this->getUrl('donation/index/donationPost') ?>" method="post">
148
+ <div class="discount">
149
+ <h2><?php echo $this->__('Donation Amount') ?>&nbsp;<a id="tooltip" href="#" title="<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('donation_help')->toHtml();?>"><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?>/images/icon-help.png"></a></h2>
150
+ <!--<div></div>-->
151
+ <div class="discount-form">
152
+ <label for="coupon_code"><?php echo $this->__('Enter Donation Amount.') ?></label>
153
+ <div class="input-box">
154
+ <input class="input-text" id="donation_amount" name="donation_amount" title="Enter donation"/>
155
+ </div>
156
+ <div class="buttons-set">
157
+ <button type="button" title="<?php echo $this->__('Add Donation') ?>" class="button" onclick="discountForm.submit(false)" value="<?php echo $this->__('Add Donation') ?>"><span><span><?php echo $this->__('Add Donation') ?></span></span></button>
158
+ <button type="clear" title="<?php echo $this->__('Clear Donation') ?>" class="button" onclick="discountForm.submit(false)" value="<?php echo $this->__('Clear Donation') ?>"><span><span><?php echo $this->__('Clear Donation') ?></span></span></button>
159
+ </div>
160
+ </div>
161
+ </div>
162
+ </form>
163
+ <?php /* Extensions placeholder */ ?>
164
+ <?php echo $this->getChildHtml('checkout.cart.extra') ?>
165
+ <?php echo $this->getChildHtml('coupon') ?>
166
+ <?php if (!$this->getIsVirtual()): echo $this->getChildHtml('shipping'); endif; ?>
167
+ </div>
168
+ </div>
169
+ <div class="totals">
170
+ <?php echo $this->getChildHtml('totals'); ?>
171
+ <?php if(!$this->hasError()): ?>
172
+ <ul class="checkout-types">
173
+ <?php foreach ($this->getMethods('methods') as $method): ?>
174
+ <?php if ($methodHtml = $this->getMethodHtml($method)): ?>
175
+ <li><?php echo $methodHtml; ?></li>
176
+ <?php endif; ?>
177
+ <?php endforeach; ?>
178
+ </ul>
179
+ <?php endif; ?>
180
+ </div>
181
+ </div>
182
+ </div>
app/etc/modules/Wli_Donation.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Wli_Donation>
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>
app/etc/modules/Wli_Wlicheckout.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Wli_Wlicheckout>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Wli_Wlicheckout>
8
+ </modules>
9
+ </config>
app/etc/modules/Wli_Wlisales.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Wli_Wlisales>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Wli_Wlisales>
8
+ </modules>
9
+ </config>
media/images/icon-help.png ADDED
Binary file
package.xml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>