flywebdesign_paypalfee - Version 0.1.3

Version Notes

Add additional payment fees to payment methods

Download this release

Release Info

Developer Fly Webservices
Extension flywebdesign_paypalfee
Version 0.1.3
Comparing to
See all releases


Code changes from version 0.1.2 to 0.1.3

app/code/local/FlyWebdesign/PaypalFee/Block/Adminhtml/Sales/Order/Totals.php CHANGED
@@ -6,7 +6,7 @@
6
  * @category FlyWebdesign
7
  * @package FlyWebdesign_PaypalFee
8
  */
9
- class FlyWebdesign_PaypalFee_Block_Adminhtml_Sales_order_Totals extends FlyWebdesign_PaypalFee_Block_Adminhtml_Sales_Totals
10
  {
11
  /**
12
  * Initialize order totals array
6
  * @category FlyWebdesign
7
  * @package FlyWebdesign_PaypalFee
8
  */
9
+ class FlyWebdesign_PaypalFee_Block_Adminhtml_Sales_Order_Totals extends FlyWebdesign_PaypalFee_Block_Adminhtml_Sales_Totals
10
  {
11
  /**
12
  * Initialize order totals array
app/code/local/FlyWebdesign/PaypalFee/Block/Adminhtml/Sales/Totals.php CHANGED
@@ -1,45 +1,70 @@
1
- <?php
2
-
3
- /**
4
- * @category FlyWebdesign
5
- * @package FlyWebdesign_PaypalFee
6
- */
7
- class FlyWebdesign_PaypalFee_Block_Adminhtml_Sales_Totals extends Mage_Adminhtml_Block_Sales_Totals
8
- {
9
- /**
10
- * Initialize order totals array
11
- *
12
- * @return Mage_Sales_Block_Order_Totals
13
- */
14
- protected function _initTotals()
15
- {
16
- parent::_initTotals();
17
-
18
- $source = $this->getSource();
19
-
20
- /**
21
- * Add store rewards
22
- */
23
- $totals = $this->_totals;
24
- $newTotals = array();
25
- if (count($totals)>0) {
26
- foreach ($totals as $index=>$arr) {
27
- if ($index == "grand_total") {
28
- if (((float)$this->getSource()->getPaymentCharge()) != 0) {
29
- $label = $this->__('Payment Charge');
30
- $newTotals['payment_charge'] = new Varien_Object(array(
31
- 'code' => 'payment_charge',
32
- 'field' => 'payment_charge',
33
- 'value' => $source->getPaymentCharge(),
34
- 'label' => $label
35
- ));
36
- }
37
- }
38
- $newTotals[$index] = $arr;
39
- }
40
- $this->_totals = $newTotals;
41
- }
42
-
43
- return $this;
44
- }
45
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * @category FlyWebdesign
5
+ * @package FlyWebdesign_PaypalFee
6
+ */
7
+ class FlyWebdesign_PaypalFee_Block_Adminhtml_Sales_Totals extends Mage_Adminhtml_Block_Sales_Totals
8
+ {
9
+ /**
10
+ * Initialize order totals array
11
+ *
12
+ * @return Mage_Sales_Block_Order_Totals
13
+ */
14
+ protected function _initTotals()
15
+ {
16
+ parent::_initTotals();
17
+
18
+ $source = $this->getSource();
19
+
20
+ $this->_totals['paid'] = new Varien_Object(array(
21
+ 'code' => 'paid',
22
+ 'strong' => true,
23
+ 'value' => $this->getSource()->getTotalPaid(),
24
+ 'base_value'=> $this->getSource()->getBaseTotalPaid(),
25
+ 'label' => $this->helper('sales')->__('Total Paid'),
26
+ 'area' => 'footer'
27
+ ));
28
+ $this->_totals['refunded'] = new Varien_Object(array(
29
+ 'code' => 'refunded',
30
+ 'strong' => true,
31
+ 'value' => $this->getSource()->getTotalRefunded(),
32
+ 'base_value'=> $this->getSource()->getBaseTotalRefunded(),
33
+ 'label' => $this->helper('sales')->__('Total Refunded'),
34
+ 'area' => 'footer'
35
+ ));
36
+ $this->_totals['due'] = new Varien_Object(array(
37
+ 'code' => 'due',
38
+ 'strong' => true,
39
+ 'value' => $this->getSource()->getTotalDue(),
40
+ 'base_value'=> $this->getSource()->getBaseTotalDue(),
41
+ 'label' => $this->helper('sales')->__('Total Due'),
42
+ 'area' => 'footer'
43
+ ));
44
+
45
+ /**
46
+ * Add store rewards
47
+ */
48
+ $totals = $this->_totals;
49
+ $newTotals = array();
50
+ if (count($totals)>0) {
51
+ foreach ($totals as $index=>$arr) {
52
+ if ($index == "grand_total") {
53
+ if (((float)$this->getSource()->getPaymentCharge()) != 0) {
54
+ $label = $this->__('Payment Charge');
55
+ $newTotals['payment_charge'] = new Varien_Object(array(
56
+ 'code' => 'payment_charge',
57
+ 'field' => 'payment_charge',
58
+ 'value' => $source->getPaymentCharge(),
59
+ 'label' => $label
60
+ ));
61
+ }
62
+ }
63
+ $newTotals[$index] = $arr;
64
+ }
65
+ $this->_totals = $newTotals;
66
+ }
67
+
68
+ return $this;
69
+ }
70
+ }
app/code/local/FlyWebdesign/PaypalFee/Model/Paypal/Cart.php CHANGED
@@ -80,7 +80,7 @@ class FlyWebdesign_PaypalFee_Model_Paypal_Cart extends Mage_Paypal_Model_Cart
80
  );
81
  }
82
  $shippingItemId = $this->_renderTotalLineItemDescriptions(self::TOTAL_SHIPPING, $shippingDescription);
83
- if ($this->_isShippingAsItem && (float)$this->_totals[self::TOTAL_SHIPPING]) {
84
  $this->addItem(Mage::helper('paypal')->__('Shipping'), 1, (float)$this->_totals[self::TOTAL_SHIPPING],
85
  $shippingItemId
86
  );
80
  );
81
  }
82
  $shippingItemId = $this->_renderTotalLineItemDescriptions(self::TOTAL_SHIPPING, $shippingDescription);
83
+ if ($this->_isDiscountAsItem && $this->_isShippingAsItem && (float)$this->_totals[self::TOTAL_SHIPPING]) {
84
  $this->addItem(Mage::helper('paypal')->__('Shipping'), 1, (float)$this->_totals[self::TOTAL_SHIPPING],
85
  $shippingItemId
86
  );
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>flywebdesign_paypalfee</name>
4
- <version>0.1.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -13,10 +13,10 @@ It provides the functionality to set different payment fee/charge for all paymen
13
  &#xD;
14
  In the backend you can fill in a fixed price or percentage of the subtotal to add to the amount the customer has to pay.</description>
15
  <notes>Add additional payment fees to payment methods</notes>
16
- <authors><author><name>Fly Webdesign</name><user>flyweb</user><email>info@flywebdesign.nl</email></author></authors>
17
- <date>2012-12-13</date>
18
- <time>09:51:28</time>
19
- <contents><target name="mageetc"><dir name="modules"><file name="FlyWebdesign_PaypalFee.xml" hash="c07031f7f9da066befc127abc8c766f8"/></dir></target><target name="magelocal"><dir name="FlyWebdesign"><dir name="PaypalFee"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="99ccd5759d9070540bfba617f637b2d8"/></dir><dir name="Invoice"><file name="Totals.php" hash="2b0e3ee138df4503062e3a6645cd8bc1"/></dir><file name="Totals.php" hash="3bbb080ce185a4102345bca3e73c1583"/></dir><file name="Totals.php" hash="2a91e0feadf1e7f25ba2f8d01cbb8b4d"/></dir></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="e37228644674a2f0950b34bd61dcc675"/></dir><dir name="Invoice"><file name="Totals.php" hash="4d81572c4b68ba0b7ee1c4f38e59022e"/></dir><file name="Totals.php" hash="f2a13692a95ca921af9cd1f090731835"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="85b056439185da114fa582b92c212b1e"/><file name="system.xml" hash="cf05881d5a1dfe470ecbe5394738fc8d"/></dir><dir name="Helper"><file name="Data.php" hash="779a54809ee04904be5baedeca294524"/></dir><dir name="Model"><dir name="Paypal"><file name="Cart.php" hash="292c82a59f52447e67837f478818b8d9"/></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><dir name="Total"><file name="Paymentcharge.php" hash="5e8be36c3c91891dd5b9d3a4ebeef1c8"/></dir></dir><dir name="Invoice"><dir name="Total"><file name="Paymentcharge.php" hash="dce4cb36f08cb7e1146d25d9dcb5f7f5"/></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Paymentcharge.php" hash="517eee927f1ac8ca4f082f14e52e46f4"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Chargetype.php" hash="4c281a3c37d64567946829cbadf1d905"/></dir></dir></dir></dir><dir name="sql"><dir name="paymentcharge_setup"><file name="mysql4-install-0.1.0.php" hash="8135c131114d352519c92b44b10dfb45"/></dir></dir></dir></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
22
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>flywebdesign_paypalfee</name>
4
+ <version>0.1.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
13
  &#xD;
14
  In the backend you can fill in a fixed price or percentage of the subtotal to add to the amount the customer has to pay.</description>
15
  <notes>Add additional payment fees to payment methods</notes>
16
+ <authors><author><name>Fly Webservices</name><user>flyweb</user><email>info@flywebservices.nl</email></author></authors>
17
+ <date>2013-10-30</date>
18
+ <time>08:59:11</time>
19
+ <contents><target name="mageetc"><dir name="modules"><file name="FlyWebdesign_PaypalFee.xml" hash="c07031f7f9da066befc127abc8c766f8"/></dir></target><target name="magelocal"><dir name="FlyWebdesign"><dir name="PaypalFee"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="99ccd5759d9070540bfba617f637b2d8"/></dir><dir name="Invoice"><file name="Totals.php" hash="2b0e3ee138df4503062e3a6645cd8bc1"/></dir><file name="Totals.php" hash="3abb380bb023ccf4126f4e63f179b54b"/></dir><file name="Totals.php" hash="53a4995e883a29be6d1a0155e279f063"/></dir></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><file name="Totals.php" hash="e37228644674a2f0950b34bd61dcc675"/></dir><dir name="Invoice"><file name="Totals.php" hash="4d81572c4b68ba0b7ee1c4f38e59022e"/></dir><file name="Totals.php" hash="f2a13692a95ca921af9cd1f090731835"/></dir></dir></dir><dir name="etc"><file name="config.xml" hash="85b056439185da114fa582b92c212b1e"/><file name="system.xml" hash="cf05881d5a1dfe470ecbe5394738fc8d"/></dir><dir name="Helper"><file name="Data.php" hash="779a54809ee04904be5baedeca294524"/></dir><dir name="Model"><dir name="Paypal"><file name="Cart.php" hash="a4272d68f9c8c018e5e13bc1a6e45a21"/></dir><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><dir name="Total"><file name="Paymentcharge.php" hash="5e8be36c3c91891dd5b9d3a4ebeef1c8"/></dir></dir><dir name="Invoice"><dir name="Total"><file name="Paymentcharge.php" hash="dce4cb36f08cb7e1146d25d9dcb5f7f5"/></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Paymentcharge.php" hash="517eee927f1ac8ca4f082f14e52e46f4"/></dir></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Chargetype.php" hash="4c281a3c37d64567946829cbadf1d905"/></dir></dir></dir></dir><dir name="sql"><dir name="paymentcharge_setup"><file name="mysql4-install-0.1.0.php" hash="8135c131114d352519c92b44b10dfb45"/></dir></dir></dir></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
22
  </package>