Version Notes
* Separa los metodos de envio para poder ingresar un mensaje por cada uno de ellos
CHANGES:
->A app/code/community/Nacex/Shipping/Model/Carrier/Naxgab.php
->A app/code/community/Nacex/Shipping/Model/Carrier/Naxjow.php
->A app/code/community/Nacex/Shipping/Model/Standard/Data.php
->A app/code/community/Nacex/Shipping/Model/Standard/Weightunits.php
->A app/code/community/Nacex/Shipping/sql/shipping_setup/mysql4-upgrade-1.0.8.php
->D app/code/community/Nacex/Shipping/Model/Weightunits.php
->D app/code/community/Nacex/Shipping/Model/Methods.php
->D app/code/community/Nacex/Shipping/Model/Carrier/Spainpost.php
->U app/code/community/Nacex/Shipping/etc/system.xml
->U app/code/community/Nacex/Shipping/etc/config.xml
Download this release
Release Info
| Developer | Magento Core Team |
| Extension | Shipping_Nacex |
| Version | 1.0.8 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.7 to 1.0.8
- app/code/community/Nacex/Shipping/Model/Carrier/Naxgab.php +133 -0
- app/code/community/Nacex/Shipping/Model/Carrier/Naxjow.php +133 -0
- app/code/community/Nacex/Shipping/Model/Carrier/Spainpost.php +0 -343
- app/code/community/Nacex/Shipping/Model/Methods.php +0 -9
- app/code/community/Nacex/Shipping/Model/Standard/Data.php +186 -0
- app/code/community/Nacex/Shipping/Model/{Weightunits.php → Standard/Weightunits.php} +1 -1
- app/code/community/Nacex/Shipping/etc/config.xml +22 -9
- app/code/community/Nacex/Shipping/etc/system.xml +112 -11
- app/code/community/Nacex/Shipping/sql/shipping_setup/mysql4-upgrade-1.0.8.php +29 -0
- package.xml +15 -6
app/code/community/Nacex/Shipping/Model/Carrier/Naxgab.php
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Nacex_Shipping_Model_Carrier_Naxgab extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
|
| 3 |
+
|
| 4 |
+
protected $_frompcode;
|
| 5 |
+
protected $_topcode;
|
| 6 |
+
protected $_servicio;
|
| 7 |
+
protected $_sweight;
|
| 8 |
+
protected $_title;
|
| 9 |
+
protected $_code = 'naxgab';
|
| 10 |
+
|
| 11 |
+
public function __construct(){
|
| 12 |
+
$this->_title = $this->getConfigData('title');
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
public function getAllowedMethods(){
|
| 16 |
+
return array($this->_code => $this->getConfigData('msg'));
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Collects the shipping rates for Spain Post from the DRC API.
|
| 21 |
+
*
|
| 22 |
+
* @param Mage_Shipping_Model_Rate_Request $data
|
| 23 |
+
* @return Mage_Shipping_Model_Rate_Result
|
| 24 |
+
*/
|
| 25 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
|
| 26 |
+
// Check if this method is active
|
| 27 |
+
if (!$this->getConfigFlag('active')) {
|
| 28 |
+
return false;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
// Check if this method is even applicable (must ship from Spain)
|
| 32 |
+
$origCountry = Mage::getStoreConfig('shipping/origin/country_id', $this->getStore());
|
| 33 |
+
$result = Mage::getModel('shipping/rate_result');
|
| 34 |
+
|
| 35 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
| 36 |
+
if ($origCountry != "ES") {
|
| 37 |
+
if($this->getConfigData('showmethod')){
|
| 38 |
+
$error->setCarrier($this->_code)
|
| 39 |
+
->setCarrierTitle($this->getConfigData('title'))
|
| 40 |
+
->setErrorMessage($this->getConfigData('specificerrmsg'));
|
| 41 |
+
$result->append($error);
|
| 42 |
+
return $result;
|
| 43 |
+
} else {
|
| 44 |
+
return false;
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
//check if cart order value falls between the minimum and maximum order amounts required
|
| 49 |
+
$packagevalue = $request->getBaseCurrency()->convert($request->getPackageValue(), $request->getPackageCurrency());
|
| 50 |
+
$minorderval = (int)$this->getConfigData('min_order_value');
|
| 51 |
+
$maxorderval = (int)$this->getConfigData('max_order_value');
|
| 52 |
+
if(
|
| 53 |
+
/* EL PAQUETE ES MENOR O IGUAL AL MINIMO Y EL MINIMO ESTA HABILITADO*/
|
| 54 |
+
($packagevalue <= $minorderval) && ($minorderval > 0) ||
|
| 55 |
+
/* EL PAQUETE ES MAYOR O IGUAL AL MAXIMO Y EL MAXIMO ESTA HABILITADO*/
|
| 56 |
+
(($maxorderval != 0) && ($packagevalue >= $maxorderval))){
|
| 57 |
+
if($this->getConfigData('showmethod')){
|
| 58 |
+
$error->setCarrier($this->_code)
|
| 59 |
+
->setCarrierTitle($this->getConfigData('title'));
|
| 60 |
+
$currency = Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE);
|
| 61 |
+
/* SI EL MINIMO Y EL MAXIMO ESTA HABILITADO*/
|
| 62 |
+
if($minorderval != 0 && $maxorderval != 0){
|
| 63 |
+
$errorMsg=Mage::helper('nacex')->__('Package value must be between %s and %s',Mage::app()->getStore()->formatPrice($minorderval),Mage::app()->getStore()->formatPrice($maxorderval));
|
| 64 |
+
/* SI EL MAXIMO ESTA HABILITADO*/
|
| 65 |
+
}elseif($maxorderval != 0){
|
| 66 |
+
$errorMsg=Mage::helper('nacex')->__('Package value must be less than %s',
|
| 67 |
+
Mage::app()->getStore()->formatPrice($maxorderval)
|
| 68 |
+
);
|
| 69 |
+
/* SI EL MINIMO ESTA HABILITADO*/
|
| 70 |
+
}else{
|
| 71 |
+
$errorMsg=Mage::helper('nacex')->__('Package value must be higher than %s',Mage::app()->getStore()->formatPrice($minorderval));
|
| 72 |
+
}
|
| 73 |
+
$error->setErrorMessage($errorMsg);
|
| 74 |
+
$result->append($error);
|
| 75 |
+
return $result;
|
| 76 |
+
} else {
|
| 77 |
+
return false;
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
// CODIGO POSTAL DE LA TIENDA
|
| 82 |
+
$this->_frompcode = Mage::getStoreConfig('shipping/origin/postcode', $this->getStore());
|
| 83 |
+
// CODIGO POSTAL DEL COMPRADOR
|
| 84 |
+
$this->_topcode = $request->getDestPostcode();
|
| 85 |
+
if ($request->getDestCountryId()) {
|
| 86 |
+
$destCountry = $request->getDestCountryId();
|
| 87 |
+
} else {
|
| 88 |
+
$destCountry = "ES";
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
$sweightunit = $this->getConfigData('weight_units');
|
| 92 |
+
$this->_sweight = $request->getPackageWeight()*$sweightunit;
|
| 93 |
+
|
| 94 |
+
// En el caso de que sea dentro de espa�a se muestra
|
| 95 |
+
// en caso contrario no
|
| 96 |
+
if($destCountry == "ES") {
|
| 97 |
+
try {
|
| 98 |
+
$this->_servicio = Mage::getSingleton('nacex/standard_data')->setServicio($this->_frompcode,$this->_topcode);
|
| 99 |
+
$_params = array('servicio'=>$this->_servicio,'sweight'=>$this->_sweight,'code'=>$this->_code);
|
| 100 |
+
$datosPrecio = Mage::getSingleton('nacex/standard_data')->getPrecio($_params);
|
| 101 |
+
$shippingPrice = $datosPrecio['price'];
|
| 102 |
+
// set the handling fee type....
|
| 103 |
+
$calculateHandlingFee = $this->getConfigData('handling_type');
|
| 104 |
+
$handlingFee = $this->getConfigData('handling_fee');
|
| 105 |
+
if ($this->getConfigData('handling_type') == 'F') {
|
| 106 |
+
$shippingPrice += $this->getConfigData('handling_fee');
|
| 107 |
+
} else {
|
| 108 |
+
$handlingFee = ($shippingPrice * $this->getConfigData('handling_fee'))/100;
|
| 109 |
+
$shippingPrice += $handlingFee;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
$rate = Mage::getModel('shipping/rate_result_method');
|
| 113 |
+
$rate->setCarrier($this->_code);
|
| 114 |
+
$rate->setCarrierTitle($this->getConfigData('title'));
|
| 115 |
+
$rate->setMethod($this->_code);
|
| 116 |
+
$rate->setMethodTitle($this->getConfigData('msg'));
|
| 117 |
+
$rate->setCost($datosPrecio['price']);
|
| 118 |
+
$rate->setPrice($shippingPrice);
|
| 119 |
+
$result->append($rate);
|
| 120 |
+
} catch(Exception $e){
|
| 121 |
+
Mage::logException($e);
|
| 122 |
+
return false;
|
| 123 |
+
}
|
| 124 |
+
} else {
|
| 125 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
| 126 |
+
$error->setCarrier($this->_code);
|
| 127 |
+
$error->setCarrierTitle($this->getConfigData('title'));
|
| 128 |
+
$error->setErrorMessage($this->getConfigData('specificerrmsg'));
|
| 129 |
+
$result->append($error);
|
| 130 |
+
}
|
| 131 |
+
return $result;
|
| 132 |
+
}
|
| 133 |
+
}
|
app/code/community/Nacex/Shipping/Model/Carrier/Naxjow.php
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Nacex_Shipping_Model_Carrier_Naxjow extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
|
| 3 |
+
|
| 4 |
+
protected $_frompcode;
|
| 5 |
+
protected $_topcode;
|
| 6 |
+
protected $_servicio;
|
| 7 |
+
protected $_sweight;
|
| 8 |
+
protected $_title;
|
| 9 |
+
protected $_code = 'naxjow';
|
| 10 |
+
|
| 11 |
+
public function __construct(){
|
| 12 |
+
$this->_title = $this->getConfigData('title');
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
public function getAllowedMethods(){
|
| 16 |
+
return array($this->_code => $this->getConfigData('msg'));
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Collects the shipping rates for Spain Post from the DRC API.
|
| 21 |
+
*
|
| 22 |
+
* @param Mage_Shipping_Model_Rate_Request $data
|
| 23 |
+
* @return Mage_Shipping_Model_Rate_Result
|
| 24 |
+
*/
|
| 25 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
|
| 26 |
+
// Check if this method is active
|
| 27 |
+
if (!$this->getConfigFlag('active')) {
|
| 28 |
+
return false;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
// Check if this method is even applicable (must ship from Spain)
|
| 32 |
+
$origCountry = Mage::getStoreConfig('shipping/origin/country_id', $this->getStore());
|
| 33 |
+
$result = Mage::getModel('shipping/rate_result');
|
| 34 |
+
|
| 35 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
| 36 |
+
if ($origCountry != "ES") {
|
| 37 |
+
if($this->getConfigData('showmethod')){
|
| 38 |
+
$error->setCarrier($this->_code)
|
| 39 |
+
->setCarrierTitle($this->getConfigData('title'))
|
| 40 |
+
->setErrorMessage($this->getConfigData('specificerrmsg'));
|
| 41 |
+
$result->append($error);
|
| 42 |
+
return $result;
|
| 43 |
+
} else {
|
| 44 |
+
return false;
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
//check if cart order value falls between the minimum and maximum order amounts required
|
| 49 |
+
$packagevalue = $request->getBaseCurrency()->convert($request->getPackageValue(), $request->getPackageCurrency());
|
| 50 |
+
$minorderval = (int)$this->getConfigData('min_order_value');
|
| 51 |
+
$maxorderval = (int)$this->getConfigData('max_order_value');
|
| 52 |
+
if(
|
| 53 |
+
/* EL PAQUETE ES MENOR O IGUAL AL MINIMO Y EL MINIMO ESTA HABILITADO*/
|
| 54 |
+
($packagevalue <= $minorderval) && ($minorderval > 0) ||
|
| 55 |
+
/* EL PAQUETE ES MAYOR O IGUAL AL MAXIMO Y EL MAXIMO ESTA HABILITADO*/
|
| 56 |
+
(($maxorderval != 0) && ($packagevalue >= $maxorderval))){
|
| 57 |
+
if($this->getConfigData('showmethod')){
|
| 58 |
+
$error->setCarrier($this->_code)
|
| 59 |
+
->setCarrierTitle($this->getConfigData('title'));
|
| 60 |
+
$currency = Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE);
|
| 61 |
+
/* SI EL MINIMO Y EL MAXIMO ESTA HABILITADO*/
|
| 62 |
+
if($minorderval != 0 && $maxorderval != 0){
|
| 63 |
+
$errorMsg=Mage::helper('nacex')->__('Package value must be between %s and %s',Mage::app()->getStore()->formatPrice($minorderval),Mage::app()->getStore()->formatPrice($maxorderval));
|
| 64 |
+
/* SI EL MAXIMO ESTA HABILITADO*/
|
| 65 |
+
}elseif($maxorderval != 0){
|
| 66 |
+
$errorMsg=Mage::helper('nacex')->__('Package value must be less than %s',
|
| 67 |
+
Mage::app()->getStore()->formatPrice($maxorderval)
|
| 68 |
+
);
|
| 69 |
+
/* SI EL MINIMO ESTA HABILITADO*/
|
| 70 |
+
}else{
|
| 71 |
+
$errorMsg=Mage::helper('nacex')->__('Package value must be higher than %s',Mage::app()->getStore()->formatPrice($minorderval));
|
| 72 |
+
}
|
| 73 |
+
$error->setErrorMessage($errorMsg);
|
| 74 |
+
$result->append($error);
|
| 75 |
+
return $result;
|
| 76 |
+
} else {
|
| 77 |
+
return false;
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
// CODIGO POSTAL DE LA TIENDA
|
| 82 |
+
$this->_frompcode = Mage::getStoreConfig('shipping/origin/postcode', $this->getStore());
|
| 83 |
+
// CODIGO POSTAL DEL COMPRADOR
|
| 84 |
+
$this->_topcode = $request->getDestPostcode();
|
| 85 |
+
if ($request->getDestCountryId()) {
|
| 86 |
+
$destCountry = $request->getDestCountryId();
|
| 87 |
+
} else {
|
| 88 |
+
$destCountry = "ES";
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
$sweightunit = $this->getConfigData('weight_units');
|
| 92 |
+
$this->_sweight = $request->getPackageWeight()*$sweightunit;
|
| 93 |
+
|
| 94 |
+
// En el caso de que sea dentro de espa�a se muestra
|
| 95 |
+
// en caso contrario no
|
| 96 |
+
if($destCountry == "ES") {
|
| 97 |
+
try {
|
| 98 |
+
$this->_servicio = Mage::getSingleton('nacex/standard_data')->setServicio($this->_frompcode,$this->_topcode);
|
| 99 |
+
$_params = array('servicio'=>$this->_servicio,'sweight'=>$this->_sweight,'code'=>$this->_code);
|
| 100 |
+
$datosPrecio = Mage::getSingleton('nacex/standard_data')->getPrecio($_params);
|
| 101 |
+
$shippingPrice = $datosPrecio['price'];
|
| 102 |
+
// set the handling fee type....
|
| 103 |
+
$calculateHandlingFee = $this->getConfigData('handling_type');
|
| 104 |
+
$handlingFee = $this->getConfigData('handling_fee');
|
| 105 |
+
if ($this->getConfigData('handling_type') == 'F') {
|
| 106 |
+
$shippingPrice += $this->getConfigData('handling_fee');
|
| 107 |
+
} else {
|
| 108 |
+
$handlingFee = ($shippingPrice * $this->getConfigData('handling_fee'))/100;
|
| 109 |
+
$shippingPrice += $handlingFee;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
$rate = Mage::getModel('shipping/rate_result_method');
|
| 113 |
+
$rate->setCarrier($this->_code);
|
| 114 |
+
$rate->setCarrierTitle($this->getConfigData('title'));
|
| 115 |
+
$rate->setMethod($this->_code);
|
| 116 |
+
$rate->setMethodTitle($this->getConfigData('msg'));
|
| 117 |
+
$rate->setCost($datosPrecio['price']);
|
| 118 |
+
$rate->setPrice($shippingPrice);
|
| 119 |
+
$result->append($rate);
|
| 120 |
+
} catch(Exception $e){
|
| 121 |
+
Mage::logException($e);
|
| 122 |
+
return false;
|
| 123 |
+
}
|
| 124 |
+
} else {
|
| 125 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
| 126 |
+
$error->setCarrier($this->_code);
|
| 127 |
+
$error->setCarrierTitle($this->getConfigData('title'));
|
| 128 |
+
$error->setErrorMessage($this->getConfigData('specificerrmsg'));
|
| 129 |
+
$result->append($error);
|
| 130 |
+
}
|
| 131 |
+
return $result;
|
| 132 |
+
}
|
| 133 |
+
}
|
app/code/community/Nacex/Shipping/Model/Carrier/Spainpost.php
DELETED
|
@@ -1,343 +0,0 @@
|
|
| 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 $_comment;
|
| 34 |
-
protected $_code = 'spainpost';
|
| 35 |
-
|
| 36 |
-
/**
|
| 37 |
-
* Collects the shipping rates for Spain Post from the DRC API.
|
| 38 |
-
*
|
| 39 |
-
* @param Mage_Shipping_Model_Rate_Request $data
|
| 40 |
-
* @return Mage_Shipping_Model_Rate_Result
|
| 41 |
-
*/
|
| 42 |
-
public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
|
| 43 |
-
// Check if this method is active
|
| 44 |
-
if (!$this->getConfigFlag('active')) {
|
| 45 |
-
return false;
|
| 46 |
-
}
|
| 47 |
-
|
| 48 |
-
// Check if this method is even applicable (must ship from Spain)
|
| 49 |
-
$origCountry = Mage::getStoreConfig('shipping/origin/country_id', $this->getStore());
|
| 50 |
-
$result = Mage::getModel('shipping/rate_result');
|
| 51 |
-
|
| 52 |
-
$error = Mage::getModel('shipping/rate_result_error');
|
| 53 |
-
if ($origCountry != "ES") {
|
| 54 |
-
if($this->getConfigData('showmethod')){
|
| 55 |
-
$error->setCarrier('spainpost')
|
| 56 |
-
->setCarrierTitle($this->getConfigData('title'))
|
| 57 |
-
->setErrorMessage($this->getConfigData('specificerrmsg'));
|
| 58 |
-
$result->append($error);
|
| 59 |
-
return $result;
|
| 60 |
-
} else {
|
| 61 |
-
return false;
|
| 62 |
-
}
|
| 63 |
-
}
|
| 64 |
-
|
| 65 |
-
//check if cart order value falls between the minimum and maximum order amounts required
|
| 66 |
-
$packagevalue = $request->getBaseCurrency()->convert($request->getPackageValue(), $request->getPackageCurrency());
|
| 67 |
-
$minorderval = (int)$this->getConfigData('min_order_value');
|
| 68 |
-
$maxorderval = (int)$this->getConfigData('max_order_value');
|
| 69 |
-
if(
|
| 70 |
-
/* EL PAQUETE ES MENOR O IGUAL AL MINIMO Y EL MINIMO ESTA HABILITADO*/
|
| 71 |
-
($packagevalue <= $minorderval) && ($minorderval > 0) ||
|
| 72 |
-
/* EL PAQUETE ES MAYOR O IGUAL AL MAXIMO Y EL MAXIMO ESTA HABILITADO*/
|
| 73 |
-
(($maxorderval != 0) && ($packagevalue >= $maxorderval))){
|
| 74 |
-
if($this->getConfigData('showmethod')){
|
| 75 |
-
$error->setCarrier('spainpost')
|
| 76 |
-
->setCarrierTitle($this->getConfigData('title'));
|
| 77 |
-
$currency = Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE);
|
| 78 |
-
/* SI EL MINIMO Y EL MAXIMO ESTA HABILITADO*/
|
| 79 |
-
if($minorderval != 0 && $maxorderval != 0){
|
| 80 |
-
$errorMsg=Mage::helper('nacex')->__('Package value must be between %s and %s',Mage::app()->getStore()->formatPrice($minorderval),Mage::app()->getStore()->formatPrice($maxorderval));
|
| 81 |
-
/* SI EL MAXIMO ESTA HABILITADO*/
|
| 82 |
-
}elseif($maxorderval != 0){
|
| 83 |
-
$errorMsg=Mage::helper('nacex')->__('Package value must be less than %s',
|
| 84 |
-
Mage::app()->getStore()->formatPrice($maxorderval)
|
| 85 |
-
);
|
| 86 |
-
/* SI EL MINIMO ESTA HABILITADO*/
|
| 87 |
-
}else{
|
| 88 |
-
$errorMsg=Mage::helper('nacex')->__('Package value must be higher than %s',Mage::app()->getStore()->formatPrice($minorderval));
|
| 89 |
-
}
|
| 90 |
-
$error->setErrorMessage($errorMsg);
|
| 91 |
-
$result->append($error);
|
| 92 |
-
return $result;
|
| 93 |
-
} else {
|
| 94 |
-
return false;
|
| 95 |
-
}
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
-
// CODIGO POSTAL DE LA TIENDA
|
| 99 |
-
$this->_frompcode = Mage::getStoreConfig('shipping/origin/postcode', $this->getStore());
|
| 100 |
-
// CODIGO POSTAL DEL COMPRADOR
|
| 101 |
-
$this->_topcode = $request->getDestPostcode();
|
| 102 |
-
if ($request->getDestCountryId()) {
|
| 103 |
-
$destCountry = $request->getDestCountryId();
|
| 104 |
-
} else {
|
| 105 |
-
$destCountry = "ES";
|
| 106 |
-
}
|
| 107 |
-
|
| 108 |
-
$sweightunit = $this->getConfigData('weight_units');
|
| 109 |
-
$this->_sweight = $request->getPackageWeight()*$sweightunit;
|
| 110 |
-
|
| 111 |
-
// En el caso de que sea dentro de espa�a se muestra
|
| 112 |
-
// en caso contrario no
|
| 113 |
-
if($destCountry == "ES") {
|
| 114 |
-
$this->setServicio();
|
| 115 |
-
$precioArr = $this->getAllowedMethods();
|
| 116 |
-
|
| 117 |
-
foreach ($precioArr as $key=>$method) {
|
| 118 |
-
/*
|
| 119 |
-
$this->_comment .= "TIENDA: {$this->_frompcode}\n";
|
| 120 |
-
$this->_comment .= "CLIENTE: {$this->_topcode}\n";
|
| 121 |
-
$this->_comment .= "SERVICIO: {$this->_servicio}\n";
|
| 122 |
-
$this->_comment .= "METODO: {$this->_shipping_method}\n";
|
| 123 |
-
$this->_comment .= "PRECIO: {$old_price}\n";
|
| 124 |
-
$this->_comment .= "UNIDAD DE PESO: {$sweightunit}\n";
|
| 125 |
-
$this->_comment .= "PESO: {$this->_sweight}\n";
|
| 126 |
-
<!--{$this->_comment}-->
|
| 127 |
-
*/
|
| 128 |
-
$shippingPrice = $method['precio'];
|
| 129 |
-
|
| 130 |
-
// set the handling fee type....
|
| 131 |
-
$calculateHandlingFee = $this->getConfigData('handling_type');
|
| 132 |
-
$handlingFee = $this->getConfigData('handling_fee');
|
| 133 |
-
if ($this->getConfigData('handling_type') == 'F') {
|
| 134 |
-
$shippingPrice += $this->getConfigData('handling_fee');
|
| 135 |
-
} else {
|
| 136 |
-
$handlingFee = ($shippingPrice * $this->getConfigData('handling_fee'))/100;
|
| 137 |
-
$shippingPrice += $handlingFee;
|
| 138 |
-
}
|
| 139 |
-
|
| 140 |
-
$rate = Mage::getModel('shipping/rate_result_method');
|
| 141 |
-
$rate->setCarrier('spainpost');
|
| 142 |
-
$rate->setCarrierTitle($this->getConfigData('title'));
|
| 143 |
-
$rate->setMethod($key);
|
| 144 |
-
$method_arr = $method['titulo'];
|
| 145 |
-
$rate->setMethodTitle(Mage::helper('nacex')->__($method_arr));
|
| 146 |
-
$rate->setCost($method['precio']);
|
| 147 |
-
$rate->setPrice($shippingPrice);
|
| 148 |
-
$result->append($rate);
|
| 149 |
-
}
|
| 150 |
-
} else {
|
| 151 |
-
$error = Mage::getModel('shipping/rate_result_error');
|
| 152 |
-
$error->setCarrier('spainpost');
|
| 153 |
-
$error->setCarrierTitle($this->getConfigData('title'));
|
| 154 |
-
$error->setErrorMessage($this->getConfigData('specificerrmsg'));
|
| 155 |
-
$result->append($error);
|
| 156 |
-
}
|
| 157 |
-
return $result;
|
| 158 |
-
}
|
| 159 |
-
|
| 160 |
-
public function getRegion($topcode,$compare=null){
|
| 161 |
-
$region = null;
|
| 162 |
-
$ind=substr($topcode,0,2);
|
| 163 |
-
foreach($this->_regions as $id => $val){
|
| 164 |
-
if(in_array($ind,$val)){
|
| 165 |
-
$region = $id;
|
| 166 |
-
continue;
|
| 167 |
-
}
|
| 168 |
-
}
|
| 169 |
-
if($compare !== null){
|
| 170 |
-
$compare=$this->getRegion($compare);
|
| 171 |
-
if($region === $compare)
|
| 172 |
-
return true;
|
| 173 |
-
else
|
| 174 |
-
return false;
|
| 175 |
-
}
|
| 176 |
-
return $region;
|
| 177 |
-
}
|
| 178 |
-
|
| 179 |
-
/**
|
| 180 |
-
* Get allowed shipping methods
|
| 181 |
-
*
|
| 182 |
-
* @return array
|
| 183 |
-
*/
|
| 184 |
-
public function getAllowedMethods() {
|
| 185 |
-
$allowed = explode(',', $this->getConfigData('allowed_methods'));
|
| 186 |
-
$arr = array();
|
| 187 |
-
foreach ($allowed as $k) {
|
| 188 |
-
$arr[$k] = array(
|
| 189 |
-
'precio'=>$this->getPrecio($k),
|
| 190 |
-
'titulo'=>"{$this->_shipping_method} - " . $this->getCode('method', $k)
|
| 191 |
-
);
|
| 192 |
-
}
|
| 193 |
-
return $arr;
|
| 194 |
-
}
|
| 195 |
-
|
| 196 |
-
public function getPrecio($cod = null){
|
| 197 |
-
$price=0;
|
| 198 |
-
switch($this->_servicio){
|
| 199 |
-
case 'PROVINCIAL':
|
| 200 |
-
$this->_shipping_method = 'PACK';
|
| 201 |
-
if($this->_sweight <= '2000') {
|
| 202 |
-
$this->_shipping_method = 'BAG';
|
| 203 |
-
$price = 6.01;
|
| 204 |
-
} elseif(($this->_sweight > '2000') && ($this->_sweight <='5000')){
|
| 205 |
-
$price = 6.74;
|
| 206 |
-
} elseif(($this->_sweight > '5000') && ($this->_sweight <='10000')){
|
| 207 |
-
$price = 8.49;
|
| 208 |
-
} else {
|
| 209 |
-
$price = 8.49;
|
| 210 |
-
$peso=$this->_sweight - 10000;
|
| 211 |
-
$price += (ceil($peso / 5000)) * 1.91;
|
| 212 |
-
}
|
| 213 |
-
break;
|
| 214 |
-
case 'REGIONAL':
|
| 215 |
-
$this->_shipping_method = 'PACK';
|
| 216 |
-
if($this->_sweight <= '2000') {
|
| 217 |
-
$this->_shipping_method = 'BAG';
|
| 218 |
-
$price = 7.11;
|
| 219 |
-
} elseif(($this->_sweight > '2000') && ($this->_sweight <='5000')){
|
| 220 |
-
$price = 18.88;
|
| 221 |
-
} elseif(($this->_sweight > '5000') && ($this->_sweight <='10000')){
|
| 222 |
-
$price = 25.84;
|
| 223 |
-
} else {
|
| 224 |
-
$price = 25.84;
|
| 225 |
-
$peso=$this->_sweight - 10000;
|
| 226 |
-
$price += (ceil($peso / 5000)) * 3.62;
|
| 227 |
-
}
|
| 228 |
-
break;
|
| 229 |
-
case 'NACIONAL':
|
| 230 |
-
$this->_shipping_method = 'PACK';
|
| 231 |
-
if($this->_sweight <= '2000') {
|
| 232 |
-
$this->_shipping_method = 'BAG';
|
| 233 |
-
$price = 7.58;
|
| 234 |
-
} elseif(($this->_sweight > '2000') && ($this->_sweight <='5000')){
|
| 235 |
-
$price = 9.57;
|
| 236 |
-
} elseif(($this->_sweight > '5000') && ($this->_sweight <='10000')){
|
| 237 |
-
$price = 13.54;
|
| 238 |
-
} else {
|
| 239 |
-
$price = 13.54;
|
| 240 |
-
$peso=$this->_sweight - 10000;
|
| 241 |
-
$price += (ceil($peso / 5000)) * 3.96;
|
| 242 |
-
}
|
| 243 |
-
break;
|
| 244 |
-
case 'NACIONAL_BALEARES':
|
| 245 |
-
$this->_shipping_method = 'PACK';
|
| 246 |
-
if($this->_sweight <= '2000') {
|
| 247 |
-
$this->_shipping_method = 'BAG';
|
| 248 |
-
$price = 10.56;
|
| 249 |
-
} elseif(($this->_sweight > '2000') && ($this->_sweight <='4000')){
|
| 250 |
-
$price = 16.48;
|
| 251 |
-
} else {
|
| 252 |
-
$price = 16.48;
|
| 253 |
-
$peso=$this->_sweight - 4000;
|
| 254 |
-
$price += (ceil($peso / 2000)) * 4;
|
| 255 |
-
}
|
| 256 |
-
break;
|
| 257 |
-
case 'INTRAISLAS':
|
| 258 |
-
$this->_shipping_method = 'PACK';
|
| 259 |
-
if($this->_sweight <= '2000') {
|
| 260 |
-
$this->_shipping_method = 'BAG';
|
| 261 |
-
$price = 6.18;
|
| 262 |
-
} elseif(($this->_sweight <= '5000')){
|
| 263 |
-
$price = 6.95;
|
| 264 |
-
} elseif(($this->_sweight <='10000')){
|
| 265 |
-
$price = 8.76;
|
| 266 |
-
} else {
|
| 267 |
-
$price = 8.76;
|
| 268 |
-
$peso=$this->_sweight - 10000;
|
| 269 |
-
$price += (ceil($peso / 5000)) * 1.99;
|
| 270 |
-
}
|
| 271 |
-
break;
|
| 272 |
-
|
| 273 |
-
}
|
| 274 |
-
// Agrega el iva mas un Euro
|
| 275 |
-
$price = ($price * 1.16) + 1;
|
| 276 |
-
switch($cod){
|
| 277 |
-
case 'NAXGAB':
|
| 278 |
-
// En caso de ida y vuelta duplica el valor
|
| 279 |
-
$price *= 2;
|
| 280 |
-
break;
|
| 281 |
-
}
|
| 282 |
-
return $price;
|
| 283 |
-
}
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
/*
|
| 287 |
-
* Setea el tipo de servicio segun la ubicacion del cliente
|
| 288 |
-
* con respecto a la tienda
|
| 289 |
-
*/
|
| 290 |
-
public function setServicio(){
|
| 291 |
-
$code_store = substr($this->_frompcode,0,2);
|
| 292 |
-
switch($code_store){
|
| 293 |
-
// PARA LA TIENDA EN BALEARES
|
| 294 |
-
case '07':
|
| 295 |
-
if($this->getRegion($code_store,$this->_topcode)){
|
| 296 |
-
// PRECIO INTRAISLAS
|
| 297 |
-
$this->_servicio='INTRAISLAS';
|
| 298 |
-
} else {
|
| 299 |
-
// PRECIO NACIONAL PARA TODA ESPA�A
|
| 300 |
-
$this->_servicio='NACIONAL_BALEARES';
|
| 301 |
-
}
|
| 302 |
-
break;
|
| 303 |
-
// PARA LA TIENDA EN EL RESTO DE ESPA�A
|
| 304 |
-
default:
|
| 305 |
-
if($this->_frompcode == $this->_topcode){
|
| 306 |
-
// PRECIO PROVINCIAL
|
| 307 |
-
$this->_servicio='PROVINCIAL';
|
| 308 |
-
} else {
|
| 309 |
-
$id_region = $this->getRegion($this->_topcode,$this->_frompcode);
|
| 310 |
-
if($id_region == true){
|
| 311 |
-
// PRECIO REGIONAL PARA PROVINCIAS DE LA MISMA REGION
|
| 312 |
-
$this->_servicio='REGIONAL';
|
| 313 |
-
} else {
|
| 314 |
-
// PRECIO NACIONAL PARA TODA ESPA�A
|
| 315 |
-
$this->_servicio='NACIONAL';
|
| 316 |
-
}
|
| 317 |
-
}
|
| 318 |
-
break;
|
| 319 |
-
}
|
| 320 |
-
}
|
| 321 |
-
|
| 322 |
-
public function getCode($type, $code='') {
|
| 323 |
-
$codes = array(
|
| 324 |
-
'method'=>array(
|
| 325 |
-
'NAXJOW' => Mage::helper('nacex')->__('Nacex: Solo Ida'),
|
| 326 |
-
'NAXGAB' => Mage::helper('nacex')->__('Nacex: Ida y Vuelta')
|
| 327 |
-
),
|
| 328 |
-
);
|
| 329 |
-
|
| 330 |
-
if (!isset($codes[$type])) {
|
| 331 |
-
return false;
|
| 332 |
-
} elseif (''===$code) {
|
| 333 |
-
return $codes[$type];
|
| 334 |
-
}
|
| 335 |
-
|
| 336 |
-
if (!isset($codes[$type][$code])) {
|
| 337 |
-
return false;
|
| 338 |
-
} else {
|
| 339 |
-
return $codes[$type][$code];
|
| 340 |
-
}
|
| 341 |
-
}
|
| 342 |
-
|
| 343 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Nacex/Shipping/Model/Methods.php
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
class Nacex_Shipping_Model_Methods {
|
| 3 |
-
public function toOptionArray() {
|
| 4 |
-
return array(
|
| 5 |
-
array('value'=>'NAXJOW', 'label'=>Mage::helper('nacex')->__('Nacex: Solo Ida')),
|
| 6 |
-
array('value'=>'NAXGAB', 'label'=>Mage::helper('nacex')->__('Nacex: Ida y Vuelta')),
|
| 7 |
-
);
|
| 8 |
-
}
|
| 9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Nacex/Shipping/Model/Standard/Data.php
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class Nacex_Shipping_Model_Standard_Data {
|
| 3 |
+
|
| 4 |
+
public function getRegion($topcode,$compare=null){
|
| 5 |
+
$region = null;
|
| 6 |
+
$ind=substr($topcode,0,2);
|
| 7 |
+
foreach($this->getRegions() as $id => $val){
|
| 8 |
+
if(in_array($ind,$val)){
|
| 9 |
+
$region = $id;
|
| 10 |
+
continue;
|
| 11 |
+
}
|
| 12 |
+
}
|
| 13 |
+
if($compare !== null){
|
| 14 |
+
$compare=$this->getRegion($compare);
|
| 15 |
+
if($region === $compare)
|
| 16 |
+
return true;
|
| 17 |
+
else
|
| 18 |
+
return false;
|
| 19 |
+
}
|
| 20 |
+
return $region;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
/*
|
| 24 |
+
* Setea el tipo de servicio segun la ubicacion del cliente
|
| 25 |
+
* con respecto a la tienda
|
| 26 |
+
*/
|
| 27 |
+
public function setServicio($_frompcode,$_topcode){
|
| 28 |
+
$code_store = substr($_frompcode,0,2);
|
| 29 |
+
$servicio = '';
|
| 30 |
+
switch($code_store){
|
| 31 |
+
// PARA LA TIENDA EN BALEARES
|
| 32 |
+
case '07':
|
| 33 |
+
if($this->getRegion($code_store,$_topcode)){
|
| 34 |
+
// PRECIO INTRAISLAS
|
| 35 |
+
return 'INTRAISLAS';
|
| 36 |
+
} else {
|
| 37 |
+
// PRECIO NACIONAL PARA TODA ESPA�A
|
| 38 |
+
return 'NACIONAL_BALEARES';
|
| 39 |
+
}
|
| 40 |
+
break;
|
| 41 |
+
// PARA LA TIENDA EN EL RESTO DE ESPA�A
|
| 42 |
+
default:
|
| 43 |
+
if($_frompcode == $_topcode){
|
| 44 |
+
// PRECIO PROVINCIAL
|
| 45 |
+
return 'PROVINCIAL';
|
| 46 |
+
} else {
|
| 47 |
+
$id_region = $this->getRegion($_topcode,$_frompcode);
|
| 48 |
+
if($id_region == true){
|
| 49 |
+
// PRECIO REGIONAL PARA PROVINCIAS DE LA MISMA REGION
|
| 50 |
+
return 'REGIONAL';
|
| 51 |
+
} else {
|
| 52 |
+
// PRECIO NACIONAL PARA TODA ESPA�A
|
| 53 |
+
return 'NACIONAL';
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
break;
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
public function getRegions(){
|
| 61 |
+
return array(
|
| 62 |
+
'ANDALUCIA' =>array('04','11','14','18','21','23','29','41'),
|
| 63 |
+
'ARAGON' =>array('22','44','50'),
|
| 64 |
+
'BALEARES' =>array('07'),
|
| 65 |
+
'CANARIAS' =>array('35','38'),
|
| 66 |
+
'CANTABRIA' =>array('39'),
|
| 67 |
+
'CASTILLA Y LEON' =>array('05','09','24','34','37','40','42','47','49'),
|
| 68 |
+
'CASTILLA LA MANCA' =>array('02','13','16','19','45'),
|
| 69 |
+
'CATALU�A' =>array('08','17','25','43'),
|
| 70 |
+
'CEUTA' =>array('51'),
|
| 71 |
+
'COMUNIDAD DE MADRID' =>array('28'),
|
| 72 |
+
'COMUNIDAD FORAL DE NAVARRA' =>array('31'),
|
| 73 |
+
'COMUNIDAD VALENCIANA' =>array('03','12','46'),
|
| 74 |
+
'EUSKADI - PAIS VASCO' =>array('01','20','48'),
|
| 75 |
+
'EXTREMADURA' =>array('06','10'),
|
| 76 |
+
'GALICIA' =>array('15','27','32','36'),
|
| 77 |
+
'LA RIOJA' =>array('26'),
|
| 78 |
+
'MELILLA' =>array('52'),
|
| 79 |
+
'PRINCIPADO DE ASTURIAS' =>array('33'),
|
| 80 |
+
'MURCIA' =>array('30')
|
| 81 |
+
);
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
public function getPrecio($params){
|
| 85 |
+
$code = (isset($params['code'])) ? $params['code'] : '';
|
| 86 |
+
$servicio = $params['servicio'];
|
| 87 |
+
$sweight = $params['sweight'];
|
| 88 |
+
if(!$servicio || !$sweight)
|
| 89 |
+
return false;
|
| 90 |
+
$params = array('price'=>0);
|
| 91 |
+
switch($servicio){
|
| 92 |
+
case 'PROVINCIAL':
|
| 93 |
+
$params['shipping_method'] = 'PACK';
|
| 94 |
+
if($params['sweight'] <= '2000') {
|
| 95 |
+
$params['shipping_method'] = 'BAG';
|
| 96 |
+
$params['price'] = 6.01;
|
| 97 |
+
} elseif(($sweight > '2000') && ($sweight <='5000')){
|
| 98 |
+
$params['price'] = 6.74;
|
| 99 |
+
} elseif(($sweight > '5000') && ($sweight <='10000')){
|
| 100 |
+
$params['price'] = 8.49;
|
| 101 |
+
} else {
|
| 102 |
+
$params['price'] = 8.49;
|
| 103 |
+
$peso=$sweight - 10000;
|
| 104 |
+
$params['price'] += (ceil($peso / 5000)) * 1.91;
|
| 105 |
+
}
|
| 106 |
+
break;
|
| 107 |
+
case 'REGIONAL':
|
| 108 |
+
$params['shipping_method'] = 'PACK';
|
| 109 |
+
if($sweight <= '2000') {
|
| 110 |
+
$params['shipping_method'] = 'BAG';
|
| 111 |
+
$params['price'] = 7.11;
|
| 112 |
+
} elseif(($sweight > '2000') && ($sweight <='5000')){
|
| 113 |
+
$params['price'] = 18.88;
|
| 114 |
+
} elseif(($sweight > '5000') && ($sweight <='10000')){
|
| 115 |
+
$params['price'] = 25.84;
|
| 116 |
+
} else {
|
| 117 |
+
$params['price'] = 25.84;
|
| 118 |
+
$peso=$sweight - 10000;
|
| 119 |
+
$params['price'] += (ceil($peso / 5000)) * 3.62;
|
| 120 |
+
}
|
| 121 |
+
break;
|
| 122 |
+
case 'NACIONAL':
|
| 123 |
+
$params['shipping_method'] = 'PACK';
|
| 124 |
+
if($sweight <= '2000') {
|
| 125 |
+
$params['shipping_method'] = 'BAG';
|
| 126 |
+
$params['price'] = 7.58;
|
| 127 |
+
} elseif(($sweight > '2000') && ($sweight <='5000')){
|
| 128 |
+
$params['price'] = 9.57;
|
| 129 |
+
} elseif(($sweight > '5000') && ($sweight <='10000')){
|
| 130 |
+
$params['price'] = 13.54;
|
| 131 |
+
} else {
|
| 132 |
+
$params['price'] = 13.54;
|
| 133 |
+
$peso=$sweight - 10000;
|
| 134 |
+
$params['price'] += (ceil($peso / 5000)) * 3.96;
|
| 135 |
+
}
|
| 136 |
+
break;
|
| 137 |
+
case 'NACIONAL_BALEARES':
|
| 138 |
+
$params['shipping_method'] = 'PACK';
|
| 139 |
+
if($sweight <= '2000') {
|
| 140 |
+
$params['shipping_method'] = 'BAG';
|
| 141 |
+
$params['price'] = 10.56;
|
| 142 |
+
} elseif(($sweight > '2000') && ($sweight <='4000')){
|
| 143 |
+
$params['price'] = 16.48;
|
| 144 |
+
} else {
|
| 145 |
+
$params['price'] = 16.48;
|
| 146 |
+
$peso=$sweight - 4000;
|
| 147 |
+
$params['price'] += (ceil($peso / 2000)) * 4;
|
| 148 |
+
}
|
| 149 |
+
break;
|
| 150 |
+
case 'INTRAISLAS':
|
| 151 |
+
$params['shipping_method'] = 'PACK';
|
| 152 |
+
if($sweight <= '2000') {
|
| 153 |
+
$params['shipping_method'] = 'BAG';
|
| 154 |
+
$params['price'] = 6.18;
|
| 155 |
+
} elseif(($sweight <= '5000')){
|
| 156 |
+
$params['price'] = 6.95;
|
| 157 |
+
} elseif(($sweight <='10000')){
|
| 158 |
+
$params['price'] = 8.76;
|
| 159 |
+
} else {
|
| 160 |
+
$params['price'] = 8.76;
|
| 161 |
+
$peso=$sweight - 10000;
|
| 162 |
+
$params['price'] += (ceil($peso / 5000)) * 1.99;
|
| 163 |
+
}
|
| 164 |
+
break;
|
| 165 |
+
|
| 166 |
+
}
|
| 167 |
+
// Agrega el iva mas un Euro
|
| 168 |
+
$params['price'] = ($params['price'] * 1.16) + 1;
|
| 169 |
+
switch($code){
|
| 170 |
+
case 'naxgab':
|
| 171 |
+
// En caso de ida y vuelta duplica el valor
|
| 172 |
+
$params['price'] *= 2;
|
| 173 |
+
break;
|
| 174 |
+
}
|
| 175 |
+
return $params;
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
public function getProvincias(){
|
| 179 |
+
return array(
|
| 180 |
+
"01"=>"ALAVA",
|
| 181 |
+
"33"=>"ASTURIAS",
|
| 182 |
+
"05"=>"AVILA",
|
| 183 |
+
"25"=>"LLEIDA",
|
| 184 |
+
"44"=>"TERUEL",
|
| 185 |
+
}
|
| 186 |
+
}
|
app/code/community/Nacex/Shipping/Model/{Weightunits.php → Standard/Weightunits.php}
RENAMED
|
@@ -18,7 +18,7 @@
|
|
| 18 |
* @author
|
| 19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 20 |
*/
|
| 21 |
-
class
|
| 22 |
public function toOptionArray() {
|
| 23 |
return array(
|
| 24 |
array('value'=>1, 'label'=>Mage::helper('nacex')->__('Gramos')),
|
| 18 |
* @author
|
| 19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 20 |
*/
|
| 21 |
+
class Nacex_Shipping_Model_Standard_Weightunits {
|
| 22 |
public function toOptionArray() {
|
| 23 |
return array(
|
| 24 |
array('value'=>1, 'label'=>Mage::helper('nacex')->__('Gramos')),
|
app/code/community/Nacex/Shipping/etc/config.xml
CHANGED
|
@@ -40,27 +40,40 @@
|
|
| 40 |
<sales>
|
| 41 |
<shipping>
|
| 42 |
<carriers>
|
| 43 |
-
<
|
| 44 |
-
<class>
|
| 45 |
-
</
|
|
|
|
|
|
|
|
|
|
| 46 |
</carriers>
|
| 47 |
</shipping>
|
| 48 |
</sales>
|
| 49 |
</global>
|
| 50 |
<default>
|
| 51 |
<carriers>
|
| 52 |
-
<
|
| 53 |
<active>1</active>
|
| 54 |
-
<model>
|
| 55 |
-
<
|
| 56 |
-
<
|
| 57 |
<min_order_value>0</min_order_value>
|
| 58 |
<max_order_value>0</max_order_value>
|
| 59 |
<weight_units>1</weight_units>
|
| 60 |
<handling_fee>0</handling_fee>
|
| 61 |
-
<allowed_methods>NAXJOW,NAXGAB</allowed_methods>
|
| 62 |
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
| 63 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
</carriers>
|
| 65 |
</default>
|
| 66 |
</config>
|
| 40 |
<sales>
|
| 41 |
<shipping>
|
| 42 |
<carriers>
|
| 43 |
+
<naxjow>
|
| 44 |
+
<class>Nacex_Shipping_Model_Carrier_Naxjow</class>
|
| 45 |
+
</naxjow>
|
| 46 |
+
<naxgab>
|
| 47 |
+
<class>Nacex_Shipping_Model_Carrier_Naxgab</class>
|
| 48 |
+
</naxgab>
|
| 49 |
</carriers>
|
| 50 |
</shipping>
|
| 51 |
</sales>
|
| 52 |
</global>
|
| 53 |
<default>
|
| 54 |
<carriers>
|
| 55 |
+
<naxjow>
|
| 56 |
<active>1</active>
|
| 57 |
+
<model>nacex_shipping_model_carrier_naxjow</model>
|
| 58 |
+
<title>Nacex solo ida</title>
|
| 59 |
+
<msg></msg>
|
| 60 |
<min_order_value>0</min_order_value>
|
| 61 |
<max_order_value>0</max_order_value>
|
| 62 |
<weight_units>1</weight_units>
|
| 63 |
<handling_fee>0</handling_fee>
|
|
|
|
| 64 |
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
| 65 |
+
</naxjow>
|
| 66 |
+
<naxgab>
|
| 67 |
+
<active>1</active>
|
| 68 |
+
<model>nacex_shipping_model_carrier_naxgab</model>
|
| 69 |
+
<title>Nacex ida y vuelta</title>
|
| 70 |
+
<msg></msg>
|
| 71 |
+
<min_order_value>0</min_order_value>
|
| 72 |
+
<max_order_value>0</max_order_value>
|
| 73 |
+
<weight_units>1</weight_units>
|
| 74 |
+
<handling_fee>0</handling_fee>
|
| 75 |
+
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
| 76 |
+
</naxgab>
|
| 77 |
</carriers>
|
| 78 |
</default>
|
| 79 |
</config>
|
app/code/community/Nacex/Shipping/etc/system.xml
CHANGED
|
@@ -3,8 +3,8 @@
|
|
| 3 |
<sections>
|
| 4 |
<carriers>
|
| 5 |
<groups>
|
| 6 |
-
<
|
| 7 |
-
<label>Nacex</label>
|
| 8 |
<frontend_type>text</frontend_type>
|
| 9 |
<sort_order>1</sort_order>
|
| 10 |
<show_in_default>1</show_in_default>
|
|
@@ -20,10 +20,18 @@
|
|
| 20 |
<show_in_website>1</show_in_website>
|
| 21 |
<show_in_store>1</show_in_store>
|
| 22 |
</active>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
<title translate="label">
|
| 24 |
<label>Title</label>
|
| 25 |
<frontend_type>text</frontend_type>
|
| 26 |
-
<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>
|
|
@@ -31,7 +39,7 @@
|
|
| 31 |
<weight_units translate="label">
|
| 32 |
<label>Unidad de peso</label>
|
| 33 |
<frontend_type>select</frontend_type>
|
| 34 |
-
<source_model>nacex/
|
| 35 |
<sort_order>33</sort_order>
|
| 36 |
<show_in_default>1</show_in_default>
|
| 37 |
<show_in_website>1</show_in_website>
|
|
@@ -95,17 +103,110 @@
|
|
| 95 |
<show_in_website>1</show_in_website>
|
| 96 |
<show_in_store>1</show_in_store>
|
| 97 |
</specificerrmsg>
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
<show_in_default>1</show_in_default>
|
| 104 |
<show_in_website>1</show_in_website>
|
| 105 |
<show_in_store>1</show_in_store>
|
| 106 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
</fields>
|
| 108 |
-
</
|
| 109 |
</groups>
|
| 110 |
</carriers>
|
| 111 |
</sections>
|
| 3 |
<sections>
|
| 4 |
<carriers>
|
| 5 |
<groups>
|
| 6 |
+
<naxjow translate="label" module="shipping">
|
| 7 |
+
<label>Nacex: Solo ida</label>
|
| 8 |
<frontend_type>text</frontend_type>
|
| 9 |
<sort_order>1</sort_order>
|
| 10 |
<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 |
+
<msg translate="label">
|
| 24 |
+
<label>Message</label>
|
| 25 |
+
<frontend_type>text</frontend_type>
|
| 26 |
+
<sort_order>20</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 |
+
</msg>
|
| 31 |
<title translate="label">
|
| 32 |
<label>Title</label>
|
| 33 |
<frontend_type>text</frontend_type>
|
| 34 |
+
<sort_order>22</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>
|
| 39 |
<weight_units translate="label">
|
| 40 |
<label>Unidad de peso</label>
|
| 41 |
<frontend_type>select</frontend_type>
|
| 42 |
+
<source_model>nacex/standard_weightunits</source_model>
|
| 43 |
<sort_order>33</sort_order>
|
| 44 |
<show_in_default>1</show_in_default>
|
| 45 |
<show_in_website>1</show_in_website>
|
| 103 |
<show_in_website>1</show_in_website>
|
| 104 |
<show_in_store>1</show_in_store>
|
| 105 |
</specificerrmsg>
|
| 106 |
+
</fields>
|
| 107 |
+
</naxjow>
|
| 108 |
+
<naxgab translate="label" module="shipping">
|
| 109 |
+
<label>Nacex: Ida y vuelta</label>
|
| 110 |
+
<frontend_type>text</frontend_type>
|
| 111 |
+
<sort_order>1</sort_order>
|
| 112 |
+
<show_in_default>1</show_in_default>
|
| 113 |
+
<show_in_website>1</show_in_website>
|
| 114 |
+
<show_in_store>1</show_in_store>
|
| 115 |
+
<fields>
|
| 116 |
+
<active translate="label">
|
| 117 |
+
<label>Enabled</label>
|
| 118 |
+
<frontend_type>select</frontend_type>
|
| 119 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 120 |
+
<sort_order>10</sort_order>
|
| 121 |
+
<show_in_default>1</show_in_default>
|
| 122 |
+
<show_in_website>1</show_in_website>
|
| 123 |
+
<show_in_store>1</show_in_store>
|
| 124 |
+
</active>
|
| 125 |
+
<msg translate="label">
|
| 126 |
+
<label>Message</label>
|
| 127 |
+
<frontend_type>text</frontend_type>
|
| 128 |
+
<sort_order>20</sort_order>
|
| 129 |
<show_in_default>1</show_in_default>
|
| 130 |
<show_in_website>1</show_in_website>
|
| 131 |
<show_in_store>1</show_in_store>
|
| 132 |
+
</msg>
|
| 133 |
+
<title translate="label">
|
| 134 |
+
<label>Title</label>
|
| 135 |
+
<frontend_type>text</frontend_type>
|
| 136 |
+
<sort_order>22</sort_order>
|
| 137 |
+
<show_in_default>1</show_in_default>
|
| 138 |
+
<show_in_website>1</show_in_website>
|
| 139 |
+
<show_in_store>1</show_in_store>
|
| 140 |
+
</title>
|
| 141 |
+
<weight_units translate="label">
|
| 142 |
+
<label>Unidad de peso</label>
|
| 143 |
+
<frontend_type>select</frontend_type>
|
| 144 |
+
<source_model>nacex/standard_weightunits</source_model>
|
| 145 |
+
<sort_order>33</sort_order>
|
| 146 |
+
<show_in_default>1</show_in_default>
|
| 147 |
+
<show_in_website>1</show_in_website>
|
| 148 |
+
<show_in_store>1</show_in_store>
|
| 149 |
+
</weight_units>
|
| 150 |
+
<handling_type translate="label">
|
| 151 |
+
<label>Calculate Handling Fee</label>
|
| 152 |
+
<frontend_type>select</frontend_type>
|
| 153 |
+
<source_model>shipping/source_handlingType</source_model>
|
| 154 |
+
<sort_order>40</sort_order>
|
| 155 |
+
<show_in_default>1</show_in_default>
|
| 156 |
+
<show_in_website>1</show_in_website>
|
| 157 |
+
<show_in_store>0</show_in_store>
|
| 158 |
+
</handling_type>
|
| 159 |
+
<handling_fee translate="label">
|
| 160 |
+
<label>Handling Fee</label>
|
| 161 |
+
<frontend_type>text</frontend_type>
|
| 162 |
+
<sort_order>41</sort_order>
|
| 163 |
+
<show_in_default>1</show_in_default>
|
| 164 |
+
<show_in_website>1</show_in_website>
|
| 165 |
+
<show_in_store>1</show_in_store>
|
| 166 |
+
</handling_fee>
|
| 167 |
+
<max_order_value translate="label">
|
| 168 |
+
<label>Maximum Order Value</label>
|
| 169 |
+
<frontend_type>text</frontend_type>
|
| 170 |
+
<sort_order>50</sort_order>
|
| 171 |
+
<show_in_default>1</show_in_default>
|
| 172 |
+
<show_in_website>1</show_in_website>
|
| 173 |
+
<show_in_store>1</show_in_store>
|
| 174 |
+
</max_order_value>
|
| 175 |
+
<min_order_value translate="label">
|
| 176 |
+
<label>Minimum Order Value</label>
|
| 177 |
+
<frontend_type>text</frontend_type>
|
| 178 |
+
<sort_order>60</sort_order>
|
| 179 |
+
<show_in_default>1</show_in_default>
|
| 180 |
+
<show_in_website>1</show_in_website>
|
| 181 |
+
<show_in_store>1</show_in_store>
|
| 182 |
+
</min_order_value>
|
| 183 |
+
<sort_order translate="label">
|
| 184 |
+
<label>Sort order</label>
|
| 185 |
+
<frontend_type>text</frontend_type>
|
| 186 |
+
<sort_order>80</sort_order>
|
| 187 |
+
<show_in_default>1</show_in_default>
|
| 188 |
+
<show_in_website>1</show_in_website>
|
| 189 |
+
<show_in_store>1</show_in_store>
|
| 190 |
+
</sort_order>
|
| 191 |
+
<showmethod translate="label">
|
| 192 |
+
<label>Show method if not applicable</label>
|
| 193 |
+
<frontend_type>select</frontend_type>
|
| 194 |
+
<sort_order>90</sort_order>
|
| 195 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 196 |
+
<show_in_default>1</show_in_default>
|
| 197 |
+
<show_in_website>1</show_in_website>
|
| 198 |
+
<show_in_store>1</show_in_store>
|
| 199 |
+
</showmethod>
|
| 200 |
+
<specificerrmsg translate="label">
|
| 201 |
+
<label>Displayed Error Message</label>
|
| 202 |
+
<frontend_type>textarea</frontend_type>
|
| 203 |
+
<sort_order>91</sort_order>
|
| 204 |
+
<show_in_default>1</show_in_default>
|
| 205 |
+
<show_in_website>1</show_in_website>
|
| 206 |
+
<show_in_store>1</show_in_store>
|
| 207 |
+
</specificerrmsg>
|
| 208 |
</fields>
|
| 209 |
+
</naxgab>
|
| 210 |
</groups>
|
| 211 |
</carriers>
|
| 212 |
</sections>
|
app/code/community/Nacex/Shipping/sql/shipping_setup/mysql4-upgrade-1.0.8.php
ADDED
|
@@ -0,0 +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 |
+
$installer = $this;
|
| 22 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
| 23 |
+
|
| 24 |
+
$installer->startSetup();
|
| 25 |
+
|
| 26 |
+
$installer->run("DELETE FROM {$this->getTable('core_config_data')} WHERE path LIKE 'carriers/spainpost/%");
|
| 27 |
+
|
| 28 |
+
$installer->endSetup();
|
| 29 |
+
?>
|
package.xml
CHANGED
|
@@ -1,21 +1,30 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Shipping_Nacex</name>
|
| 4 |
-
<version>1.0.
|
| 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>*
|
| 12 |
|
| 13 |
<b>CHANGES:</b>
|
| 14 |
-
->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
<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>
|
| 16 |
-
<date>2008-12-
|
| 17 |
-
<time>
|
| 18 |
-
<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="
|
| 19 |
<compatible/>
|
| 20 |
<dependencies/>
|
| 21 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Shipping_Nacex</name>
|
| 4 |
+
<version>1.0.8</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>* Separa los metodos de envio para poder ingresar un mensaje por cada uno de ellos
|
| 12 |
|
| 13 |
<b>CHANGES:</b>
|
| 14 |
+
->A app/code/community/Nacex/Shipping/Model/Carrier/Naxgab.php
|
| 15 |
+
->A app/code/community/Nacex/Shipping/Model/Carrier/Naxjow.php
|
| 16 |
+
->A app/code/community/Nacex/Shipping/Model/Standard/Data.php
|
| 17 |
+
->A app/code/community/Nacex/Shipping/Model/Standard/Weightunits.php
|
| 18 |
+
->A app/code/community/Nacex/Shipping/sql/shipping_setup/mysql4-upgrade-1.0.8.php
|
| 19 |
+
->D app/code/community/Nacex/Shipping/Model/Weightunits.php
|
| 20 |
+
->D app/code/community/Nacex/Shipping/Model/Methods.php
|
| 21 |
+
->D app/code/community/Nacex/Shipping/Model/Carrier/Spainpost.php
|
| 22 |
+
->U app/code/community/Nacex/Shipping/etc/system.xml
|
| 23 |
+
->U app/code/community/Nacex/Shipping/etc/config.xml</notes>
|
| 24 |
<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>
|
| 25 |
+
<date>2008-12-17</date>
|
| 26 |
+
<time>15:33:17</time>
|
| 27 |
+
<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="90139df823a59b07d965a1b343605b63"/><file name="system.xml" hash="aa0681a29a20e81e7a791f469b1b3510"/></dir><dir name="Helper"><file name="Data.php" hash="8b06d6514b9924564f9078dd15cedc00"/></dir><dir name="Model"><dir name="Carrier"><file name="Naxgab.php" hash="6453eda945279aef44dc2ce120e64d1c"/><file name="Naxjow.php" hash="f9cfd6c8439ba411bb8191481ee4f991"/></dir><dir name="Standard"><file name="Data.php" hash="8bd42f98a950fd104e9d24bce8fdef22"/><file name="Weightunits.php" hash="3222717edd1948d4a793f7136d5f1868"/></dir></dir><dir name="sql"><dir name="shipping_setup"><file name="mysql4-install-0.1.0.php" hash="d614fdc964125e1ff642933cc8014583"/><file name="mysql4-upgrade-1.0.8.php" hash="65271f8e9876ce68b917fc20dbb71abd"/></dir></dir></dir></dir></target></contents>
|
| 28 |
<compatible/>
|
| 29 |
<dependencies/>
|
| 30 |
</package>
|
