Version Notes
* No notes
CHANGES:
->A app/code/local/Mage/Reembolso/Block/Form.php
->A app/code/local/Mage/Reembolso/Block/Info.php
->A app/code/local/Mage/Reembolso/etc/config.xml
->A app/code/local/Mage/Reembolso/etc/system.xml
->A app/code/local/Mage/Reembolso/Model/Reembolso.php
->A app/code/local/Mage/Reembolso/Model/Quote.php
->A app/design/adminhtml/default/default/template/reembolso/form.phtml
->A app/design/adminhtml/default/default/template/reembolso/info.phtml
->A app/design/frontend/default/default/template/reembolso/form.phtml
->A app/design/frontend/default/default/template/reembolso/info.phtml
->A app/etc/modules/Reembolso.xml
Download this release
Release Info
Developer | Magento Core Team |
Extension | Payment_Reembolso |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/local/Mage/Reembolso/Block/Form.php +8 -0
- app/code/local/Mage/Reembolso/Block/Info.php +8 -0
- app/code/local/Mage/Reembolso/Model/Quote.php +47 -0
- app/code/local/Mage/Reembolso/Model/Reembolso.php +24 -0
- app/code/local/Mage/Reembolso/etc/config.xml +68 -0
- app/code/local/Mage/Reembolso/etc/system.xml +88 -0
- app/design/adminhtml/default/default/template/reembolso/form.phtml +7 -0
- app/design/adminhtml/default/default/template/reembolso/info.phtml +1 -0
- app/design/frontend/default/default/template/reembolso/form.phtml +7 -0
- app/design/frontend/default/default/template/reembolso/info.phtml +1 -0
- app/etc/modules/Reembolso.xml +19 -0
- package.xml +31 -0
app/code/local/Mage/Reembolso/Block/Form.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Mage_Reembolso_Block_Form extends Mage_Payment_Block_Form {
|
3 |
+
|
4 |
+
protected function _construct() {
|
5 |
+
parent::_construct();
|
6 |
+
$this->setTemplate('reembolso/form.phtml');
|
7 |
+
}
|
8 |
+
}
|
app/code/local/Mage/Reembolso/Block/Info.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Mage_Reembolso_Block_Info extends Mage_Payment_Block_Info {
|
3 |
+
|
4 |
+
protected function _construct() {
|
5 |
+
parent::_construct();
|
6 |
+
$this->setTemplate('reembolso/info.phtml');
|
7 |
+
}
|
8 |
+
}
|
app/code/local/Mage/Reembolso/Model/Quote.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
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.3;
|
11 |
+
}
|
12 |
+
return $amount;
|
13 |
+
}
|
14 |
+
|
15 |
+
|
16 |
+
public function getTotals() {
|
17 |
+
$res = parent::getTotals();
|
18 |
+
|
19 |
+
if (isset($res['shipping']) && is_object($res['shipping'])) {
|
20 |
+
if (!is_null($this->_payments) && $this->getPayment()->hasMethodInstance() && $this->getPayment()->getMethodInstance()->getCode() == 'reembolso') {
|
21 |
+
$model = Mage::getModel('reembolso/reembolso');
|
22 |
+
$res['shipping']->setData('title',$res['shipping']->getData('title') . ' + ' . $model->getReembolsoTitle());
|
23 |
+
}
|
24 |
+
}
|
25 |
+
return $res;
|
26 |
+
}
|
27 |
+
|
28 |
+
public function collectTotals() {
|
29 |
+
$res = parent::collectTotals();
|
30 |
+
$sum_amount = 0;
|
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);
|
38 |
+
$address->setBaseShippingAmount($address->getBaseShippingAmount() + $address->getBaseShippingTaxAmount() + $sum_amount);
|
39 |
+
|
40 |
+
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $sum_amount);
|
41 |
+
$address->setGrandTotal($address->getGrandTotal() + $sum_amount);
|
42 |
+
|
43 |
+
}
|
44 |
+
}
|
45 |
+
return $res;
|
46 |
+
}
|
47 |
+
}
|
app/code/local/Mage/Reembolso/Model/Reembolso.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Mage_Reembolso_Model_Reembolso extends Mage_Payment_Model_Method_Abstract {
|
3 |
+
|
4 |
+
protected $_code = 'reembolso';
|
5 |
+
|
6 |
+
protected $_formBlockType = 'reembolso/form';
|
7 |
+
protected $_infoBlockType = 'reembolso/info';
|
8 |
+
|
9 |
+
public function getReembolsoTitle() {
|
10 |
+
return $this->getConfigData('title');
|
11 |
+
}
|
12 |
+
|
13 |
+
public function getValorFijo() {
|
14 |
+
return $this->getConfigData('valorfijo');
|
15 |
+
}
|
16 |
+
|
17 |
+
public function getValorPorcentaje() {
|
18 |
+
return $this->getConfigData('valorporcentaje');
|
19 |
+
}
|
20 |
+
|
21 |
+
public function getValorTope() {
|
22 |
+
return $this->getConfigData('valortope');
|
23 |
+
}
|
24 |
+
}
|
app/code/local/Mage/Reembolso/etc/config.xml
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<global>
|
4 |
+
<models>
|
5 |
+
<reembolso>
|
6 |
+
<class>Mage_Reembolso_Model</class>
|
7 |
+
</reembolso>
|
8 |
+
<sales>
|
9 |
+
<rewrite>
|
10 |
+
<quote>Mage_Reembolso_Model_Quote</quote>
|
11 |
+
</rewrite>
|
12 |
+
</sales>
|
13 |
+
</models>
|
14 |
+
|
15 |
+
<resources>
|
16 |
+
<reembolso_setup>
|
17 |
+
<setup>
|
18 |
+
<module>Mage_Reembolso</module>
|
19 |
+
</setup>
|
20 |
+
<connection>
|
21 |
+
<use>core_setup</use>
|
22 |
+
</connection>
|
23 |
+
</reembolso_setup>
|
24 |
+
<reembolso_write>
|
25 |
+
<use>core_write</use>
|
26 |
+
</reembolso_write>
|
27 |
+
<reembolso_read>
|
28 |
+
<use>core_read</use>
|
29 |
+
</reembolso_read>
|
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>
|
48 |
+
<Mage_Reembolso>
|
49 |
+
<files>
|
50 |
+
<default>Mage_Reembolso.csv</default>
|
51 |
+
</files>
|
52 |
+
</Mage_Reembolso>
|
53 |
+
</modules>
|
54 |
+
</translate>
|
55 |
+
</adminhtml>
|
56 |
+
|
57 |
+
<frontend>
|
58 |
+
<translate>
|
59 |
+
<modules>
|
60 |
+
<Mage_Reembolso>
|
61 |
+
<files>
|
62 |
+
<default>Mage_Reembolso.csv</default>
|
63 |
+
</files>
|
64 |
+
</Mage_Reembolso>
|
65 |
+
</modules>
|
66 |
+
</translate>
|
67 |
+
</frontend>
|
68 |
+
</config>
|
app/code/local/Mage/Reembolso/etc/system.xml
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<payment>
|
5 |
+
<groups>
|
6 |
+
<reembolso translate="label" module="payment">
|
7 |
+
<label>Reembolso</label>
|
8 |
+
<sort_order>670</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>0</show_in_store>
|
12 |
+
<fields>
|
13 |
+
<active translate="label">
|
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>
|
30 |
+
</order_status>
|
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>
|
38 |
+
<show_in_store>1</show_in_store>
|
39 |
+
</allowspecific>
|
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>
|
86 |
+
</payment>
|
87 |
+
</sections>
|
88 |
+
</config>
|
app/design/adminhtml/default/default/template/reembolso/form.phtml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none;">
|
2 |
+
<table>
|
3 |
+
<tr>
|
4 |
+
<td><?php echo $this->__('El pago será realizado en la dirección de destino') ?></td>
|
5 |
+
</tr>
|
6 |
+
</table>
|
7 |
+
</div>
|
app/design/adminhtml/default/default/template/reembolso/info.phtml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<p><?php echo $this->__('Pago contra reembolso') ?></p>
|
app/design/frontend/default/default/template/reembolso/form.phtml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none;">
|
2 |
+
<table>
|
3 |
+
<tr>
|
4 |
+
<td><?php echo $this->__('El pago será realizado en la dirección de destino') ?></td>
|
5 |
+
</tr>
|
6 |
+
</table>
|
7 |
+
</div>
|
app/design/frontend/default/default/template/reembolso/info.phtml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<p><?php echo $this->__('Pago contra reembolso') ?></p>
|
app/etc/modules/Reembolso.xml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<modules>
|
5 |
+
<!-- declare Mage_Reembolso module -->
|
6 |
+
<Mage_Reembolso>
|
7 |
+
<!-- this is an active module -->
|
8 |
+
<active>true</active>
|
9 |
+
<!-- this module will be located in app/code/local code pool -->
|
10 |
+
<codePool>local</codePool>
|
11 |
+
<!-- specify dependencies for correct module loading order -->
|
12 |
+
<depends>
|
13 |
+
<Mage_Payment />
|
14 |
+
</depends>
|
15 |
+
<!-- declare module's version information for database updates -->
|
16 |
+
<version>0.1.0</version>
|
17 |
+
</Mage_Reembolso>
|
18 |
+
</modules>
|
19 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Payment_Reembolso</name>
|
4 |
+
<version>0.1.0</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>* No notes
|
12 |
+
|
13 |
+
CHANGES:
|
14 |
+
->A app/code/local/Mage/Reembolso/Block/Form.php
|
15 |
+
->A app/code/local/Mage/Reembolso/Block/Info.php
|
16 |
+
->A app/code/local/Mage/Reembolso/etc/config.xml
|
17 |
+
->A app/code/local/Mage/Reembolso/etc/system.xml
|
18 |
+
->A app/code/local/Mage/Reembolso/Model/Reembolso.php
|
19 |
+
->A app/code/local/Mage/Reembolso/Model/Quote.php
|
20 |
+
->A app/design/adminhtml/default/default/template/reembolso/form.phtml
|
21 |
+
->A app/design/adminhtml/default/default/template/reembolso/info.phtml
|
22 |
+
->A app/design/frontend/default/default/template/reembolso/form.phtml
|
23 |
+
->A app/design/frontend/default/default/template/reembolso/info.phtml
|
24 |
+
->A app/etc/modules/Reembolso.xml</notes>
|
25 |
+
<authors><author><name>Sophie</name><user>auto-converted</user><email>lalyostres@gmail.com</email></author></authors>
|
26 |
+
<date>2008-11-26</date>
|
27 |
+
<time>13:18:43</time>
|
28 |
+
<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="fc1ff551f8d7306b60b2625d8e41ef07"/><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>
|
29 |
+
<compatible/>
|
30 |
+
<dependencies/>
|
31 |
+
</package>
|