Payment_Reembolso - Version 0.1.2

Version Notes

* Changes: set from control panel the "Certain amount", "low value" and "top value". Last these can be formed like fixed or percentages.

CHANGES:
->U app/code/local/Mage/Reembolso/Model/Quote.php
->U app/code/local/Mage/Reembolso/Model/Reembolso.php
->U app/code/local/Mage/Reembolso/etc/system.xml
->U app/code/local/Mage/Reembolso/etc/config.xml

Download this release

Release Info

Developer Magento Core Team
Extension Payment_Reembolso
Version 0.1.2
Comparing to
See all releases


Code changes from version 0.1.1 to 0.1.2

app/code/local/Mage/Reembolso/Model/Quote.php CHANGED
@@ -3,11 +3,22 @@ class Mage_Reembolso_Model_Quote extends Mage_Sales_Model_Quote {
3
4
public function getAmount() {
5
$totals = parent::getTotals();
6
- $subtotal = $totals['subtotal']->getData('value');
7
- if($subtotal < 100){
8
- $amount = 3;
9
} else {
10
- $amount = $subtotal * 0.03;
11
}
12
return $amount;
13
}
@@ -31,7 +42,8 @@ class Mage_Reembolso_Model_Quote extends Mage_Sales_Model_Quote {
31
32
if (!is_null($this->_payments) && $this->getPayment()->hasMethodInstance() && $this->getPayment()->getMethodInstance()->getCode() == 'reembolso') {
33
foreach ($res->getAllShippingAddresses() as $address) {
34
-
35
$sum_amount = $this->getAmount();
36
37
$address->setShippingAmount($address->getShippingAmount() + $address->getShippingTaxAmount() + $sum_amount);
3
4
public function getAmount() {
5
$totals = parent::getTotals();
6
+ $subtotal = $this->getSubTotalAmount(); //tomo el valor de la compra....
7
+ //$totals['subtotal']->getData('value');
8
+ $valores = Mage::getModel('reembolso/reembolso');
9
+ $val = $valores->getValorTope(); //tomo el valor tope contra el cual comparar...
10
+ if($subtotal < $val){
11
+ if($valores->getValInfFix() == '1'){ //si el valor inferior es fijo.....
12
+ $amount = $valores->getValorInferior();
13
+ }else{ //si el velor inferior es porcentaje....
14
+ $amount = ($subtotal * $valores->getValorInferior())/ 100;
15
+ }
16
} else {
17
+ if($valores->getValSupFix() == '1'){
18
+ $amount = $valores->getValorSuperior();
19
+ }else{
20
+ $amount = ($subtotal * $valores->getValorSuperior())/100;
21
+ }
22
}
23
return $amount;
24
}
42
43
if (!is_null($this->_payments) && $this->getPayment()->hasMethodInstance() && $this->getPayment()->getMethodInstance()->getCode() == 'reembolso') {
44
foreach ($res->getAllShippingAddresses() as $address) {
45
+
46
+ $this->setSubTotalAmount($address->getGrandTotal() - $address->getShippingAmount());
47
$sum_amount = $this->getAmount();
48
49
$address->setShippingAmount($address->getShippingAmount() + $address->getShippingTaxAmount() + $sum_amount);
app/code/local/Mage/Reembolso/Model/Reembolso.php CHANGED
@@ -19,6 +19,21 @@ class Mage_Reembolso_Model_Reembolso extends Mage_Payment_Model_Method_Abstract
19
}
20
21
public function getValorTope() {
22
- return $this->getConfigData('valortope');
23
}
24
}
19
}
20
21
public function getValorTope() {
22
+ return $this->getConfigData('montotope');
23
+ }
24
+ public function getValorInferior(){
25
+ return $this->getConfigData('valorinferior');
26
+ }
27
+ public function getValorSuperior(){
28
+ return $this->getConfigData('valorsuperior');
29
+ }
30
+ public function getValorComisionImp(){
31
+ return $this->getConfigData('comisionimp');
32
+ }
33
+ public function getValInfFix(){
34
+ return $this->getConfigData('valinffix');
35
+ }
36
+ public function getValSupFix(){
37
+ return $this->getConfigData('valsupfix');
38
}
39
}
app/code/local/Mage/Reembolso/etc/config.xml CHANGED
@@ -30,18 +30,6 @@
30
</resources>
31
</global>
32
33
- <default>
34
- <payment>
35
- <reembolso>
36
- <active>1</active>
37
- <model>reembolso/reembolso</model>
38
- <order_status>1</order_status>
39
- <title>Reembolso</title>
40
- <allowspecific>0</allowspecific>
41
- </reembolso>
42
- </payment>
43
- </default>
44
-
45
<adminhtml>
46
<translate>
47
<modules>
@@ -65,4 +53,22 @@
65
</modules>
66
</translate>
67
</frontend>
68
</config>
30
</resources>
31
</global>
32
33
<adminhtml>
34
<translate>
35
<modules>
53
</modules>
54
</translate>
55
</frontend>
56
+
57
+ <default>
58
+ <payment>
59
+ <reembolso>
60
+ <active>1</active>
61
+ <model>reembolso/reembolso</model>
62
+ <order_status>1</order_status>
63
+ <title>Reembolso</title>
64
+ <allowspecific>0</allowspecific>
65
+ <valorinferior>3</valorinferior>
66
+ <valinffix>1</valinffix>
67
+ <valorsuperior>3</valorsuperior>
68
+ <valsupfix>0</valsupfix>
69
+ <montotope>100</montotope>
70
+ </reembolso>
71
+ </payment>
72
+ </default>
73
+
74
</config>
app/code/local/Mage/Reembolso/etc/system.xml CHANGED
@@ -14,16 +14,24 @@
14
<label>Enabled</label>
15
<frontend_type>select</frontend_type>
16
<source_model>adminhtml/system_config_source_yesno</source_model>
17
- <sort_order>1</sort_order>
18
<show_in_default>1</show_in_default>
19
<show_in_website>1</show_in_website>
20
<show_in_store>0</show_in_store>
21
</active>
22
<order_status translate="label">
23
<label>New order status</label>
24
<frontend_type>select</frontend_type>
25
<source_model>adminhtml/system_config_source_order_status</source_model>
26
- <sort_order>4</sort_order>
27
<show_in_default>1</show_in_default>
28
<show_in_website>1</show_in_website>
29
<show_in_store>0</show_in_store>
@@ -31,7 +39,7 @@
31
<allowspecific translate="label">
32
<label>Payment from applicable countries</label>
33
<frontend_type>allowspecific</frontend_type>
34
- <sort_order>50</sort_order>
35
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
36
<show_in_default>1</show_in_default>
37
<show_in_website>1</show_in_website>
@@ -40,46 +48,56 @@
40
<specificcountry translate="label">
41
<label>Payment from Specific countries</label>
42
<frontend_type>multiselect</frontend_type>
43
- <sort_order>51</sort_order>
44
<source_model>adminhtml/system_config_source_country</source_model>
45
<show_in_default>1</show_in_default>
46
<show_in_website>1</show_in_website>
47
<show_in_store>1</show_in_store>
48
</specificcountry>
49
- <!--
50
- <valorfijo translate="label">
51
- <label>Valor Fijo</label>
52
<frontend_type>text</frontend_type>
53
- <sort_order>54</sort_order>
54
<show_in_default>1</show_in_default>
55
<show_in_website>1</show_in_website>
56
<show_in_store>0</show_in_store>
57
- </valorfijo>
58
- <valorporcentaje translate="label">
59
- <label>Valor Porcentaje</label>
60
<frontend_type>text</frontend_type>
61
- <sort_order>55</sort_order>
62
<show_in_default>1</show_in_default>
63
<show_in_website>1</show_in_website>
64
<show_in_store>0</show_in_store>
65
- </valorporcentaje>
66
- <montotope translate="label">
67
- <label>Monto Tope</label>
68
- <frontend_type>text</frontend_type>
69
- <sort_order>56</sort_order>
70
<show_in_default>1</show_in_default>
71
<show_in_website>1</show_in_website>
72
<show_in_store>0</show_in_store>
73
- </montotope>
74
- -->
75
- <title translate="label">
76
- <label>Title</label>
77
<frontend_type>text</frontend_type>
78
- <sort_order>2</sort_order>
79
<show_in_default>1</show_in_default>
80
<show_in_website>1</show_in_website>
81
<show_in_store>0</show_in_store>
82
- </title>
83
</fields>
84
</reembolso>
85
</groups>
14
<label>Enabled</label>
15
<frontend_type>select</frontend_type>
16
<source_model>adminhtml/system_config_source_yesno</source_model>
17
+ <sort_order>10</sort_order>
18
<show_in_default>1</show_in_default>
19
<show_in_website>1</show_in_website>
20
<show_in_store>0</show_in_store>
21
</active>
22
+ <title translate="label">
23
+ <label>Title</label>
24
+ <frontend_type>text</frontend_type>
25
+ <sort_order>20</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>0</show_in_store>
29
+ </title>
30
<order_status translate="label">
31
<label>New order status</label>
32
<frontend_type>select</frontend_type>
33
<source_model>adminhtml/system_config_source_order_status</source_model>
34
+ <sort_order>30</sort_order>
35
<show_in_default>1</show_in_default>
36
<show_in_website>1</show_in_website>
37
<show_in_store>0</show_in_store>
39
<allowspecific translate="label">
40
<label>Payment from applicable countries</label>
41
<frontend_type>allowspecific</frontend_type>
42
+ <sort_order>40</sort_order>
43
<source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
44
<show_in_default>1</show_in_default>
45
<show_in_website>1</show_in_website>
48
<specificcountry translate="label">
49
<label>Payment from Specific countries</label>
50
<frontend_type>multiselect</frontend_type>
51
+ <sort_order>50</sort_order>
52
<source_model>adminhtml/system_config_source_country</source_model>
53
<show_in_default>1</show_in_default>
54
<show_in_website>1</show_in_website>
55
<show_in_store>1</show_in_store>
56
</specificcountry>
57
+ <montotope translate="label">
58
+ <label>Monto Tope</label>
59
<frontend_type>text</frontend_type>
60
+ <sort_order>60</sort_order>
61
<show_in_default>1</show_in_default>
62
<show_in_website>1</show_in_website>
63
<show_in_store>0</show_in_store>
64
+ </montotope>
65
+ <valorinferior translate="label">
66
+ <label>Valor Inferior</label>
67
<frontend_type>text</frontend_type>
68
+ <sort_order>70</sort_order>
69
<show_in_default>1</show_in_default>
70
<show_in_website>1</show_in_website>
71
<show_in_store>0</show_in_store>
72
+ </valorinferior>
73
+ <valinffix translate="label comment">
74
+ <label>V. Inferior Fijo</label>
75
+ <comment>No en Fijo sera tomado como Porcentaje</comment>
76
+ <frontend_type>select</frontend_type>
77
+ <source_model>adminhtml/system_config_source_yesno</source_model>
78
+ <sort_order>71</sort_order>
79
<show_in_default>1</show_in_default>
80
<show_in_website>1</show_in_website>
81
<show_in_store>0</show_in_store>
82
+ </valinffix>
83
+ <valorsuperior translate="label">
84
+ <label>Valor Superior</label>
85
<frontend_type>text</frontend_type>
86
+ <sort_order>80</sort_order>
87
<show_in_default>1</show_in_default>
88
<show_in_website>1</show_in_website>
89
<show_in_store>0</show_in_store>
90
+ </valorsuperior>
91
+ <valsupfix translate="label comment">
92
+ <label>V. Superior Fijo</label>
93
+ <comment>No en Fijo sera tomado como Porcentaje</comment>
94
+ <frontend_type>select</frontend_type>
95
+ <source_model>adminhtml/system_config_source_yesno</source_model>
96
+ <sort_order>81</sort_order>
97
+ <show_in_default>1</show_in_default>
98
+ <show_in_website>1</show_in_website>
99
+ <show_in_store>0</show_in_store>
100
+ </valsupfix>
101
</fields>
102
</reembolso>
103
</groups>
package.xml CHANGED
@@ -1,21 +1,26 @@
1
<?xml version="1.0"?>
2
<package>
3
<name>Payment_Reembolso</name>
4
- <version>0.1.1</version>
5
<stability>stable</stability>
6
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
<channel>community</channel>
8
<extends/>
9
<summary>This is the cash on deluvery paument method.</summary>
10
- <description>This is the cash on deluvery paument method.</description>
11
- <notes>* Change value for the percentage from %30 to %3
12
13
- CHANGES:
14
- -&gt;U app/code/local/Mage/Reembolso/Model/Quote.php</notes>
15
<authors><author><name>Sophie</name><user>auto-converted</user><email>lalyostres@gmail.com</email></author></authors>
16
- <date>2008-11-27</date>
17
- <time>14:25:00</time>
18
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="reembolso"><file name="form.phtml" hash="ce75a81d61ec34a17aafc9f8c3b22dcc"/><file name="info.phtml" hash="57dfa8759788a77326a833603cb978e6"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="reembolso"><file name="form.phtml" hash="ce75a81d61ec34a17aafc9f8c3b22dcc"/><file name="info.phtml" hash="57dfa8759788a77326a833603cb978e6"/></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Mage"><dir name="Reembolso"><dir name="Block"><file name="Form.php" hash="21f1e325029d98571ec884bca2234e65"/><file name="Info.php" hash="33f48eab752f05362c553b63de5d9c42"/></dir><dir name="etc"><file name="config.xml" hash="6866fb126837a315dce261f387e788d7"/><file name="system.xml" hash="8cb199800d02e44e7f2813f620b018f4"/></dir><dir name="Model"><file name="Quote.php" hash="385341a02c5bc2d4b460149972fe364a"/><file name="Reembolso.php" hash="4773fdb5ab216ba96bf91f8105b46404"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Reembolso.xml" hash="a5a370ae7cb7f2b0f72b15e7d500f47d"/></dir></target></contents>
19
<compatible/>
20
<dependencies/>
21
</package>
1
<?xml version="1.0"?>
2
<package>
3
<name>Payment_Reembolso</name>
4
+ <version>0.1.2</version>
5
<stability>stable</stability>
6
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
<channel>community</channel>
8
<extends/>
9
<summary>This is the cash on deluvery paument method.</summary>
10
+ <description>It establishes different amount for the amount of the purchase. If it is minor that the Certain amount, the amount of the service will be a fixed value; if the amount is major that the Certain amount, the amount of the service will be a percentage of the same one.
11
+ To do:
12
+ Set from the control panel the fixed value, the value percentage and the Certain amount.</description>
13
+ <notes>* Changes: set from control panel the "Certain amount", "low value" and "top value". Last these can be formed like fixed or percentages.
14
15
+ CHANGES:
16
+ -&gt;U app/code/local/Mage/Reembolso/Model/Quote.php
17
+ -&gt;U app/code/local/Mage/Reembolso/Model/Reembolso.php
18
+ -&gt;U app/code/local/Mage/Reembolso/etc/system.xml
19
+ -&gt;U app/code/local/Mage/Reembolso/etc/config.xml</notes>
20
<authors><author><name>Sophie</name><user>auto-converted</user><email>lalyostres@gmail.com</email></author></authors>
21
+ <date>2008-11-28</date>
22
+ <time>13:13:03</time>
23
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="reembolso"><file name="form.phtml" hash="ce75a81d61ec34a17aafc9f8c3b22dcc"/><file name="info.phtml" hash="57dfa8759788a77326a833603cb978e6"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="reembolso"><file name="form.phtml" hash="ce75a81d61ec34a17aafc9f8c3b22dcc"/><file name="info.phtml" hash="57dfa8759788a77326a833603cb978e6"/></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Mage"><dir name="Reembolso"><dir name="Block"><file name="Form.php" hash="21f1e325029d98571ec884bca2234e65"/><file name="Info.php" hash="33f48eab752f05362c553b63de5d9c42"/></dir><dir name="etc"><file name="config.xml" hash="73c38c018475f948b5a1813ba9f90de7"/><file name="system.xml" hash="f07e5ae4fe9c2abfee4fc9c1eb2b461c"/></dir><dir name="Model"><file name="Quote.php" hash="184e58bdc10e73a0ade664e55d43b7ec"/><file name="Reembolso.php" hash="fdcd844693227fe26b3272ba3052819b"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Reembolso.xml" hash="a5a370ae7cb7f2b0f72b15e7d500f47d"/></dir></target></contents>
24
<compatible/>
25
<dependencies/>
26
</package>