Shipping_Nacex - Version 1.0.4

Version Notes

1.0.4
* Permite configurar si toma el peso de los productos en gramos o en kilos.

CHANGES:
->A /var/www/e-svn/html/perfume11/app/code/community/Nacex/Shipping/Model/Weightunits.php
->U /var/www/e-svn/html/perfume11/app/code/community/Nacex/Shipping/Model/Carrier/Spainpost.php
->U /var/www/e-svn/html/perfume11/app/code/community/Nacex/Shipping/etc/system.xml
->U /var/www/e-svn/html/perfume11/app/code/community/Nacex/Shipping/etc/config.xml

Download this release

Release Info

Developer Magento Core Team
Extension Shipping_Nacex
Version 1.0.4
Comparing to
See all releases


Code changes from version 1.0.3 to 1.0.4

app/code/community/Nacex/Shipping/Model/Carrier/Spainpost.php CHANGED
@@ -30,6 +30,7 @@ class Nacex_Shipping_Model_Carrier_Spainpost extends Mage_Shipping_Model_Carrier
30
protected $_topcode;
31
protected $_servicio;
32
protected $_sweight;
33
protected $_code = 'spainpost';
34
35
/**
@@ -65,22 +66,22 @@ class Nacex_Shipping_Model_Carrier_Spainpost extends Mage_Shipping_Model_Carrier
65
$this->_frompcode = Mage::getStoreConfig('shipping/origin/postcode', $this->getStore());
66
// CODIGO POSTAL DEL COMPRADOR
67
$this->_topcode = $request->getDestPostcode();
68
-
69
if ($request->getDestCountryId()) {
70
$destCountry = $request->getDestCountryId();
71
} else {
72
$destCountry = "ES";
73
}
74
75
- $sweightunit = 1; //$this->getConfigData('weight_units');
76
$this->_sweight = $request->getPackageWeight()*$sweightunit;
77
78
// En el caso de que sea dentro de espa�a se muestra
79
// en caso contrario no
80
if($destCountry == "ES") {
81
$this->setServicio();
82
-
83
- $price=($this->getPrecio() * 1.16) + 1;
84
85
$method = Mage::getModel('shipping/rate_result_method');
86
@@ -106,11 +107,19 @@ class Nacex_Shipping_Model_Carrier_Spainpost extends Mage_Shipping_Model_Carrier
106
$handlingFee = ($shippingPrice * $this->getConfigData('handling_fee'))/100;
107
$shippingPrice += $handlingFee;
108
}
109
110
$method->setCarrier('spainpost');
111
$method->setCarrierTitle($this->getConfigData('title'));
112
$method->setMethod($this->_shipping_method);
113
- $method->setMethodTitle($this->getConfigData('title') . ": {$this->_shipping_method}");
114
$method->setPrice($shippingPrice);
115
$method->setCost($shippingPrice);
116
$result->append($method);
@@ -135,7 +144,6 @@ class Nacex_Shipping_Model_Carrier_Spainpost extends Mage_Shipping_Model_Carrier
135
else
136
return false;
137
}
138
- echo "<!--REGION: {$region}-->";
139
return $region;
140
}
141
@@ -213,7 +221,7 @@ class Nacex_Shipping_Model_Carrier_Spainpost extends Mage_Shipping_Model_Carrier
213
if($this->_sweight <= '2000') {
214
$this->_shipping_method = 'BAG';
215
$price = 6.18;
216
- } elseif(($this->_sweight > '5000')){
217
$price = 6.95;
218
} elseif(($this->_sweight <='10000')){
219
$price = 8.76;
@@ -225,8 +233,6 @@ class Nacex_Shipping_Model_Carrier_Spainpost extends Mage_Shipping_Model_Carrier
225
break;
226
227
}
228
- echo "<!--METODO: {$this->_shipping_method}-->";
229
- echo "<!--PRECIO: {$price}-->";
230
return $price;
231
}
232
@@ -265,6 +271,5 @@ class Nacex_Shipping_Model_Carrier_Spainpost extends Mage_Shipping_Model_Carrier
265
}
266
break;
267
}
268
- echo "<!--SERVICIO: {$this->_servicio}-->";
269
}
270
}
30
protected $_topcode;
31
protected $_servicio;
32
protected $_sweight;
33
+ protected $_comment;
34
protected $_code = 'spainpost';
35
36
/**
66
$this->_frompcode = Mage::getStoreConfig('shipping/origin/postcode', $this->getStore());
67
// CODIGO POSTAL DEL COMPRADOR
68
$this->_topcode = $request->getDestPostcode();
69
if ($request->getDestCountryId()) {
70
$destCountry = $request->getDestCountryId();
71
} else {
72
$destCountry = "ES";
73
}
74
75
+ $sweightunit = $this->getConfigData('weight_units');
76
$this->_sweight = $request->getPackageWeight()*$sweightunit;
77
78
// En el caso de que sea dentro de espa�a se muestra
79
// en caso contrario no
80
if($destCountry == "ES") {
81
$this->setServicio();
82
+
83
+ $old_price =$this->getPrecio();
84
+ $price=($old_price * 1.16) + 1;
85
86
$method = Mage::getModel('shipping/rate_result_method');
87
107
$handlingFee = ($shippingPrice * $this->getConfigData('handling_fee'))/100;
108
$shippingPrice += $handlingFee;
109
}
110
+
111
+ $this->_comment .= "TIENDA: {$this->_frompcode}\n";
112
+ $this->_comment .= "CLIENTE: {$this->_topcode}\n";
113
+ $this->_comment .= "SERVICIO: {$this->_servicio}\n";
114
+ $this->_comment .= "METODO: {$this->_shipping_method}\n";
115
+ $this->_comment .= "PRECIO: {$old_price}\n";
116
+ $this->_comment .= "UNIDAD DE PESO: {$sweightunit}\n";
117
+ $this->_comment .= "PESO: {$this->_sweight}\n";
118
119
$method->setCarrier('spainpost');
120
$method->setCarrierTitle($this->getConfigData('title'));
121
$method->setMethod($this->_shipping_method);
122
+ $method->setMethodTitle($this->getConfigData('title') . ": {$this->_shipping_method} <!--{$this->_comment}-->");
123
$method->setPrice($shippingPrice);
124
$method->setCost($shippingPrice);
125
$result->append($method);
144
else
145
return false;
146
}
147
return $region;
148
}
149
221
if($this->_sweight <= '2000') {
222
$this->_shipping_method = 'BAG';
223
$price = 6.18;
224
+ } elseif(($this->_sweight <= '5000')){
225
$price = 6.95;
226
} elseif(($this->_sweight <='10000')){
227
$price = 8.76;
233
break;
234
235
}
236
return $price;
237
}
238
271
}
272
break;
273
}
274
}
275
}
app/code/community/Nacex/Shipping/Model/Weightunits.php ADDED
@@ -0,0 +1,28 @@
1
+ <?php
2
+ /**
3
+ * Magento Nacex Shipping Module
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
+ * @category Nacex
16
+ * @package Nacex_Shipping
17
+ * @copyright
18
+ * @author
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+ class Nacex_Shipping_Model_Weightunits {
22
+ public function toOptionArray() {
23
+ return array(
24
+ array('value'=>1, 'label'=>Mage::helper('adminhtml')->__('Gramos')),
25
+ array('value'=>1000, 'label'=>Mage::helper('adminhtml')->__('Kilogramos')),
26
+ );
27
+ }
28
+ }
app/code/community/Nacex/Shipping/etc/config.xml CHANGED
@@ -1,59 +1,61 @@
1
<?xml version="1.0"?>
2
<config>
3
- <modules>
4
- <Nacex_Shipping>
5
- <version>0.1.0</version>
6
- <depends>
7
- <Mage_Shipping />
8
- </depends>
9
- </Nacex_Shipping>
10
- </modules>
11
- <global>
12
- <models>
13
- <nxshipping>
14
- <class>Nacex_Shipping</class>
15
- </nxshipping>
16
- </models>
17
- <resources>
18
- <nxshipping_setup>
19
- <setup>
20
- <module>Nacex_Shipping</module>
21
- </setup>
22
- <connection>
23
- <use>directory_setup</use>
24
- </connection>
25
- </nxshipping_setup>
26
- <nxshipping_read>
27
- <connection>
28
- <use>local_read</use>
29
- </connection>
30
- </nxshipping_read>
31
- </resources>
32
- <sales>
33
- <shipping>
34
- <carriers>
35
- <spainpost>
36
- <class>Nacex_Shipping_Model_Carrier_Spainpost</class>
37
- </spainpost>
38
- </carriers>
39
- </shipping>
40
- </sales>
41
- </global>
42
-
43
- <default>
44
- <carriers>
45
- <spainpost>
46
- <active>1</active>
47
- <model>nacex_shipping_model_carrier_spainpost</model>
48
- <name>Nacex</name>
49
- <type>O</type>
50
- <title>Nacex</title>
51
- <min_order_value>0</min_order_value>
52
- <max_order_value>9999999999999</max_order_value>
53
- <weight_units>1</weight_units>
54
- <handling_fee>0</handling_fee>
55
- <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
56
- </spainpost>
57
- </carriers>
58
- </default>
59
- </config>
1
<?xml version="1.0"?>
2
<config>
3
+ <modules>
4
+ <Nacex_Shipping>
5
+ <version>0.1.0</version>
6
+ <depends>
7
+ <Mage_Shipping />
8
+ </depends>
9
+ </Nacex_Shipping>
10
+ </modules>
11
+ <global>
12
+ <models>
13
+ <nxshipping>
14
+ <class>Nacex_Shipping</class>
15
+ </nxshipping>
16
+ <nacex>
17
+ <class>Nacex_Shipping_Model</class>
18
+ </nacex>
19
+ </models>
20
+ <resources>
21
+ <nxshipping_setup>
22
+ <setup>
23
+ <module>Nacex_Shipping</module>
24
+ </setup>
25
+ <connection>
26
+ <use>directory_setup</use>
27
+ </connection>
28
+ </nxshipping_setup>
29
+ <nxshipping_read>
30
+ <connection>
31
+ <use>local_read</use>
32
+ </connection>
33
+ </nxshipping_read>
34
+ </resources>
35
+ <sales>
36
+ <shipping>
37
+ <carriers>
38
+ <spainpost>
39
+ <class>Nacex_Shipping_Model_Carrier_Spainpost</class>
40
+ </spainpost>
41
+ </carriers>
42
+ </shipping>
43
+ </sales>
44
+ </global>
45
+ <default>
46
+ <carriers>
47
+ <spainpost>
48
+ <active>1</active>
49
+ <model>nacex_shipping_model_carrier_spainpost</model>
50
+ <name>Nacex</name>
51
+ <type>O</type>
52
+ <title>Nacex</title>
53
+ <min_order_value>0</min_order_value>
54
+ <max_order_value>9999999999999</max_order_value>
55
+ <weight_units>1</weight_units>
56
+ <handling_fee>0</handling_fee>
57
+ <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
58
+ </spainpost>
59
+ </carriers>
60
+ </default>
61
+ </config>
app/code/community/Nacex/Shipping/etc/system.xml CHANGED
@@ -10,85 +10,94 @@
10
<show_in_default>1</show_in_default>
11
<show_in_website>1</show_in_website>
12
<show_in_store>1</show_in_store>
13
- <fields>
14
- <active translate="label">
15
- <label>Enabled</label>
16
- <frontend_type>select</frontend_type>
17
- <source_model>adminhtml/system_config_source_yesno</source_model>
18
- <sort_order>1</sort_order>
19
- <show_in_default>1</show_in_default>
20
- <show_in_website>1</show_in_website>
21
- <show_in_store>1</show_in_store>
22
- </active>
23
- <min_order_value translate="label">
24
- <label>Minimum Order Value</label>
25
- <frontend_type>text</frontend_type>
26
- <sort_order>6</sort_order>
27
- <show_in_default>1</show_in_default>
28
- <show_in_website>1</show_in_website>
29
- <show_in_store>1</show_in_store>
30
- </min_order_value>
31
- <max_order_value translate="label">
32
- <label>Maximum Order Value</label>
33
- <frontend_type>text</frontend_type>
34
- <sort_order>5</sort_order>
35
- <show_in_default>1</show_in_default>
36
- <show_in_website>1</show_in_website>
37
- <show_in_store>1</show_in_store>
38
- </max_order_value>
39
- <handling_type translate="label">
40
- <label>Calculate Handling Fee</label>
41
- <frontend_type>select</frontend_type>
42
- <source_model>shipping/source_handlingType</source_model>
43
- <sort_order>4</sort_order>
44
- <show_in_default>1</show_in_default>
45
- <show_in_website>1</show_in_website>
46
- <show_in_store>0</show_in_store>
47
- </handling_type>
48
- <handling_fee translate="label">
49
- <label>Handling Fee</label>
50
- <frontend_type>text</frontend_type>
51
- <sort_order>5</sort_order>
52
- <show_in_default>1</show_in_default>
53
- <show_in_website>1</show_in_website>
54
- <show_in_store>1</show_in_store>
55
- </handling_fee>
56
- <sort_order translate="label">
57
- <label>Sort order</label>
58
- <frontend_type>text</frontend_type>
59
- <sort_order>11</sort_order>
60
- <show_in_default>1</show_in_default>
61
- <show_in_website>1</show_in_website>
62
- <show_in_store>1</show_in_store>
63
- </sort_order>
64
- <title translate="label">
65
- <label>Title</label>
66
- <frontend_type>text</frontend_type>
67
- <sort_order>2</sort_order>
68
- <show_in_default>1</show_in_default>
69
- <show_in_website>1</show_in_website>
70
- <show_in_store>1</show_in_store>
71
- </title>
72
- <showmethod translate="label">
73
- <label>Show method if not applicable</label>
74
- <frontend_type>select</frontend_type>
75
- <sort_order>11</sort_order>
76
- <source_model>adminhtml/system_config_source_yesno</source_model>
77
- <show_in_default>1</show_in_default>
78
- <show_in_website>1</show_in_website>
79
- <show_in_store>1</show_in_store>
80
- </showmethod>
81
- <specificerrmsg translate="label">
82
- <label>Displayed Error Message</label>
83
- <frontend_type>textarea</frontend_type>
84
- <sort_order>12</sort_order>
85
- <show_in_default>1</show_in_default>
86
- <show_in_website>1</show_in_website>
87
- <show_in_store>1</show_in_store>
88
- </specificerrmsg>
89
</fields>
90
- </spainpost>
91
- </groups>
92
- </carriers>
93
- </sections>
94
- </config>
10
<show_in_default>1</show_in_default>
11
<show_in_website>1</show_in_website>
12
<show_in_store>1</show_in_store>
13
+ <fields>
14
+ <active translate="label">
15
+ <label>Enabled</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <sort_order>1</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>1</show_in_store>
22
+ </active>
23
+ <weight_units translate="label">
24
+ <label>Unidad de peso</label>
25
+ <frontend_type>select</frontend_type>
26
+ <source_model>nacex/weightunits</source_model>
27
+ <sort_order>3</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>1</show_in_store>
31
+ </weight_units>
32
+ <min_order_value translate="label">
33
+ <label>Minimum Order Value</label>
34
+ <frontend_type>text</frontend_type>
35
+ <sort_order>6</sort_order>
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
+ </min_order_value>
40
+ <max_order_value translate="label">
41
+ <label>Maximum Order Value</label>
42
+ <frontend_type>text</frontend_type>
43
+ <sort_order>5</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+ </max_order_value>
48
+ <handling_type translate="label">
49
+ <label>Calculate Handling Fee</label>
50
+ <frontend_type>select</frontend_type>
51
+ <source_model>shipping/source_handlingType</source_model>
52
+ <sort_order>4</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>0</show_in_store>
56
+ </handling_type>
57
+ <handling_fee translate="label">
58
+ <label>Handling Fee</label>
59
+ <frontend_type>text</frontend_type>
60
+ <sort_order>5</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ </handling_fee>
65
+ <sort_order translate="label">
66
+ <label>Sort order</label>
67
+ <frontend_type>text</frontend_type>
68
+ <sort_order>11</sort_order>
69
+ <show_in_default>1</show_in_default>
70
+ <show_in_website>1</show_in_website>
71
+ <show_in_store>1</show_in_store>
72
+ </sort_order>
73
+ <title translate="label">
74
+ <label>Title</label>
75
+ <frontend_type>text</frontend_type>
76
+ <sort_order>2</sort_order>
77
+ <show_in_default>1</show_in_default>
78
+ <show_in_website>1</show_in_website>
79
+ <show_in_store>1</show_in_store>
80
+ </title>
81
+ <showmethod translate="label">
82
+ <label>Show method if not applicable</label>
83
+ <frontend_type>select</frontend_type>
84
+ <sort_order>11</sort_order>
85
+ <source_model>adminhtml/system_config_source_yesno</source_model>
86
+ <show_in_default>1</show_in_default>
87
+ <show_in_website>1</show_in_website>
88
+ <show_in_store>1</show_in_store>
89
+ </showmethod>
90
+ <specificerrmsg translate="label">
91
+ <label>Displayed Error Message</label>
92
+ <frontend_type>textarea</frontend_type>
93
+ <sort_order>12</sort_order>
94
+ <show_in_default>1</show_in_default>
95
+ <show_in_website>1</show_in_website>
96
+ <show_in_store>1</show_in_store>
97
+ </specificerrmsg>
98
</fields>
99
+ </spainpost>
100
+ </groups>
101
+ </carriers>
102
+ </sections>
103
+ </config>
package.xml CHANGED
@@ -1,22 +1,25 @@
1
<?xml version="1.0"?>
2
<package>
3
<name>Shipping_Nacex</name>
4
- <version>1.0.3</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>Metodo de envio para nacex</summary>
10
<description>Metodo de envio para nacex</description>
11
- <notes>1.0.3
12
- * Arreglado el error al llamar a una funcion.
13
14
CHANGES:
15
- -&gt;U app/code/community/Nacex/Shipping/Model/Carrier/Spainpost.php</notes>
16
<authors><author><name>Manuel</name><user>auto-converted</user><email>manuelcanepa@gmail.com</email></author><author><name>Sophie</name><user>auto-converted</user><email>lalyostres@gmail.com</email></author></authors>
17
<date>2008-10-17</date>
18
- <time>12:24:22</time>
19
- <contents><target name="mageetc"><dir name="modules"><file name="Nacex_Shipping.xml" hash="74bdf7f9847df2280af2666d8123d95b"/></dir></target><target name="magecommunity"><dir name="Nacex"><dir name="Shipping"><dir name="etc"><file name="config.xml" hash="da635493540be9ff524d891f76d752f1"/><file name="system.xml" hash="36b62fc3eeb18084f6c4626373f4bbd4"/></dir><dir name="Helper"><file name="Data.php" hash="b5d80af85823935e1e91081f0b5989aa"/></dir><dir name="Model"><dir name="Carrier"><file name="Spainpost.php" hash="c505f530bf602a49f49737ec1957533f"/></dir></dir><dir name="sql"><dir name="shipping_setup"><file name="mysql4-install-0.1.0.php" hash="d614fdc964125e1ff642933cc8014583"/></dir></dir></dir></dir></target></contents>
20
<compatible/>
21
<dependencies/>
22
</package>
1
<?xml version="1.0"?>
2
<package>
3
<name>Shipping_Nacex</name>
4
+ <version>1.0.4</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>Metodo de envio para nacex</summary>
10
<description>Metodo de envio para nacex</description>
11
+ <notes>1.0.4
12
+ * Permite configurar si toma el peso de los productos en gramos o en kilos.
13
14
CHANGES:
15
+ -&gt;A /var/www/e-svn/html/perfume11/app/code/community/Nacex/Shipping/Model/Weightunits.php
16
+ -&gt;U /var/www/e-svn/html/perfume11/app/code/community/Nacex/Shipping/Model/Carrier/Spainpost.php
17
+ -&gt;U /var/www/e-svn/html/perfume11/app/code/community/Nacex/Shipping/etc/system.xml
18
+ -&gt;U /var/www/e-svn/html/perfume11/app/code/community/Nacex/Shipping/etc/config.xml</notes>
19
<authors><author><name>Manuel</name><user>auto-converted</user><email>manuelcanepa@gmail.com</email></author><author><name>Sophie</name><user>auto-converted</user><email>lalyostres@gmail.com</email></author></authors>
20
<date>2008-10-17</date>
21
+ <time>13:29:08</time>
22
+ <contents><target name="mageetc"><dir name="modules"><file name="Nacex_Shipping.xml" hash="74bdf7f9847df2280af2666d8123d95b"/></dir></target><target name="magecommunity"><dir name="Nacex"><dir name="Shipping"><dir name="etc"><file name="config.xml" hash="574a026f826c38a6fe519aa6da7e05da"/><file name="system.xml" hash="860524dafb1cb9ee911aa8dd9d05facf"/></dir><dir name="Helper"><file name="Data.php" hash="b5d80af85823935e1e91081f0b5989aa"/></dir><dir name="Model"><dir name="Carrier"><file name="Spainpost.php" hash="50584bb9e2a44b9dcdbc99f8a18eccdb"/></dir><file name="Weightunits.php" hash="77db09797e9828b7e107abbe2f282ee1"/></dir><dir name="sql"><dir name="shipping_setup"><file name="mysql4-install-0.1.0.php" hash="d614fdc964125e1ff642933cc8014583"/></dir></dir></dir></dir></target></contents>
23
<compatible/>
24
<dependencies/>
25
</package>