Shipping_Nacex - Version 1.0.1

Version Notes

1.0.1
* Correccion de precios.
* Agregado de datos para la tienda en baleares.

CHANGES:
->U app/code/community/Nacex/Shipping/Model/Carrier/Spainpost.php

Download this release

Release Info

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


Code changes from version 1.0.0 to 1.0.1

app/code/community/Nacex/Shipping/Helper/Data.php CHANGED
@@ -1,29 +1,29 @@
1
- <?php
2
- /**
3
- * Magento Nacex Shipping
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
-
22
- /**
23
- * Catalog data helper
24
- *
25
- */
26
- class Nacex_Shipping_Helper_Data extends Mage_Core_Helper_Abstract
27
- {
28
-
29
  }
1
+ <?php
2
+ /**
3
+ * Magento Nacex Shipping
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
+
22
+ /**
23
+ * Catalog data helper
24
+ *
25
+ */
26
+ class Nacex_Shipping_Helper_Data extends Mage_Core_Helper_Abstract
27
+ {
28
+
29
  }
app/code/community/Nacex/Shipping/Model/Carrier/Spainpost.php CHANGED
@@ -1,265 +1,266 @@
1
- <?php
2
- class Nacex_Shipping_Model_Carrier_Spainpost
3
- extends Mage_Shipping_Model_Carrier_Abstract
4
- implements Mage_Shipping_Model_Carrier_Interface
5
- {
6
- var $_regions = array(
7
- 'ANDALUCIA' =>array('04','11','14','18','21','23','29','41'),
8
- 'ARAGON' =>array('22','44','50'),
9
- 'BALEARES' =>array('07'),
10
- 'CANARIAS' =>array('35','38'),
11
- 'CANTABRIA' =>array('39'),
12
- 'CASTILLA Y LEON' =>array('05','09','24','34','37','40','42','47','49'),
13
- 'CASTILLA LA MANCA' =>array('02','13','16','19','45'),
14
- 'CATALU�A' =>array('08','17','25','43'),
15
- 'CEUTA' =>array('51'),
16
- 'COMUNIDAD DE MADRID' =>array('28'),
17
- 'COMUNIDAD FORAL DE NAVARRA'=>array('31'),
18
- 'COMUNIDAD VALENCIANA' =>array('03','12','46'),
19
- 'EUSKADI - PAIS VASCO' =>array('01','20','48'),
20
- 'EXTREMADURA' =>array('06','10'),
21
- 'GALICIA' =>array('15','27','32','36'),
22
- 'LA RIOJA' =>array('26'),
23
- 'MELILLA' =>array('52'),
24
- 'PRINCIPADO DE ASTURIAS' =>array('33'),
25
- 'MURCIA' =>array('30')
26
- );
27
-
28
- var $_prov = array(
29
- "01"=>"ALAVA",
30
- "02"=>"ALBACETE",
31
- "03"=>"ALICANTE",
32
- "04"=>"ALMERIA",
33
- "33"=>"ASTURIAS",
34
- "05"=>"AVILA",
35
- "06"=>"BADAJOZ",
36
- "08"=>"BARCELONA",
37
- "09"=>"BURGOS",
38
- "10"=>"CACERES",
39
- "11"=>"CADIZ",
40
- "39"=>"CANTABRIA",
41
- "12"=>"CASTELLON",
42
- "51"=>"CEUTA",
43
- "13"=>"CIUDAD REAL",
44
- "14"=>"CORDOBA",
45
- "15"=>"CORU�A, LA",
46
- "16"=>"CUENCA",
47
- "17"=>"GIRONA",
48
- "18"=>"GRANADA",
49
- "19"=>"GUADALAJARA",
50
- "20"=>"GUIPUZCOA",
51
- "21"=>"HUELVA",
52
- "22"=>"HUESCA",
53
- "07"=>"ILLES BALEARS",
54
- "23"=>"JAEN",
55
- "24"=>"LEON",
56
- "25"=>"LLEIDA",
57
- "27"=>"LUGO",
58
- "28"=>"MADRID",
59
- "29"=>"MALAGA",
60
- "52"=>"MELILLA",
61
- "30"=>"MURCIA",
62
- "31"=>"NAVARRA",
63
- "32"=>"OURENSE",
64
- "34"=>"PALENCIA",
65
- "35"=>"PALMAS, LAS",
66
- "36"=>"PONTEVEDRA",
67
- "26"=>"RIOJA, LA",
68
- "37"=>"SALAMANCA",
69
- "38"=>"SANTA CRUZ DE TENERIFE",
70
- "40"=>"SEGOVIA",
71
- "41"=>"SEVILLA",
72
- "42"=>"SORIA",
73
- "43"=>"TARRAGONA",
74
- "44"=>"TERUEL",
75
- "45"=>"TOLEDO",
76
- "46"=>"VALENCIA",
77
- "47"=>"VALLADOLID",
78
- "48"=>"VIZCAYA",
79
- "49"=>"ZAMORA",
80
- "50"=>"ZARAGOZA"
81
- );
82
- protected $_code = 'spainpost';
83
-
84
- /**
85
- * Collects the shipping rates for Spain Post from the DRC API.
86
- *
87
- * @param Mage_Shipping_Model_Rate_Request $data
88
- * @return Mage_Shipping_Model_Rate_Result
89
- */
90
- public function collectRates(Mage_Shipping_Model_Rate_Request $request)
91
- {
92
- // Check if this method is active
93
- if (!$this->getConfigFlag('active'))
94
- {
95
- return false;
96
- }
97
-
98
- // Check if this method is even applicable (must ship from Spain)
99
- $origCountry = Mage::getStoreConfig('shipping/origin/country_id', $this->getStore());
100
-
101
- if ($origCountry != "ES"){
102
- return false;
103
- }
104
-
105
- //check if cart order value falls between the minimum and maximum order amounts required
106
- $packagevalue = $request->getBaseCurrency()->convert($request->getPackageValue(), $request->getPackageCurrency());
107
- $minorderval = $this->getConfigData('min_order_value');
108
- $maxorderval = $this->getConfigData('max_order_value');
109
- if($packagevalue <= $minorderval || $packagevalue >= $maxorderval){
110
- return false;
111
- }
112
-
113
- $result = Mage::getModel('shipping/rate_result');
114
-
115
- $frompcode = Mage::getStoreConfig('shipping/origin/postcode', $this->getStore()); // CODIGO POSTAL DE LA TIENDA
116
- $topcode = $request->getDestPostcode(); // CODIGO POSTAL DEL COMPRADOR
117
- file_put_contents("pais.txt",$request->getDestCountryId());
118
- if ($request->getDestCountryId())
119
- {
120
- $destCountry = $request->getDestCountryId();
121
- }
122
- else
123
- {
124
- $destCountry = "ES";
125
- }
126
-
127
- $sweightunit = 1; //$this->getConfigData('weight_units');
128
-
129
- $sweight = $request->getPackageWeight()*$sweightunit;
130
-
131
- // En el caso de que sea dentro de espa�a se muestra
132
- // en caso contrario no
133
- if($destCountry == "ES")
134
- {
135
- if($frompcode == $topcode){
136
- // PRECIO PROVINCIAL
137
- $servicio='PROVINCIAL';
138
- } else {
139
- $id_region = $this->getRegion($topcode,$frompcode);
140
- if($id_region == true){
141
- // PRECIO REGIONAL PARA PROVINCIAS DE LA MISMA REGION
142
- $servicio='REGIONAL';
143
- } else {
144
- // PRECIO NACIONAL PARA TODA ESPA�A
145
- $servicio='NACIONAL';
146
- }
147
- }
148
- switch($servicio){
149
- case 'PROVINCIAL':
150
- $shipping_method = 'PACK';
151
- if($sweight <= '2000') {
152
- $shipping_method = 'BAG';
153
- $price = 6.01;
154
- } elseif(($sweight > '2000') && ($sweight <='5000')){
155
- $price = 6.74;
156
- } elseif(($sweight > '5000') && ($sweight <='10000')){
157
- $price = 8.49;
158
- } else {
159
- $price = 8.49;
160
- $peso=$sweight - 10000;
161
- $price += (ceil($peso / 5000)) * 1.91;
162
- }
163
- break;
164
- case 'REGIONAL':
165
- $shipping_method = 'PACK';
166
- if($sweight <= '2000') {
167
- $shipping_method = 'BAG';
168
- $price = 7.11;
169
- } elseif(($sweight > '2000') && ($sweight <='5000')){
170
- $price = 18.88;
171
- } elseif(($sweight > '5000') && ($sweight <='10000')){
172
- $price = 25.84;
173
- } else {
174
- $price = 25.84;
175
- $peso=$sweight - 10000;
176
- $price += (ceil($peso / 5000)) * 3.62;
177
- }
178
- break;
179
- case 'NACIONAL':
180
- $shipping_method = 'PACK';
181
- if($sweight <= '2000') {
182
- $shipping_method = 'BAG';
183
- $price = 7.58;
184
- } elseif(($sweight > '2000') && ($sweight <='5000')){
185
- $price = 9.57;
186
- } elseif(($sweight > '5000') && ($sweight <='10000')){
187
- $price = 13.54;
188
- } else {
189
- $price = 13.54;
190
- $peso=$sweight - 10000;
191
- $price += (ceil($peso / 5000)) * 3.96;
192
- }
193
- break;
194
- }
195
-
196
- $price=($price * 1.16) + 1;
197
-
198
- $method = Mage::getModel('shipping/rate_result_method');
199
- // set the shipping type....
200
- $type = $this->getConfigData('type');
201
- $qty = $request->getPackageQty();
202
-
203
- $tot = ($qty * $price);
204
-
205
- if ($this->getConfigData('type') == 'O') { // by order
206
- $shippingPrice = $price;
207
- } elseif ($type == 'I') { // by item
208
- $shippingPrice = ($qty * $price);
209
- } else {
210
- $shippingPrice = false;
211
- }
212
-
213
- // set the handling fee type....
214
- $calculateHandlingFee = $this->getConfigData('handling_type');
215
- $handlingFee = $this->getConfigData('handling_fee');
216
- if ($this->getConfigData('handling_type') == 'F') {
217
- $shippingPrice += $this->getConfigData('handling_fee');
218
- } else {
219
- $handlingFee = ($shippingPrice * $this->getConfigData('handling_fee'))/100;
220
- $shippingPrice += $handlingFee;
221
- }
222
-
223
- $method->setCarrier('spainpost');
224
- $method->setCarrierTitle($this->getConfigData('title'));
225
- $method->setMethod($shipping_method);
226
- $method->setMethodTitle($this->getConfigData('title') . ": $shipping_method");
227
- $method->setPrice($shippingPrice);
228
- $method->setCost($shippingPrice);
229
- $result->append($method);
230
- } else {
231
- return false;
232
- }
233
- return $result;
234
- }
235
-
236
- public function getRegion($topcode,$compare=null){
237
- $ind=substr($topcode,0,2);
238
- $prov=$this->_prov[$ind];
239
- foreach($this->_regions as $id => $val){
240
- if(in_array($ind,$val)){
241
- $region=$id;
242
- }
243
- }
244
- if($compare !== null){
245
- $compare=$this->getRegion($compare);
246
- if($region === $compare)
247
- return true;
248
- else
249
- return false;
250
- }
251
- return $region;
252
- }
253
-
254
-
255
- /**
256
- * Get allowed shipping methods
257
- *
258
- * @return array
259
- */
260
- public function getAllowedMethods()
261
- {
262
- return array('spainpost' => $this->getConfigData('name'));
263
- }
264
-
265
- }
 
1
+ <?php
2
+ class Nacex_Shipping_Model_Carrier_Spainpost extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
3
+
4
+ public $_regions = array(
5
+ 'ANDALUCIA' =>array('04','11','14','18','21','23','29','41'),
6
+ 'ARAGON' =>array('22','44','50'),
7
+ 'BALEARES' =>array('07'),
8
+ 'CANARIAS' =>array('35','38'),
9
+ 'CANTABRIA' =>array('39'),
10
+ 'CASTILLA Y LEON' =>array('05','09','24','34','37','40','42','47','49'),
11
+ 'CASTILLA LA MANCA' =>array('02','13','16','19','45'),
12
+ 'CATALU�A' =>array('08','17','25','43'),
13
+ 'CEUTA' =>array('51'),
14
+ 'COMUNIDAD DE MADRID' =>array('28'),
15
+ 'COMUNIDAD FORAL DE NAVARRA' =>array('31'),
16
+ 'COMUNIDAD VALENCIANA' =>array('03','12','46'),
17
+ 'EUSKADI - PAIS VASCO' =>array('01','20','48'),
18
+ 'EXTREMADURA' =>array('06','10'),
19
+ 'GALICIA' =>array('15','27','32','36'),
20
+ 'LA RIOJA' =>array('26'),
21
+ 'MELILLA' =>array('52'),
22
+ 'PRINCIPADO DE ASTURIAS' =>array('33'),
23
+ 'MURCIA' =>array('30')
24
+ );
25
+
26
+
27
+ public $_prov = array( "01"=>"ALAVA", "02"=>"ALBACETE", "03"=>"ALICANTE", "04"=>"ALMERIA","33"=>"ASTURIAS","05"=>"AVILA", "06"=>"BADAJOZ", "08"=>"BARCELONA", "09"=>"BURGOS", "10"=>"CACERES", "11"=>"CADIZ", "39"=>"CANTABRIA", "12"=>"CASTELLON", "51"=>"CEUTA", "13"=>"CIUDAD REAL", "14"=>"CORDOBA", "15"=>"CORU�A, LA", "16"=>"CUENCA", "17"=>"GIRONA", "18"=>"GRANADA", "19"=>"GUADALAJARA", "20"=>"GUIPUZCOA", "21"=>"HUELVA", "22"=>"HUESCA", "07"=>"ILLES BALEARS", "23"=>"JAEN", "24"=>"LEON","25"=>"LLEIDA", "27"=>"LUGO", "28"=>"MADRID", "29"=>"MALAGA", "52"=>"MELILLA", "30"=>"MURCIA", "31"=>"NAVARRA", "32"=>"OURENSE", "34"=>"PALENCIA", "35"=>"PALMAS, LAS", "36"=>"PONTEVEDRA", "26"=>"RIOJA, LA", "37"=>"SALAMANCA", "38"=>"SANTA CRUZ DE TENERIFE", "40"=>"SEGOVIA", "41"=>"SEVILLA", "42"=>"SORIA", "43"=>"TARRAGONA","44"=>"TERUEL", "45"=>"TOLEDO", "46"=>"VALENCIA", "47"=>"VALLADOLID", "48"=>"VIZCAYA", "49"=>"ZAMORA", "50"=>"ZARAGOZA");
28
+
29
+ protected $_frompcode;
30
+ protected $_topcode;
31
+ protected $_servicio;
32
+ protected $_sweight;
33
+ protected $_code = 'spainpost';
34
+
35
+ /**
36
+ * Collects the shipping rates for Spain Post from the DRC API.
37
+ *
38
+ * @param Mage_Shipping_Model_Rate_Request $data
39
+ * @return Mage_Shipping_Model_Rate_Result
40
+ */
41
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
42
+ // Check if this method is active
43
+ if (!$this->getConfigFlag('active')) {
44
+ return false;
45
+ }
46
+
47
+ // Check if this method is even applicable (must ship from Spain)
48
+ $origCountry = Mage::getStoreConfig('shipping/origin/country_id', $this->getStore());
49
+
50
+ if ($origCountry != "ES") {
51
+ return false;
52
+ }
53
+
54
+ //check if cart order value falls between the minimum and maximum order amounts required
55
+ $packagevalue = $request->getBaseCurrency()->convert($request->getPackageValue(), $request->getPackageCurrency());
56
+ $minorderval = $this->getConfigData('min_order_value');
57
+ $maxorderval = $this->getConfigData('max_order_value');
58
+ if($packagevalue <= $minorderval || (($maxorderval != '0') && $packagevalue >= $maxorderval)){
59
+ return false;
60
+ }
61
+
62
+ $result = Mage::getModel('shipping/rate_result');
63
+
64
+ // CODIGO POSTAL DE LA TIENDA
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
+ // set the shipping type....
87
+ $type = $this->getConfigData('type');
88
+ $qty = $request->getPackageQty();
89
+
90
+ $tot = ($qty * $price);
91
+
92
+ if ($this->getConfigData('type') == 'O') { // by order
93
+ $shippingPrice = $price;
94
+ } elseif ($type == 'I') { // by item
95
+ $shippingPrice = ($qty * $price);
96
+ } else {
97
+ $shippingPrice = false;
98
+ }
99
+
100
+ // set the handling fee type....
101
+ $calculateHandlingFee = $this->getConfigData('handling_type');
102
+ $handlingFee = $this->getConfigData('handling_fee');
103
+ if ($this->getConfigData('handling_type') == 'F') {
104
+ $shippingPrice += $this->getConfigData('handling_fee');
105
+ } else {
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);
117
+ } else {
118
+ return false;
119
+ }
120
+ return $result;
121
+ }
122
+
123
+ public function getRegion($topcode,$compare=null){
124
+ $ind=substr($topcode,0,2);
125
+ $prov=$this->_prov[$ind];
126
+ foreach($this->_regions as $id => $val){
127
+ if(in_array($ind,$val)){
128
+ $region=$id;
129
+ continue;
130
+ }
131
+ }
132
+ if($compare !== null){
133
+ $compare=$this->getRegion($compare);
134
+ if($region === $compare)
135
+ return true;
136
+ else
137
+ return false;
138
+ }
139
+ return $region;
140
+ }
141
+
142
+ /**
143
+ * Get allowed shipping methods
144
+ *
145
+ * @return array
146
+ */
147
+ public function getAllowedMethods() {
148
+ return array('spainpost' => $this->getConfigData('name'));
149
+ }
150
+
151
+ public function getPrecio(){
152
+ switch($this->_servicio){
153
+ case 'PROVINCIAL':
154
+ $this->_shipping_method = 'PACK';
155
+ if($this->_sweight <= '2000') {
156
+ $this->_shipping_method = 'BAG';
157
+ $price = 6.01;
158
+ } elseif(($this->_sweight > '2000') && ($this->_sweight <='5000')){
159
+ $price = 6.74;
160
+ } elseif(($this->_sweight > '5000') && ($this->_sweight <='10000')){
161
+ $price = 8.49;
162
+ } else {
163
+ $price = 8.49;
164
+ $peso=$this->_sweight - 10000;
165
+ $price += (ceil($peso / 5000)) * 1.91;
166
+ }
167
+ break;
168
+ case 'REGIONAL':
169
+ $this->_shipping_method = 'PACK';
170
+ if($this->_sweight <= '2000') {
171
+ $this->_shipping_method = 'BAG';
172
+ $price = 7.11;
173
+ } elseif(($this->_sweight > '2000') && ($this->_sweight <='5000')){
174
+ $price = 18.88;
175
+ } elseif(($this->_sweight > '5000') && ($this->_sweight <='10000')){
176
+ $price = 25.84;
177
+ } else {
178
+ $price = 25.84;
179
+ $peso=$this->_sweight - 10000;
180
+ $price += (ceil($peso / 5000)) * 3.62;
181
+ }
182
+ break;
183
+ case 'NACIONAL':
184
+ $this->_shipping_method = 'PACK';
185
+ if($this->_sweight <= '2000') {
186
+ $this->_shipping_method = 'BAG';
187
+ $price = 7.58;
188
+ } elseif(($this->_sweight > '2000') && ($this->_sweight <='5000')){
189
+ $price = 9.57;
190
+ } elseif(($this->_sweight > '5000') && ($this->_sweight <='10000')){
191
+ $price = 13.54;
192
+ } else {
193
+ $price = 13.54;
194
+ $peso=$this->_sweight - 10000;
195
+ $price += (ceil($peso / 5000)) * 3.96;
196
+ }
197
+ break;
198
+ case 'NACIONAL BALEARES':
199
+ $this->_shipping_method = 'PACK';
200
+ if($this->_sweight <= '2000') {
201
+ $this->_shipping_method = 'BAG';
202
+ $price = 10.56;
203
+ } elseif(($this->_sweight > '2000') && ($this->_sweight <='4000')){
204
+ $price = 16.48;
205
+ } else {
206
+ $price = 16.48;
207
+ $peso=$this->_sweight - 4000;
208
+ $price += (ceil($peso / 2000)) * 4;
209
+ }
210
+ break;
211
+ case 'INTRAISLAS':
212
+ $this->_shipping_method = 'PACK';
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;
220
+ } else {
221
+ $price = 8.76;
222
+ $peso=$this->_sweight - 10000;
223
+ $price += (ceil($peso / 5000)) * 1.99;
224
+ }
225
+ break;
226
+
227
+ }
228
+ return $price;
229
+ }
230
+
231
+
232
+ /*
233
+ * Setea el tipo de servicio segun la ubicacion del cliente
234
+ * con respecto a la tienda
235
+ */
236
+ public function setServicio(){
237
+ switch($this->_frompcode){
238
+ // PARA LA TIENDA EN BALEARES
239
+ case '07':
240
+ if($this->_frompcode == $this->_topcode){
241
+ // PRECIO INTRAISLAS
242
+ $this->_servicio='INTRAISLAS';
243
+ } else {
244
+ // PRECIO NACIONAL PARA TODA ESPA�A
245
+ $this->_servicio='NACIONAL BALEARES';
246
+ }
247
+ break;
248
+ // PARA LA TIENDA EN EL RESTO DE ESPA�A
249
+ default:
250
+ if($this->_frompcode == $this->_topcode){
251
+ // PRECIO PROVINCIAL
252
+ $this->_servicio='PROVINCIAL';
253
+ } else {
254
+ $id_region = $this->getRegion($this->_topcode,$this->_frompcode);
255
+ if($id_region == true){
256
+ // PRECIO REGIONAL PARA PROVINCIAS DE LA MISMA REGION
257
+ $this->_servicio='REGIONAL';
258
+ } else {
259
+ // PRECIO NACIONAL PARA TODA ESPA�A
260
+ $this->_servicio='NACIONAL';
261
+ }
262
+ }
263
+ break;
264
+ }
265
+ }
266
+ }
app/code/community/Nacex/Shipping/etc/config.xml CHANGED
@@ -1,59 +1,59 @@
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
+ </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>
app/code/community/Nacex/Shipping/etc/system.xml CHANGED
@@ -1,94 +1,94 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <sections>
4
- <carriers>
5
- <groups>
6
- <spainpost translate="label" module="shipping">
7
- <label>Nacex</label>
8
- <frontend_type>text</frontend_type>
9
- <sort_order>1</sort_order>
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>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <carriers>
5
+ <groups>
6
+ <spainpost translate="label" module="shipping">
7
+ <label>Nacex</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>1</sort_order>
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>
app/code/community/Nacex/Shipping/sql/shipping_setup/mysql4-install-0.1.0.php CHANGED
@@ -1,23 +1,23 @@
1
- <?php
2
- /**
3
- * Magento Nacex Shipping
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
-
22
-
23
  ?>
1
+ <?php
2
+ /**
3
+ * Magento Nacex Shipping
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
+
22
+
23
  ?>
app/etc/modules/Nacex_Shipping.xml CHANGED
@@ -1,30 +1,30 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * Magento Nacex Shipping
5
- *
6
- * NOTICE OF LICENSE
7
- *
8
- * This source file is subject to the Open Software License (OSL 3.0)
9
- * that is bundled with this package in the file LICENSE.txt.
10
- * It is also available through the world-wide-web at this URL:
11
- * http://opensource.org/licenses/osl-3.0.php
12
- * If you did not receive a copy of the license and are unable to
13
- * obtain it through the world-wide-web, please send an email
14
- * to license@magentocommerce.com so we can send you a copy immediately.
15
- *
16
- * @category Nacex
17
- * @package Nacex_Shipping
18
- * @copyright
19
- * @author
20
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
- */
22
- -->
23
- <config>
24
- <modules>
25
- <Nacex_Shipping>
26
- <active>true</active>
27
- <codePool>community</codePool>
28
- </Nacex_Shipping>
29
- </modules>
30
- </config>
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento Nacex Shipping
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Nacex
17
+ * @package Nacex_Shipping
18
+ * @copyright
19
+ * @author
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+ -->
23
+ <config>
24
+ <modules>
25
+ <Nacex_Shipping>
26
+ <active>true</active>
27
+ <codePool>community</codePool>
28
+ </Nacex_Shipping>
29
+ </modules>
30
+ </config>
package.xml CHANGED
@@ -1,18 +1,23 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Shipping_Nacex</name>
4
- <version>1.0.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>Metodo de envio para nacex</summary>
10
  <description>Metodo de envio para nacex</description>
11
- <notes>* Version estable del metodo de envio para la empresa Nacex</notes>
12
- <authors><author><name>Manuel</name><user>auto-converted</user><email>manuelcanepa@gmail.com</email></author></authors>
13
- <date>2008-08-22</date>
14
- <time>16:16:41</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="Nacex_Shipping.xml" hash="900734fd3feec45c7276f7ad762b7013"/></dir></target><target name="magecommunity"><dir name="Nacex"><dir name="Shipping"><dir name="etc"><file name="config.xml" hash="520c2766de44cf2fc53f1c2118a5cd69"/><file name="system.xml" hash="b1feee308b495e57dff8db7722d25998"/></dir><dir name="Helper"><file name="Data.php" hash="92d6c5b5abad03866fef51c768e3ebdd"/></dir><dir name="Model"><dir name="Carrier"><file name="Spainpost.php" hash="0bcbe05270488db95d7bbfa5e1ad40da"/></dir></dir><dir name="sql"><dir name="shipping_setup"><file name="mysql4-install-0.1.0.php" hash="e28973e4c3edf00b284a998b32f53829"/></dir></dir></dir></dir></target></contents>
 
 
 
 
 
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Shipping_Nacex</name>
4
+ <version>1.0.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>Metodo de envio para nacex</summary>
10
  <description>Metodo de envio para nacex</description>
11
+ <notes>1.0.1
12
+ * Correccion de precios.
13
+ * Agregado de datos para la tienda en baleares.
14
+
15
+ CHANGES:
16
+ -&gt;U app/code/community/Nacex/Shipping/Model/Carrier/Spainpost.php</notes>
17
+ <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>
18
+ <date>2008-10-07</date>
19
+ <time>13:02:53</time>
20
+ <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="8c321bf811f9858a973348efe105e3ee"/></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>
21
  <compatible/>
22
  <dependencies/>
23
  </package>