Version Notes
Zeleris ecommerce (sólo clientes Zeleris).
Download this release
Release Info
Developer | zeleris |
Extension | ZelerisEcommerce |
Version | 2.0.0 |
Comparing to | |
See all releases |
Version 2.0.0
- app/code/local/ZELERIS/ZELERISShipping/Adminhtml/Block/Sales/Order/Shipment/View.php +67 -0
- app/code/local/ZELERIS/ZELERISShipping/Function/FlatRate/Data.php +46 -0
- app/code/local/ZELERIS/ZELERISShipping/Function/TableRate/Data.php +121 -0
- app/code/local/ZELERIS/ZELERISShipping/Function/etc/config.xml +19 -0
- app/code/local/ZELERIS/ZELERISShipping/Model/ZELERIS/Shipment.php +279 -0
- app/code/local/ZELERIS/ZELERISShipping/Model/ZELERIS/Source/Method.php +34 -0
- app/code/local/ZELERIS/ZELERISShipping/Model/ZELERIS/Source/Modo.php +16 -0
- app/code/local/ZELERIS/ZELERISShipping/Model/ZELERIS/Source/servicios.xml +8 -0
- app/code/local/ZELERIS/ZELERISShipping/Model/ZELERIS/ZELERISShipping.php +315 -0
- app/code/local/ZELERIS/ZELERISShipping/etc/config.xml +86 -0
- app/code/local/ZELERIS/ZELERISShipping/etc/system.xml +203 -0
- app/design/adminhtml/default/default/layout/zeleris_sales.xml +12 -0
- app/design/adminhtml/default/default/template/zeleris/sales/order/shipment/create/items.phtml +163 -0
- app/design/frontend/base/default/layout/zeleris_puntosentrega.xml +25 -0
- app/design/frontend/base/default/template/zeleris/puntosentrega/checkout/onepage/shipping.phtml +204 -0
- app/design/frontend/base/default/template/zeleris/puntosentrega/checkout/onepage/shipping_method.phtml +161 -0
- app/design/frontend/base/default/template/zeleris/puntosentrega/checkout/onepage/shipping_method/available.phtml +144 -0
- app/design/frontend/base/default/template/zeleris/puntosentrega/puntosentrega.php +66 -0
- app/etc/modules/ZELERIS_ZELERISShipping.xml +13 -0
- package.xml +27 -0
app/code/local/ZELERIS/ZELERISShipping/Adminhtml/Block/Sales/Order/Shipment/View.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class ZELERIS_ZELERISShipping_Adminhtml_Block_Sales_Order_Shipment_View extends Mage_Adminhtml_Block_Sales_Order_Shipment_View
|
3 |
+
/***********************************************************************************************************************************************************/
|
4 |
+
/******************************************************************* Versi�n 2.0.0 de marzo de 2013 ********************************************************/
|
5 |
+
/***********************************************************************************************************************************************************/
|
6 |
+
{
|
7 |
+
public function __construct() {
|
8 |
+
try {
|
9 |
+
parent::__construct();
|
10 |
+
$direccionUrl = Mage::helper('core/url')->getCurrentUrl();
|
11 |
+
$resant = split("/",$direccionUrl);
|
12 |
+
$limite = count($resant);
|
13 |
+
for($elemento=0;$elemento<$limite;$elemento++){
|
14 |
+
if($resant[$elemento] == 'etiquetazeleris'){
|
15 |
+
$this->obtenerEtiqueta();
|
16 |
+
}
|
17 |
+
}
|
18 |
+
if ($this->getShipment()->getId()) {
|
19 |
+
$this->_addButton('labelZELERIS', array('label'=>Mage::helper('sales')->__('Etiqueta Zeleris'),'onclick'=>'window.open(\''.$this->obtenerUrl().'\')'));
|
20 |
+
}
|
21 |
+
} catch (Exception $e) {
|
22 |
+
Mage::getSingleton('core/session')->addError('ERROR: '.$e->getMessage());
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
|
27 |
+
public function obtenerUrl() {
|
28 |
+
try {
|
29 |
+
$direccionUrl='';
|
30 |
+
foreach ($this->getShipment()->getAllTracks() as $expedicion ) {
|
31 |
+
if ($expedicion->getCarrierCode()=='ZELERISShipping') {
|
32 |
+
$direccionUrl = Mage::helper('core/url')->getCurrentUrl()."etiquetazeleris/";
|
33 |
+
}
|
34 |
+
}
|
35 |
+
return $direccionUrl;
|
36 |
+
} catch (Exception $e) {
|
37 |
+
Mage::getSingleton('core/session')->addError('ERROR: '.$e->getMessage());
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
|
42 |
+
public function obtenerEtiqueta(){
|
43 |
+
try {
|
44 |
+
$envio = array();
|
45 |
+
$envio["uidCliente"]=Mage::getStoreConfig('carriers/ZELERISShipping/GUID', $this->getStoreId());
|
46 |
+
$envio["URL"]= Mage::getStoreConfig('carriers/ZELERISShipping/gateway_url', $this->getStoreId());
|
47 |
+
$envio["numSeguimiento"]="";
|
48 |
+
|
49 |
+
foreach ($this->getShipment()->getAllTracks() as $expedicion ) { //***** Nos quedamos con el primer n�mero de tracking de Zeleris. Un env�o puede tener varios n�meros de tracking pero s�lo uno nuestro. El resto, de existir, se consultar�n manualmente si procede *****//
|
50 |
+
if ($expedicion->getCarrierCode()=='ZELERISShipping') {
|
51 |
+
$envio["numSeguimiento"]= $expedicion->getTrackNumber();
|
52 |
+
break; //***** Una vez encontrado el primero, ya no seguimos buscando. *****//
|
53 |
+
}
|
54 |
+
}
|
55 |
+
$baseurl=substr($envio["URL"] , 0, strlen($envio["URL"])-strlen(basename($envio["URL"])));
|
56 |
+
$url=$baseurl."Etiqueta.aspx?uid=".$envio["uidCliente"]."&nseg=".$envio["numSeguimiento"];
|
57 |
+
echo "<SCRIPT>window.location='$url';</SCRIPT>";
|
58 |
+
} catch (Exception $e) {
|
59 |
+
Mage::getSingleton('core/session')->addError('ERROR: '.$e->getMessage());
|
60 |
+
}
|
61 |
+
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
|
67 |
+
|
app/code/local/ZELERIS/ZELERISShipping/Function/FlatRate/Data.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class ZELERIS_ZELERISShipping_Function_FlatRate_Data extends Mage_Shipping_Model_Carrier_Abstract
|
3 |
+
/***********************************************************************************************************************************************************/
|
4 |
+
/******************************************************************* Versi�n 2.0.0 de marzo de 2013 ********************************************************/
|
5 |
+
/***********************************************************************************************************************************************************/
|
6 |
+
{
|
7 |
+
protected $_code = 'flatrate';
|
8 |
+
protected $_isFixed = true;
|
9 |
+
|
10 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
11 |
+
{
|
12 |
+
$freeBoxes = 0;
|
13 |
+
if ($request->getAllItems()) {
|
14 |
+
foreach ($request->getAllItems() as $item) {
|
15 |
+
if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
|
16 |
+
continue;
|
17 |
+
}
|
18 |
+
if ($item->getHasChildren() && $item->isShipSeparately()) {
|
19 |
+
foreach ($item->getChildren() as $child) {
|
20 |
+
if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
|
21 |
+
$freeBoxes += $item->getQty() * $child->getQty();
|
22 |
+
}
|
23 |
+
}
|
24 |
+
} elseif ($item->getFreeShipping()) {
|
25 |
+
$freeBoxes += $item->getQty();
|
26 |
+
}
|
27 |
+
}
|
28 |
+
}
|
29 |
+
$this->setFreeBoxes($freeBoxes);
|
30 |
+
$result = Mage::getModel('shipping/rate_result');
|
31 |
+
if ($this->getConfigData('type') == 'O') { //***** Por pedido *****
|
32 |
+
$shippingPrice = $this->getConfigData('price');
|
33 |
+
} elseif ($this->getConfigData('type') == 'I') { //***** Por unidad *****
|
34 |
+
$shippingPrice = ($request->getPackageQty() * $this->getConfigData('price')) - ($this->getFreeBoxes() * $this->getConfigData('price'));
|
35 |
+
} else { //***** No podemos determinar la forma de calcular el precio *****
|
36 |
+
$shippingPrice = false;
|
37 |
+
}
|
38 |
+
$shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice);
|
39 |
+
if ($shippingPrice !== false) {
|
40 |
+
if ($request->getFreeShipping() === true || $request->getPackageQty() == $this->getFreeBoxes()) {
|
41 |
+
$shippingPrice = '0.00';
|
42 |
+
}
|
43 |
+
}
|
44 |
+
return $shippingPrice;
|
45 |
+
}
|
46 |
+
}
|
app/code/local/ZELERIS/ZELERISShipping/Function/TableRate/Data.php
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class ZELERIS_ZELERISShipping_Function_TableRate_Data extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface
|
3 |
+
/***********************************************************************************************************************************************************/
|
4 |
+
/******************************************************************* Versi�n 2.0.0 de marzo de 2013 ********************************************************/
|
5 |
+
/***********************************************************************************************************************************************************/
|
6 |
+
{
|
7 |
+
protected $_code = 'tablerate';
|
8 |
+
protected $_isFixed = true;
|
9 |
+
protected $_default_condition_name = 'package_weight';
|
10 |
+
protected $_conditionNames = array();
|
11 |
+
|
12 |
+
public function __construct() {
|
13 |
+
parent::__construct();
|
14 |
+
foreach ($this->getCode('condition_name') as $k=>$v) {
|
15 |
+
$this->_conditionNames[] = $k;
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
|
20 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
|
21 |
+
//***** Excluimos los precios de los productos virtuales a partir del valor del paquete, si as� se ha indicado *****//
|
22 |
+
if (!$this->getConfigFlag('include_virtual_price') && $request->getAllItems()) {
|
23 |
+
foreach ($request->getAllItems() as $item) {
|
24 |
+
if ($item->getParentItem()) {
|
25 |
+
continue;
|
26 |
+
}
|
27 |
+
if ($item->getHasChildren() && $item->isShipSeparately()) {
|
28 |
+
foreach ($item->getChildren() as $child) {
|
29 |
+
if ($child->getProduct()->isVirtual()) {
|
30 |
+
$request->setPackageValue($request->getPackageValue() - $child->getBaseRowTotal());
|
31 |
+
}
|
32 |
+
}
|
33 |
+
} elseif ($item->getProduct()->isVirtual()) {
|
34 |
+
$request->setPackageValue($request->getPackageValue() - $item->getBaseRowTotal());
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
//***** Env�o gratuito a partir de un determinado n�mero de unidades *****//
|
40 |
+
$freeQty = 0;
|
41 |
+
if ($request->getAllItems()) {
|
42 |
+
foreach ($request->getAllItems() as $item) {
|
43 |
+
if ($item->getProduct()->isVirtual() || $item->getParentItem()) {
|
44 |
+
continue;
|
45 |
+
}
|
46 |
+
|
47 |
+
if ($item->getHasChildren() && $item->isShipSeparately()) {
|
48 |
+
foreach ($item->getChildren() as $child) {
|
49 |
+
if ($child->getFreeShipping() && !$child->getProduct()->isVirtual()) {
|
50 |
+
$freeQty += $item->getQty() * ($child->getQty() - (is_numeric($child->getFreeShipping()) ? $child->getFreeShipping() : 0));
|
51 |
+
}
|
52 |
+
}
|
53 |
+
} elseif ($item->getFreeShipping()) {
|
54 |
+
$freeQty += ($item->getQty() - (is_numeric($item->getFreeShipping()) ? $item->getFreeShipping() : 0));
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
if (!$request->getConditionName()) {
|
60 |
+
$request->setConditionName($this->getConfigData('condition_name') ? $this->getConfigData('condition_name') : $this->_default_condition_name);
|
61 |
+
}
|
62 |
+
|
63 |
+
//***** Env�o gratuito por peso y n�mero de unidades *****//
|
64 |
+
$oldWeight = $request->getPackageWeight();
|
65 |
+
$oldQty = $request->getPackageQty();
|
66 |
+
|
67 |
+
$request->setPackageWeight($request->getFreeMethodWeight());
|
68 |
+
$request->setPackageQty($oldQty - $freeQty);
|
69 |
+
|
70 |
+
$result = Mage::getModel('shipping/rate_result');
|
71 |
+
$rate = $this->getRate($request);
|
72 |
+
|
73 |
+
$request->setPackageWeight($oldWeight);
|
74 |
+
$request->setPackageQty($oldQty);
|
75 |
+
|
76 |
+
$shippingPrice=false;
|
77 |
+
if (!empty($rate) && $rate['price'] >= 0) {
|
78 |
+
if ($request->getFreeShipping() === true || ($request->getPackageQty() == $freeQty)) {
|
79 |
+
$shippingPrice = 0;
|
80 |
+
} else {
|
81 |
+
$shippingPrice = $this->getFinalPriceWithHandlingFee($rate['price']);
|
82 |
+
}
|
83 |
+
}
|
84 |
+
return $shippingPrice;
|
85 |
+
}
|
86 |
+
|
87 |
+
|
88 |
+
public function getRate(Mage_Shipping_Model_Rate_Request $request) {
|
89 |
+
return Mage::getResourceModel('shipping/carrier_tablerate')->getRate($request);
|
90 |
+
}
|
91 |
+
|
92 |
+
|
93 |
+
public function getCode($type, $code='') {
|
94 |
+
$codes = array(
|
95 |
+
'condition_name'=>array(
|
96 |
+
'package_weight' => Mage::helper('shipping')->__('Weight vs. Destination'),
|
97 |
+
'package_value' => Mage::helper('shipping')->__('Price vs. Destination'),
|
98 |
+
'package_qty' => Mage::helper('shipping')->__('# of Items vs. Destination'),),
|
99 |
+
|
100 |
+
'condition_name_short'=>array(
|
101 |
+
'package_weight' => Mage::helper('shipping')->__('Weight (and above)'),
|
102 |
+
'package_value' => Mage::helper('shipping')->__('Order Subtotal (and above)'),
|
103 |
+
'package_qty' => Mage::helper('shipping')->__('# of Items (and above)'),),);
|
104 |
+
|
105 |
+
if (!isset($codes[$type])) {
|
106 |
+
throw Mage::exception('Mage_Shipping', Mage::helper('shipping')->__('Invalid Table Rate code type: %s', $type));
|
107 |
+
}
|
108 |
+
if (''===$code) {
|
109 |
+
return $codes[$type];
|
110 |
+
}
|
111 |
+
if (!isset($codes[$type][$code])) {
|
112 |
+
throw Mage::exception('Mage_Shipping', Mage::helper('shipping')->__('Invalid Table Rate code for type %s: %s', $type, $code));
|
113 |
+
}
|
114 |
+
return $codes[$type][$code];
|
115 |
+
}
|
116 |
+
|
117 |
+
|
118 |
+
public function getAllowedMethods() {
|
119 |
+
return array('bestway'=>$this->getConfigData('name'));
|
120 |
+
}
|
121 |
+
}
|
app/code/local/ZELERIS/ZELERISShipping/Function/etc/config.xml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<ZELERIS_ZELERISShipping_Function>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</ZELERIS_ZELERISShipping_Function>
|
7 |
+
</modules>
|
8 |
+
|
9 |
+
<global>
|
10 |
+
<helpers>
|
11 |
+
<flatrate>
|
12 |
+
<class>ZELERIS_ZELERISShipping_Function_FlatRate</class>
|
13 |
+
</flatrate>
|
14 |
+
<tablerate>
|
15 |
+
<class>ZELERIS_ZELERISShipping_Function_TableRate</class>
|
16 |
+
</tablerate>
|
17 |
+
</helpers>
|
18 |
+
</global>
|
19 |
+
</config>
|
app/code/local/ZELERIS/ZELERISShipping/Model/ZELERIS/Shipment.php
ADDED
@@ -0,0 +1,279 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class ZELERIS_ZELERISShipping_Model_ZELERIS_Shipment extends Mage_Sales_Model_Order_Shipment
|
3 |
+
/***********************************************************************************************************************************************************/
|
4 |
+
/******************************************************************* Versi�n 2.0.0 de marzo de 2013 ********************************************************/
|
5 |
+
/***********************************************************************************************************************************************************/
|
6 |
+
{
|
7 |
+
protected function _beforeSave()
|
8 |
+
{
|
9 |
+
$canSave = parent::_beforeSave();
|
10 |
+
|
11 |
+
If (Mage::getStoreConfig('carriers/ZELERISShipping/active', $this->getStoreId()) == true) //***************** S�lo continuamos si el m�dulo de Zeleris est� activado. ******************
|
12 |
+
{
|
13 |
+
If ($this->getShipment()->getId() == 0) //***************** S�lo generamos la expedici�n si no existe previamente. ******************
|
14 |
+
{
|
15 |
+
$arrayMethod = explode("_", $this->getOrder()->getShippingMethod());
|
16 |
+
|
17 |
+
If ($arrayMethod[0] == "ZELERISShipping")
|
18 |
+
{
|
19 |
+
$err = null;
|
20 |
+
$envio = array();
|
21 |
+
$envio["uidCliente"] = Mage::getStoreConfig('carriers/ZELERISShipping/GUID', $this->getStoreId());
|
22 |
+
$envio["URL"] = Mage::getStoreConfig('carriers/ZELERISShipping/gateway_url', $this->getStoreId());
|
23 |
+
$envio["nombreProducto"] = substr(Mage::getStoreConfig('carriers/ZELERISShipping/productname', $this->getStoreId()), 0, 20);
|
24 |
+
|
25 |
+
$metodo = Mage::getModel('ZELERISShipping/ZELERIS_Source_Method')->getMethod($this->getOrder()->getShippingMethod());
|
26 |
+
$envio["servicio"] = substr($metodo["codigo"], 0, 3);
|
27 |
+
//No utilizado en la actualidad. ============> $envio["horario"] = $metodo["horario"];
|
28 |
+
|
29 |
+
$comentarios = $this->_comments;
|
30 |
+
|
31 |
+
if (count($comentarios) > 0)
|
32 |
+
{
|
33 |
+
foreach ($comentarios as $comentario)
|
34 |
+
{
|
35 |
+
break;
|
36 |
+
}
|
37 |
+
$no_generar_envio = substr($comentario->getComment(), 0, 1);
|
38 |
+
|
39 |
+
if (strlen($comentario->getComment()) > 1)
|
40 |
+
{
|
41 |
+
$comentario->setComment(substr($comentario->getComment(), 1));
|
42 |
+
}
|
43 |
+
else
|
44 |
+
{
|
45 |
+
$this->_comments = null;
|
46 |
+
}
|
47 |
+
}
|
48 |
+
else
|
49 |
+
{
|
50 |
+
$no_generar_envio = "0";
|
51 |
+
}
|
52 |
+
|
53 |
+
if ($no_generar_envio == "1")
|
54 |
+
{
|
55 |
+
$envio["modoTransporte"] = "1";
|
56 |
+
}
|
57 |
+
else
|
58 |
+
{
|
59 |
+
$envio["modoTransporte"] = "";
|
60 |
+
}
|
61 |
+
|
62 |
+
if (count($comentarios) > 0)
|
63 |
+
{
|
64 |
+
if (strlen($comentario->getComment()) > 1)
|
65 |
+
{
|
66 |
+
$this->getShipment()->setCommentText($comentario->getComment());
|
67 |
+
}
|
68 |
+
}
|
69 |
+
else
|
70 |
+
{
|
71 |
+
$this->_comments = null;
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
$pesoexpedicion = 0; //***************** Iteramos entre todos los productos de esta expedici�n de esta compra. ******************
|
76 |
+
$envio["detalle"] = "";
|
77 |
+
foreach ($this->getItemsCollection() as $item)
|
78 |
+
{
|
79 |
+
$pesounidad = floatval($item->getWeight());
|
80 |
+
$unidades = $item->getQty();
|
81 |
+
$pesoexpedicion += $pesounidad * $unidades;
|
82 |
+
|
83 |
+
for ($i = 1; $i <= $unidades; $i++)
|
84 |
+
{
|
85 |
+
$envio["detalle"] .= "<InfoBulto";
|
86 |
+
$envio["detalle"] .= " Referencia='". substr($this->limpia($item->getSku()), 0, 20);
|
87 |
+
$envio["detalle"] .= "' Bulto='1";
|
88 |
+
$envio["detalle"] .= "' Kilos='". number_format($pesounidad, 2, ',', '');
|
89 |
+
$envio["detalle"] .= "' Volumen= '0'";
|
90 |
+
$envio["detalle"] .= "/>";
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
$envio["bultos"] = 1;
|
95 |
+
$envio["RefC"] = $this->getOrder()->getIncrementId();//$envio["RefC"] = $this->getOrder()->getId();
|
96 |
+
|
97 |
+
$orderaddress = $this->getShippingAddress();
|
98 |
+
$envio["nombreDst"] = substr($this->limpia($orderaddress->getName()), 0, 40);
|
99 |
+
$envio["direccionDst"] = substr($this->limpia($orderaddress->getStreetFull()), 0, 80);
|
100 |
+
$envio["poblacionDst"] = substr($this->limpia($orderaddress->getCity()), 0, 40);
|
101 |
+
$envio["telefonoDst"] = substr($this->limpia($orderaddress->getTelephone()), 0, 15);
|
102 |
+
$envio["faxDst"] = substr($this->limpia($orderaddress->getFax()), 0, 15);
|
103 |
+
|
104 |
+
$envio["emailDst"] = substr($this->limpia($orderaddress->getEmail()), 0, 60);
|
105 |
+
if ($envio["emailDst"] == "") //**** Si el email obtenido de la direcci�n de env�o est� vac�o, lo buscamos entonces en la direcci�n de facturaci�n. Esto ocurre cuando direcci�n de env�o y de facturaci�n son diferentes.
|
106 |
+
{
|
107 |
+
$billingaddress = $this->getBillingAddress();
|
108 |
+
$envio["emailDst"] = substr($this->limpia($billingaddress->getEmail()), 0, 60);
|
109 |
+
}
|
110 |
+
|
111 |
+
$envio["codPaisDst"] = $orderaddress->getCountry();
|
112 |
+
$envio["cpDst"] = substr($this->limpia($orderaddress->getPostcode()), 0, 7);
|
113 |
+
|
114 |
+
//$envio["provinciaDst"] = $orderaddress->getRegion();
|
115 |
+
//$envio["nombreOrg"] = Mage::getStoreConfig('general/store_information/name');
|
116 |
+
//$envio["direccionOrg"] = Mage::getStoreConfig('general/store_information/address');
|
117 |
+
//$envio["poblacionOrg"] = Mage::getStoreConfig('shipping/origin/city');
|
118 |
+
//$envio["codPaisOrg"] = Mage::getStoreConfig('shipping/origin/country_id');
|
119 |
+
//$envio["cpOrg"] = Mage::getStoreConfig('shipping/origin/postcode');
|
120 |
+
|
121 |
+
if ($this->limpia($envio["servicio"]) == 50)
|
122 |
+
{
|
123 |
+
$dato = $this->limpia($orderaddress->getCompany());
|
124 |
+
$posicioninicial = strpos($dato, '#') + 1;
|
125 |
+
$posicionfinal = strpos($dato, '#',$posicioninicial + 1);
|
126 |
+
$envio["codPuntoEntrega"] = substr($dato, $posicioninicial, $posicionfinal - $posicioninicial);
|
127 |
+
|
128 |
+
$envio["contactoDst"] = $envio["nombreDst"];
|
129 |
+
$envio["nombreDst"] = substr($dato, $posicionfinal + 1, 40);
|
130 |
+
}
|
131 |
+
else
|
132 |
+
{
|
133 |
+
$envio["codPuntoEntrega"] = "";
|
134 |
+
$envio["contactoDst"] = "";
|
135 |
+
}
|
136 |
+
|
137 |
+
if (floatval($pesoexpedicion) <= 0)
|
138 |
+
{
|
139 |
+
$pesoexpedicion = 1;
|
140 |
+
}
|
141 |
+
|
142 |
+
if ($this->limpia($envio["codPaisDst"]) == "ES")
|
143 |
+
{
|
144 |
+
$envio["peso"] = number_format(ceil(floatval($pesoexpedicion)), 0, ',', ''); //Para envios nacionales, redondeamos hacia arriba y descartamos todos los decimales.
|
145 |
+
}
|
146 |
+
else
|
147 |
+
{
|
148 |
+
$envio["peso"] = number_format(floatval($pesoexpedicion), 2, ',', ''); //Para envios internacionales, redondeamos y nos quedamos con 2 decimales.
|
149 |
+
}
|
150 |
+
|
151 |
+
$envio["importeReembolso"] = 0; //***** Por defecto, establecemos a cero el importe del reembolso.
|
152 |
+
$habilitar_pago_contrareembolso = Mage::getStoreConfig('carriers/ZELERISShipping/habilitar_pago_contrareembolso', $this->getStoreId());
|
153 |
+
if ($habilitar_pago_contrareembolso) //***** Si la forma de pago contra-reembolso est� habilitada en el combo de configuraci�n de este m�dulo de transportes de Zeleris para Magento. *****
|
154 |
+
{
|
155 |
+
$forma_pago_compra = $this->getOrder()->getPayment()->getMethod(); //***** Forma de pago de la compra a la que pertenece esta expedici�n. *****
|
156 |
+
$forma_pago_contrareembolso = Mage::getStoreConfig('carriers/ZELERISShipping/forma_pago_contrareembolso', $this->getStoreId()); //***** Forma de pago seleccionada como contra-reembolso en el combo de configuraci�n de este m�dulo de transportes de Zeleris para Magento. *****
|
157 |
+
if($forma_pago_compra == $forma_pago_contrareembolso) //***** Comprobamos si la forma de pago de la compra a la que corresponde esta expedici�n, coincide con la seleccionada como contra-reembolso en el combo de configuraci�n de este m�dulo de transportes de Zeleris para Magento. *****
|
158 |
+
{
|
159 |
+
if($this->getOrder()->hasShipments() == false)
|
160 |
+
{
|
161 |
+
$envio["importeReembolso"] = number_format(floatval($this->getOrder()->getTotalDue()), 2, ',', ''); //***** S�lo se cobra el importe del reembolso en la primera expedici�n de esta compra.
|
162 |
+
}
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
$ret=$this->graba($envio);
|
167 |
+
|
168 |
+
if ($ret=="")
|
169 |
+
{
|
170 |
+
Mage::throwException(Mage::helper('sales')->__('ERROR: No se ha podido grabar el pedido en Zeleris.'));
|
171 |
+
}
|
172 |
+
|
173 |
+
$track = Mage::getModel('sales/order_shipment_track')
|
174 |
+
->setNumber($ret)
|
175 |
+
->setCarrierCode('ZELERISShipping')
|
176 |
+
->setTitle(substr(Mage::getStoreConfig('carriers/ZELERISShipping/title', $this->getStoreId()), 0, 20))
|
177 |
+
->setDescription('');
|
178 |
+
$this->addTrack($track);
|
179 |
+
}
|
180 |
+
}
|
181 |
+
}
|
182 |
+
else
|
183 |
+
{
|
184 |
+
Mage::throwException(Mage::helper('sales')->__('ATENCIÓN: Módulo de transporte de Zeleris desactivado. Expedición no generada.'));
|
185 |
+
}
|
186 |
+
return $canSave;
|
187 |
+
}
|
188 |
+
|
189 |
+
/***************** Comunicamos a Zeleris el env�o en firme, llamando al Web Service correspondiente ******************/
|
190 |
+
protected function graba($envio)
|
191 |
+
{
|
192 |
+
try {
|
193 |
+
$xml = array("docIn" => "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" .
|
194 |
+
"<Body>" .
|
195 |
+
"<InfoCuenta>" .
|
196 |
+
"<UIDCliente>" . $this->limpia($envio["uidCliente"]) . "</UIDCliente>" .
|
197 |
+
"<Usuario>" . "" . "</Usuario>" .
|
198 |
+
"<Clave>" . "" . "</Clave>" .
|
199 |
+
"<CodRemitente>" . "" . "</CodRemitente>" .
|
200 |
+
"</InfoCuenta>" .
|
201 |
+
|
202 |
+
"<DatosDestinatario>" .
|
203 |
+
"<NifCons>" . "-" . "</NifCons>" .
|
204 |
+
"<Nombre>" . $this->limpia($envio["nombreDst"]) . "</Nombre>" .
|
205 |
+
"<Direccion>" . $this->limpia($envio["direccionDst"]) . "</Direccion>" .
|
206 |
+
"<Pais>" . $this->limpia($envio["codPaisDst"]) . "</Pais>" .
|
207 |
+
"<Codpos>" . $this->limpia($envio["cpDst"]) . "</Codpos>" .
|
208 |
+
"<Poblacion>" . $this->limpia($envio["poblacionDst"]) . "</Poblacion>" .
|
209 |
+
"<Contacto>" . $this->limpia($envio["contactoDst"]) . "</Contacto>" .
|
210 |
+
"<Telefono1>" . $this->limpia($envio["telefonoDst"]) . "</Telefono1>" .
|
211 |
+
"<Telefono2>" . $this->limpia($envio["faxDst"]) . "</Telefono2>" .
|
212 |
+
"<Email>" . $this->limpia($envio["emailDst"]) . "</Email>" .
|
213 |
+
"<CodPunto>" . $this->limpia($envio["codPuntoEntrega"]) . "</CodPunto>" .
|
214 |
+
"</DatosDestinatario>" .
|
215 |
+
|
216 |
+
"<DatosServicio>" .
|
217 |
+
"<Referencia>" . $this->limpia($envio["RefC"]) . "</Referencia>" .
|
218 |
+
"<Bultos>" . $this->limpia($envio["bultos"]) . "</Bultos>" .
|
219 |
+
"<Kilos>" . $this->limpia($envio["peso"]) . "</Kilos>" .
|
220 |
+
"<Volumen>" . "0" . "</Volumen>" .
|
221 |
+
"<Servicio>" . $this->limpia($envio["servicio"]) . "</Servicio>" .
|
222 |
+
"<Reembolso>" . $this->limpia($envio["importeReembolso"]) . "</Reembolso>" .
|
223 |
+
"<ValorSeguro>" . "0" . "</ValorSeguro>" .
|
224 |
+
"<ValoraAduana>" . "0" . "</ValoraAduana>" .
|
225 |
+
"<Mercancia>" . $this->limpia($envio["nombreProducto"]) . "</Mercancia>" .
|
226 |
+
"<TipoGastosAduana>" . "0" . "</TipoGastosAduana>" .
|
227 |
+
"<TipoAvisoEntrega>" . "0" . "</TipoAvisoEntrega>" .
|
228 |
+
"<TipoPortes>" . "P" . "</TipoPortes>" .
|
229 |
+
"<TipoReembolso>" . "P" . "</TipoReembolso>" .
|
230 |
+
"<DAS>" . "" . "</DAS>" .
|
231 |
+
"<GS>" . "" . "</GS>" .
|
232 |
+
"<Identicket>" . "" . "</Identicket>" .
|
233 |
+
"<FechaEA>" . "" . "</FechaEA>" .
|
234 |
+
"<Observaciones>" . "" . "</Observaciones>" .
|
235 |
+
"<ModoTransporte>" . $envio["modoTransporte"] . "</ModoTransporte>" .
|
236 |
+
"<InfoBultos>" . $envio["detalle"] . "</InfoBultos>" .
|
237 |
+
"</DatosServicio>" .
|
238 |
+
"</Body>");
|
239 |
+
|
240 |
+
$client = new SoapClient($envio["URL"]);
|
241 |
+
$respuesta = $client->GrabaServicios($xml)->GrabaServiciosResult;
|
242 |
+
$posicioninicial = strpos($respuesta , '<resultado>') + 11;
|
243 |
+
$posicionfinal = strpos($respuesta , '</resultado>');
|
244 |
+
$resultado = substr($respuesta , $posicioninicial, $posicionfinal - $posicioninicial);
|
245 |
+
|
246 |
+
if ($resultado == "OK") {
|
247 |
+
$posicioninicial = strpos($respuesta , '<nseg>') + 6;
|
248 |
+
$posicionfinal = strpos($respuesta , '</nseg>');
|
249 |
+
$NumeroSeguimiento = substr($respuesta , $posicioninicial, $posicionfinal - $posicioninicial);
|
250 |
+
} else {
|
251 |
+
$NumeroSeguimiento = "";
|
252 |
+
$posicioninicial = strpos($respuesta , '<mensaje>') + 9;
|
253 |
+
$posicionfinal = strpos($respuesta , '</mensaje>');
|
254 |
+
$MensajeError = substr($respuesta , $posicioninicial, $posicionfinal - $posicioninicial);
|
255 |
+
$MensajeError = substr($MensajeError ,0, 150);
|
256 |
+
Mage::throwException(Mage::helper('sales')->__('ATENCIÓN: Error al invocar el Web Service de Zeleris: ' . $MensajeError));
|
257 |
+
}
|
258 |
+
|
259 |
+
} catch (Exception $e) {
|
260 |
+
Mage::throwException(Mage::helper('sales')->__('ERROR:'. $e));
|
261 |
+
$NumeroSeguimiento = "";
|
262 |
+
}
|
263 |
+
return $NumeroSeguimiento;
|
264 |
+
}
|
265 |
+
|
266 |
+
//***** Limpia todos los caracteres que pueden plantear problemas al construir el XML.
|
267 |
+
public function limpia($valor)
|
268 |
+
{
|
269 |
+
$trans = array("&" => "y", "�" => "", "?" => "", "<" => "", ">" => "");
|
270 |
+
return utf8_encode(strtr(utf8_decode($valor), $trans));
|
271 |
+
}
|
272 |
+
|
273 |
+
//***** Obtenemos el env�o actual.
|
274 |
+
protected function getShipment()
|
275 |
+
{
|
276 |
+
return Mage::registry('current_shipment');
|
277 |
+
}
|
278 |
+
|
279 |
+
}
|
app/code/local/ZELERIS/ZELERISShipping/Model/ZELERIS/Source/Method.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class ZELERIS_ZELERISShipping_Model_ZELERIS_Source_Method
|
3 |
+
/***********************************************************************************************************************************************************/
|
4 |
+
/******************************************************************* Versi�n 2.0.0 de marzo de 2013 ********************************************************/
|
5 |
+
/***********************************************************************************************************************************************************/
|
6 |
+
{
|
7 |
+
public function toOptionArray()
|
8 |
+
{
|
9 |
+
$arr = array();
|
10 |
+
$rutaactual = dirname(__FILE__);
|
11 |
+
$xml = simplexml_load_file($rutaactual . '/servicios.xml');
|
12 |
+
|
13 |
+
$indice = 0;
|
14 |
+
foreach($xml->servicio as $item){
|
15 |
+
$arr[] = array('value'=>$indice, 'label'=>$item['descripcion'], 'img'=>$item['imagen'], 'hint'=>$item['ayuda'], 'horario'=>'1', 'codigo'=>$item['codigo']);
|
16 |
+
$indice = $indice + 1;
|
17 |
+
}
|
18 |
+
return $arr;
|
19 |
+
}
|
20 |
+
|
21 |
+
public function getMethod($shippingMethod)
|
22 |
+
{
|
23 |
+
$metodo= explode("_",$shippingMethod);
|
24 |
+
if ($metodo[0]=="ZELERISShipping") {
|
25 |
+
$label=$metodo[1];
|
26 |
+
foreach($this->toOptionArray() as $metodoenvio) {
|
27 |
+
if ($metodoenvio["label"]==$label)
|
28 |
+
$servicio=$metodoenvio;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
return $servicio;
|
32 |
+
}
|
33 |
+
}
|
34 |
+
?>
|
app/code/local/ZELERIS/ZELERISShipping/Model/ZELERIS/Source/Modo.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class ZELERIS_ZELERISShipping_Model_ZELERIS_Source_Modo
|
3 |
+
/***********************************************************************************************************************************************************/
|
4 |
+
/******************************************************************* Versi�n 2.0.0 de marzo de 2013 ********************************************************/
|
5 |
+
/***********************************************************************************************************************************************************/
|
6 |
+
{
|
7 |
+
public function toOptionArray()
|
8 |
+
{
|
9 |
+
$arr = array();
|
10 |
+
$arr[] = array('value'=>1, 'label'=>'Precio Zeleris',);
|
11 |
+
$arr[] = array('value'=>2, 'label'=>'Precio Table Rates',);
|
12 |
+
$arr[] = array('value'=>3, 'label'=>'Precio Flat Rate',);
|
13 |
+
return $arr;
|
14 |
+
}
|
15 |
+
}
|
16 |
+
?>
|
app/code/local/ZELERIS/ZELERISShipping/Model/ZELERIS/Source/servicios.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" ?>
|
2 |
+
<servicios>
|
3 |
+
<servicio codigo="1" descripcion="Nacional urgente" imagen="http://resources.zeleris.com/img/ecom_logo_zeleris_ds.png" ayuda="Nacional urgente"></servicio>
|
4 |
+
<servicio codigo="2" descripcion="Nacional estándar" imagen="http://resources.zeleris.com/img/ecom_logo_zeleris_ds.png" ayuda="Nacional estándar"></servicio>
|
5 |
+
<servicio codigo="50" descripcion="Puntos de entrega" imagen="http://resources.zeleris.com/img/ecom_logo_zeleris_ds.png" ayuda="Puntos de entrega"></servicio>
|
6 |
+
<servicio codigo="101" descripcion="Internacional urgente" imagen="http://resources.zeleris.com/img/ecom_logo_zeleris_ds.png" ayuda="Internacional urgente"></servicio>
|
7 |
+
<servicio codigo="102" descripcion="Internacional estándar" imagen="http://resources.zeleris.com/img/ecom_logo_zeleris_ds.png" ayuda="Internacional estándar"></servicio>
|
8 |
+
</servicios>
|
app/code/local/ZELERIS/ZELERISShipping/Model/ZELERIS/ZELERISShipping.php
ADDED
@@ -0,0 +1,315 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class ZELERIS_ZELERISShipping_Model_ZELERIS_ZELERISShipping extends Mage_Shipping_Model_Carrier_Abstract
|
3 |
+
/***********************************************************************************************************************************************************/
|
4 |
+
/******************************************************************* Versi�n 2.0.0 de marzo de 2013 ********************************************************/
|
5 |
+
/***********************************************************************************************************************************************************/
|
6 |
+
{
|
7 |
+
protected $_code = 'ZELERISShipping';
|
8 |
+
|
9 |
+
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
10 |
+
{
|
11 |
+
if (!$this->getConfigFlag('active'))
|
12 |
+
{
|
13 |
+
return false; /************************************************* Si el m�dulo est� inactivo, no continuamos ********************************/
|
14 |
+
}
|
15 |
+
else
|
16 |
+
{
|
17 |
+
$err = null;
|
18 |
+
$envio = array();
|
19 |
+
if (!$request->getOrig())
|
20 |
+
{
|
21 |
+
$request
|
22 |
+
->setCountryId(Mage::getStoreConfig('shipping/origin/country_id', $request->getStore()))
|
23 |
+
->setPostcode(Mage::getStoreConfig('shipping/origin/postcode', $request->getStore()));
|
24 |
+
}
|
25 |
+
/************************************************* Datos de la compra *********************************************/
|
26 |
+
if ($request->getCountryId() <> 'ES')
|
27 |
+
{
|
28 |
+
$err = "Atención: Sólo se admiten envíos con origen en Espana.";
|
29 |
+
}
|
30 |
+
else
|
31 |
+
{
|
32 |
+
$envio["uidCliente"]= Mage::getStoreConfig('carriers/ZELERISShipping/GUID', $this->getStoreId());
|
33 |
+
if ($this->limpia($envio["uidCliente"] == ""))
|
34 |
+
{
|
35 |
+
$err = "Atención: No se ha indicado el UID de cliente en el formulario de configuración.";
|
36 |
+
}
|
37 |
+
else
|
38 |
+
{
|
39 |
+
if (mb_strlen($this->limpia($envio["uidCliente"])) <> 32)
|
40 |
+
{
|
41 |
+
$err = "Atención: El UID de cliente ha de constar de 32 caracteres de longitud.";
|
42 |
+
}
|
43 |
+
else
|
44 |
+
{
|
45 |
+
$envio["URL"] = Mage::getStoreConfig('carriers/ZELERISShipping/gateway_url', $this->getStoreId());
|
46 |
+
if ($envio["URL"] == "")
|
47 |
+
{
|
48 |
+
$err = "Atención: No se ha indicado una URL en el formulario de configuración.";
|
49 |
+
}
|
50 |
+
else
|
51 |
+
{
|
52 |
+
if (!filter_var($envio["URL"], FILTER_VALIDATE_URL)) {
|
53 |
+
$err = "Atención: No se ha indicado una URL valida en el formulario de configuración.";
|
54 |
+
}else{
|
55 |
+
$envio["codPaisDst"] = $request->getDestCountryId();
|
56 |
+
if (mb_strlen($this->limpia($envio["codPaisDst"])) <> 2)
|
57 |
+
{
|
58 |
+
$err = "Atención: El código del país de destino no es correcto.";
|
59 |
+
}
|
60 |
+
else
|
61 |
+
{
|
62 |
+
if ($this->limpia($envio["codPaisDst"]) == "ES")
|
63 |
+
{
|
64 |
+
$envio["peso"] = ceil($request->getPackageWeight()); //Para envios nacionales, redondeamos hacia arriba y descartamos todos los decimales.
|
65 |
+
}
|
66 |
+
else
|
67 |
+
{
|
68 |
+
$envio["peso"] = round($request->getPackageWeight(),2); //Para envios internacionales, redondeamos y nos quedamos con 2 decimales.
|
69 |
+
//$envio["peso"] = str_replace (".", ",", $envio["peso"]); //Sustituimos el punto decimal por la coma decimal.
|
70 |
+
}
|
71 |
+
if (mb_strlen($this->limpia($envio["peso"])) > 6)
|
72 |
+
{
|
73 |
+
$err = "Atención: El peso supera los 6 caracteres de longitud. Peso='".$envio["peso"]."'";
|
74 |
+
}
|
75 |
+
else
|
76 |
+
{
|
77 |
+
if (floatval($this->limpia($envio["peso"])) <= 0)
|
78 |
+
{
|
79 |
+
$envio["peso"] = 1;
|
80 |
+
}
|
81 |
+
|
82 |
+
$envio["cpDst"] = $request->getDestPostcode();
|
83 |
+
if (mb_strlen($this->limpia($envio["cpDst"])) > 7)
|
84 |
+
{
|
85 |
+
$err = "Atención: El código postal de destino supera los 7 caracteres de longitud.";
|
86 |
+
}
|
87 |
+
else
|
88 |
+
{
|
89 |
+
$envio["bultos"] = 1;
|
90 |
+
$envio["precioProducto"] = $request->getPackageValue();
|
91 |
+
$servicios = Mage::getModel('ZELERISShipping/ZELERIS_Source_Method')->toOptionArray();
|
92 |
+
$serviciosActivos = explode(',', $this->getConfigData('servicios'));
|
93 |
+
}
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
}
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
$result = Mage::getModel('shipping/rate_result');
|
103 |
+
|
104 |
+
if ($err)
|
105 |
+
{
|
106 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
107 |
+
$error->setCarrier($this->_code);
|
108 |
+
$error->setCarrierTitle($this->getConfigData('title'));
|
109 |
+
$error->setErrorMessage($err);
|
110 |
+
$result->append($error);
|
111 |
+
}
|
112 |
+
else
|
113 |
+
{
|
114 |
+
foreach ($serviciosActivos as $iservicio)
|
115 |
+
{
|
116 |
+
$servicio = $servicios[$iservicio];
|
117 |
+
$envio["indice"] = $servicio ["value"];
|
118 |
+
$envio["servicio"] = $servicio ["codigo"];
|
119 |
+
$modo = (int)Mage::getStoreConfig('carriers/ZELERISShipping/modo', $this->getStoreId());
|
120 |
+
switch ($modo)
|
121 |
+
{
|
122 |
+
case 1:
|
123 |
+
$envio["importe"] = $this->valora($envio); //***** Si el valor es 1, el precio del servicio es el devuelto por el web service de Zeleris *****
|
124 |
+
break;
|
125 |
+
case 2:
|
126 |
+
$envio["importe"] = Mage::helper('tablerate')->collectRates($request); //***** Si el valor es 2, el precio del servicio es el devuelto por el Core de Magento para el Table Rates, pero poniendo ese precio como si el Web Service de Zeleris lo hubiese devuelto.
|
127 |
+
break;
|
128 |
+
case 3:
|
129 |
+
$envio["importe"] = Mage::helper('flatrate')->collectRates($request); //***** Si el valor es 3, el precio del servicio es el devuelto por el Core de Magento para el Flat Rate, pero poniendo ese precio como si el Web Service de Zeleris lo hubiese devuelto.
|
130 |
+
break;
|
131 |
+
default:
|
132 |
+
$envio["importe"] = -3;
|
133 |
+
}
|
134 |
+
if ($envio["importe"] < 0)
|
135 |
+
{
|
136 |
+
$error = Mage::getModel('shipping/rate_result_error');
|
137 |
+
$error->setCarrier($this->_code);
|
138 |
+
$error->setCarrierTitle($this->getConfigData('title'));
|
139 |
+
switch ($envio["importe"])
|
140 |
+
{
|
141 |
+
case -1: //***** -1 indica que Zeleris no tiene disponible el servicio indicado para el destino solicitado. Por ejemplo, un servicio Z10 en un pa�s extranjero o un ZDS para Jap�n, o bien que se trata de un destino desconocido, como un c�digo postal no existente en Espa�a.
|
142 |
+
//***** No hacemos nada en este caso. Si $result->append($error), no nos mostrar�a ning�n servicio en el caso de que el cliente no tuviese contratado alguno.
|
143 |
+
break;
|
144 |
+
case -2: //***** -2 indica un error en la funci�n de consulta al Web Service, por lo que mostramos el error establecido en el campo "Mensaje error" del formulario de configuraci�n del m�dulo, si est� habilitada la opci�n "Mostrar servicios en caso de error".
|
145 |
+
$error->setErrorMessage($this->getConfigData('specificerrmsg'));
|
146 |
+
$result->append($error);
|
147 |
+
break;
|
148 |
+
case -3: //***** -3 indica que el tipo de valoraci�n es desconocido.
|
149 |
+
$error->setErrorMessage("Se desconoce el tipo de valoracion que debe ser aplicado a este servicio.");
|
150 |
+
$result->append($error);
|
151 |
+
break;
|
152 |
+
}
|
153 |
+
}
|
154 |
+
else
|
155 |
+
{
|
156 |
+
$envio["importeFinal"]=$this->precioFinal($envio);
|
157 |
+
$rate = Mage::getModel('shipping/rate_result_method');
|
158 |
+
$rate->setCarrier($this->_code);
|
159 |
+
$rate->setCarrierTitle($this->getConfigData('title'));
|
160 |
+
$rate->setMethod($servicio["label"]);
|
161 |
+
|
162 |
+
|
163 |
+
//$rate->setMethodTitle('<img src="'.$servicio["img"].'" alt="'. $servicio["label"].'" title="'. $servicio["hint"] .'" />'.$servicio["hint"].'.');
|
164 |
+
// Bug de Magento a partir de la versi�n 1.6.2 que hace que el < se cambie por < y el > por >, lo que impide que se vea bien el logotipo del los servicios.
|
165 |
+
// Solucionar en Magento o cambiar la l�nea de arriba por esta de abajo.
|
166 |
+
$rate->setMethodTitle($servicio["hint"].'.');
|
167 |
+
|
168 |
+
|
169 |
+
if ($envio["importeFinal"] == -1)
|
170 |
+
{
|
171 |
+
$rate->setMethodTitle($rate->getMethodTitle().' (Servicio gratuito)');
|
172 |
+
$envio["importeFinal"]=0;
|
173 |
+
}
|
174 |
+
$rate->setCost($envio["importe"]);
|
175 |
+
$rate->setPrice($envio["importeFinal"]);
|
176 |
+
$result->append($rate);
|
177 |
+
}
|
178 |
+
}
|
179 |
+
}
|
180 |
+
return $result;
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
|
185 |
+
/************************************** Valoramos el env�o llamando al Web Service correspondiente ******************************/
|
186 |
+
protected function valora($envio)
|
187 |
+
{
|
188 |
+
try
|
189 |
+
{
|
190 |
+
$xml = array("docIn" => "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" .
|
191 |
+
"<Body>" .
|
192 |
+
"<InfoCuenta>" .
|
193 |
+
"<UIDCliente>" . $this->limpia($envio["uidCliente"]) . "</UIDCliente>" .
|
194 |
+
"<Usuario>" . "" . "</Usuario>" .
|
195 |
+
"<Clave>" . "" . "</Clave>" .
|
196 |
+
"<CodRemitente>" . "" . "</CodRemitente>" .
|
197 |
+
"</InfoCuenta>" .
|
198 |
+
|
199 |
+
"<DatosDestino>" .
|
200 |
+
"<Pais>" . $this->limpia($envio["codPaisDst"]) . "</Pais>" .
|
201 |
+
"<Codpos>" . $this->limpia($envio["cpDst"]) . "</Codpos>" .
|
202 |
+
"</DatosDestino>" .
|
203 |
+
|
204 |
+
"<DatosServicio>" .
|
205 |
+
"<Bultos>" . $this->limpia($envio["bultos"]) . "</Bultos>" .
|
206 |
+
"<Kilos>" . $this->limpia($envio["peso"]) . "</Kilos>" .
|
207 |
+
"<Volumen>" . "0" . "</Volumen>" .
|
208 |
+
"<Servicio>" . $this->limpia($envio["servicio"]) . "</Servicio>" .
|
209 |
+
"<Reembolso>" . "0" . "</Reembolso>" .
|
210 |
+
"<ValorSeguro>" . "0" . "</ValorSeguro>" .
|
211 |
+
"</DatosServicio>" .
|
212 |
+
"</Body>");
|
213 |
+
|
214 |
+
|
215 |
+
$client = new SoapClient($envio["URL"]);
|
216 |
+
$respuesta = $client->Valora($xml)->ValoraResult;
|
217 |
+
$posicioninicial = strpos($respuesta , '<Status>') + 8;
|
218 |
+
$posicionfinal = strpos($respuesta , '</Status>');
|
219 |
+
$resultado = substr($respuesta , $posicioninicial, $posicionfinal - $posicioninicial);
|
220 |
+
if ($resultado == "OK")
|
221 |
+
{
|
222 |
+
$posicioninicial = strpos($respuesta , '<PresupuestoServicio>') + 21;
|
223 |
+
$posicionfinal = strpos($respuesta , '</PresupuestoServicio>');
|
224 |
+
$presupuestoservicio = substr($respuesta , $posicioninicial, $posicionfinal - $posicioninicial);
|
225 |
+
}
|
226 |
+
else
|
227 |
+
{
|
228 |
+
$presupuestoservicio = -1;
|
229 |
+
}
|
230 |
+
}
|
231 |
+
catch (Exception $e)
|
232 |
+
{
|
233 |
+
$presupuestoservicio = -2;
|
234 |
+
}
|
235 |
+
|
236 |
+
return $presupuestoservicio;
|
237 |
+
}
|
238 |
+
|
239 |
+
|
240 |
+
/********* Calculamos el precio total del env�o, contemplando si hay costes de manipulado y/o env�o gratuito *********/
|
241 |
+
protected function precioFinal($envio)
|
242 |
+
{
|
243 |
+
$importe=$envio["importe"];
|
244 |
+
// if (($this->getConfigData('free_shipping_enable'))) // ***** Esta l�nea s�lo funciona para el servicio 'Zeleris Ecommerce'. Si hay m�ltiples servicios, ha de ponerse la l�nea de abajo. *****
|
245 |
+
if (($this->getConfigData('free_shipping_enable')) && ($this->getConfigData('free_method')==$envio["indice"])) // ***** Esta l�nea s�lo funciona para m�ltiples servicios. Si s�lo se indica el servicio 'Zeleris Ecommerce', ha de ponerse la l�nea de arriba. *****
|
246 |
+
{
|
247 |
+
if ($envio["precioProducto"] >= (float)$this->getConfigData('free_shipping_subtotal'))
|
248 |
+
{
|
249 |
+
$importe='-1';
|
250 |
+
}
|
251 |
+
}
|
252 |
+
|
253 |
+
if ($importe>0)
|
254 |
+
{
|
255 |
+
$tipoManipulado = $this->getConfigData('handling_type');
|
256 |
+
$valorManipulado = $this->getConfigData('handling_fee');
|
257 |
+
if ($tipoManipulado=='F')
|
258 |
+
{
|
259 |
+
$importe+= $valorManipulado;
|
260 |
+
}
|
261 |
+
if ($tipoManipulado=='P')
|
262 |
+
{
|
263 |
+
$importe+= ($importe*$valorManipulado/100);
|
264 |
+
}
|
265 |
+
}
|
266 |
+
return $importe;
|
267 |
+
}
|
268 |
+
|
269 |
+
|
270 |
+
/************************************************* Obtenemos la informaci�n sobre el tracking **********************************/
|
271 |
+
public function getTrackingInfo($tracking_number)
|
272 |
+
{
|
273 |
+
$tracking_result = $this->getTracking($tracking_number);
|
274 |
+
if ($tracking_result instanceof Mage_Shipping_Model_Tracking_Result)
|
275 |
+
{
|
276 |
+
$trackings = $tracking_result->getAllTrackings();
|
277 |
+
if ($trackings)
|
278 |
+
{
|
279 |
+
return $trackings[0];
|
280 |
+
}
|
281 |
+
}
|
282 |
+
else
|
283 |
+
{
|
284 |
+
if (is_string($tracking_result) && !empty($tracking_result))
|
285 |
+
{
|
286 |
+
return $tracking_result;
|
287 |
+
}
|
288 |
+
else
|
289 |
+
{
|
290 |
+
return false;
|
291 |
+
}
|
292 |
+
}
|
293 |
+
}
|
294 |
+
|
295 |
+
|
296 |
+
/******************************** Invocamos la p�gina web de Zeleris con la informaci�n del env�o y la gesti�n de incidencias, si procede ****************************/
|
297 |
+
protected function getTracking($numeroSeguimiento)
|
298 |
+
{
|
299 |
+
$uidCliente = Mage::getStoreConfig('carriers/ZELERISShipping/GUID', $this->getStoreId());
|
300 |
+
$cliente = new SoapClient(Mage::getStoreConfig('carriers/ZELERISShipping/gateway_url', $this->getStoreId()));
|
301 |
+
header("Location: ".$cliente->TrackingURL()->TrackingURLResult."?id_seguimiento=".$numeroSeguimiento); //***** Esto muestra s�lo el tracking reducido, tanto para el comprador como para el administrador.
|
302 |
+
//header("Location: ".$cliente->TrackingURL()->TrackingURLResult."?uid=".$uidCliente."&id_seguimiento=".$numeroSeguimiento); //***** Esto muestra s�lo el tracking ampliado, que s�lo debe ser visible por un administrador.
|
303 |
+
$tracking_status = Mage::getModel('shipping/tracking_result_status');
|
304 |
+
$tracking_result->append($tracking_status);
|
305 |
+
}
|
306 |
+
|
307 |
+
|
308 |
+
//***** Limpia todos los caracteres que pueden plantear problemas al construir el XML.
|
309 |
+
public function limpia($valor)
|
310 |
+
{
|
311 |
+
$trans = array("&" => "y", "�" => "", "?" => "", "<" => "", ">" => "");
|
312 |
+
return utf8_encode(strtr(utf8_decode($valor), $trans));
|
313 |
+
}
|
314 |
+
|
315 |
+
}
|
app/code/local/ZELERIS/ZELERISShipping/etc/config.xml
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<ZELERIS_ZELERISShipping>
|
5 |
+
<version>2.0.0</version>
|
6 |
+
</ZELERIS_ZELERISShipping>
|
7 |
+
</modules>
|
8 |
+
|
9 |
+
<global>
|
10 |
+
<models>
|
11 |
+
<ZELERISShipping>
|
12 |
+
<class>ZELERIS_ZELERISShipping_Model</class>
|
13 |
+
</ZELERISShipping>
|
14 |
+
|
15 |
+
<sales>
|
16 |
+
<rewrite>
|
17 |
+
<order_shipment>ZELERIS_ZELERISShipping_Model_ZELERIS_Shipment</order_shipment>
|
18 |
+
</rewrite>
|
19 |
+
</sales>
|
20 |
+
</models>
|
21 |
+
|
22 |
+
<resources>
|
23 |
+
<ZELERISShipping_setup>
|
24 |
+
<setup>
|
25 |
+
<module>ZELERIS_ZELERISShipping</module>
|
26 |
+
</setup>
|
27 |
+
<connection>
|
28 |
+
<use>core_setup</use>
|
29 |
+
</connection>
|
30 |
+
</ZELERISShipping_setup>
|
31 |
+
</resources>
|
32 |
+
|
33 |
+
<blocks>
|
34 |
+
<adminhtml>
|
35 |
+
<rewrite>
|
36 |
+
<sales_order_shipment_view>ZELERIS_ZELERISShipping_Adminhtml_Block_Sales_Order_Shipment_View</sales_order_shipment_view>
|
37 |
+
</rewrite>
|
38 |
+
</adminhtml>
|
39 |
+
</blocks>
|
40 |
+
</global>
|
41 |
+
|
42 |
+
<frontend>
|
43 |
+
<layout>
|
44 |
+
<updates>
|
45 |
+
<zeleris_puntosentrega module="ZELERIS_ZELERISShipping">
|
46 |
+
<file>zeleris_puntosentrega.xml</file>
|
47 |
+
</zeleris_puntosentrega>
|
48 |
+
</updates>
|
49 |
+
</layout>
|
50 |
+
</frontend>
|
51 |
+
|
52 |
+
<adminhtml>
|
53 |
+
<layout>
|
54 |
+
<updates>
|
55 |
+
<zeleris_sales module="ZELERIS_ZELERISShipping">
|
56 |
+
<file>zeleris_sales.xml</file>
|
57 |
+
</zeleris_sales>
|
58 |
+
</updates>
|
59 |
+
</layout>
|
60 |
+
</adminhtml>
|
61 |
+
|
62 |
+
<default>
|
63 |
+
<carriers>
|
64 |
+
<ZELERISShipping>
|
65 |
+
<version>MT-2.0.0</version>
|
66 |
+
<active>1</active>
|
67 |
+
<title>Zeleris</title>
|
68 |
+
<gateway_url>https://wscli.zeleris.com/ecomportal.asmx?wsdl</gateway_url>
|
69 |
+
<GUID></GUID>
|
70 |
+
<productname>No indicado</productname>
|
71 |
+
<servicios>0</servicios>
|
72 |
+
<modo>0</modo>
|
73 |
+
<handling_type>F</handling_type>
|
74 |
+
<handling_fee>0</handling_fee>
|
75 |
+
<free_shipping_enable>False</free_shipping_enable>
|
76 |
+
<free_shipping_subtotal>0</free_shipping_subtotal>
|
77 |
+
<free_method>0</free_method>
|
78 |
+
<habilitar_pago_contrareembolso>F</habilitar_pago_contrareembolso>
|
79 |
+
<forma_pago_contrareembolso></forma_pago_contrareembolso>
|
80 |
+
<showmethod>N</showmethod>
|
81 |
+
<specificerrmsg>No es posible obtener la tarifa de transporte. Por favor, ha de ponerse en contacto con nosotros.</specificerrmsg>
|
82 |
+
<model>ZELERISShipping/ZELERIS_ZELERISShipping</model>
|
83 |
+
</ZELERISShipping>
|
84 |
+
</carriers>
|
85 |
+
</default>
|
86 |
+
</config>
|
app/code/local/ZELERIS/ZELERISShipping/etc/system.xml
ADDED
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<carriers>
|
5 |
+
<groups>
|
6 |
+
<ZELERISShipping translate="label" module="shipping">
|
7 |
+
<label>Zeleris</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 |
+
|
14 |
+
<fields>
|
15 |
+
<version translate="label">
|
16 |
+
<label>Versión</label>
|
17 |
+
<comment></comment>
|
18 |
+
<frontend_type>label</frontend_type>
|
19 |
+
<sort_order>1</sort_order>
|
20 |
+
<show_in_default>1</show_in_default>
|
21 |
+
<show_in_website>1</show_in_website>
|
22 |
+
<show_in_store>1</show_in_store>
|
23 |
+
</version>
|
24 |
+
|
25 |
+
<title translate="label">
|
26 |
+
<label>Nombre del transportista</label>
|
27 |
+
<comment></comment>
|
28 |
+
<frontend_type>text</frontend_type>
|
29 |
+
<sort_order>2</sort_order>
|
30 |
+
<show_in_default>1</show_in_default>
|
31 |
+
<show_in_website>1</show_in_website>
|
32 |
+
<show_in_store>1</show_in_store>
|
33 |
+
</title>
|
34 |
+
|
35 |
+
<active translate="label">
|
36 |
+
<label>Activado</label>
|
37 |
+
<comment></comment>
|
38 |
+
<frontend_type>select</frontend_type>
|
39 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
40 |
+
<sort_order>3</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>1</show_in_website>
|
43 |
+
<show_in_store>1</show_in_store>
|
44 |
+
</active>
|
45 |
+
|
46 |
+
<gateway_url translate="label">
|
47 |
+
<label>URL Gateway</label>
|
48 |
+
<comment>Dirección de conexión con Zeleris. No modificar excepto por indicación de Zeleris.</comment>
|
49 |
+
<frontend_type>text</frontend_type>
|
50 |
+
<sort_order>4</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
</gateway_url>
|
55 |
+
|
56 |
+
<GUID translate="label">
|
57 |
+
<label>Identificador de cliente (GUID)</label>
|
58 |
+
<comment>Dato proporcionado por Zeleris. No modificar excepto por indicación de Zeleris.</comment>
|
59 |
+
<frontend_type>text</frontend_type>
|
60 |
+
<sort_order>5</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>1</show_in_store>
|
64 |
+
</GUID>
|
65 |
+
|
66 |
+
<productname translate="label">
|
67 |
+
<label>Descripción mercancía</label>
|
68 |
+
<comment>Descripción generica de la mercancía aplicable en envíos que requieran tramites de aduana. (Hasta 20 caracteres de longitud)</comment>
|
69 |
+
<frontend_type>text</frontend_type>
|
70 |
+
<sort_order>6</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>1</show_in_store>
|
74 |
+
</productname>
|
75 |
+
|
76 |
+
<servicios translate="label">
|
77 |
+
<label>Servicios</label>
|
78 |
+
<comment>Servicios de transporte que se ofrecen a los compradores.</comment>
|
79 |
+
<frontend_type>multiselect</frontend_type>
|
80 |
+
<source_model>ZELERISShipping/ZELERIS_Source_Method</source_model>
|
81 |
+
<sort_order>7</sort_order>
|
82 |
+
<show_in_default>1</show_in_default>
|
83 |
+
<show_in_website>1</show_in_website>
|
84 |
+
<show_in_store>1</show_in_store>
|
85 |
+
<can_be_empty>0</can_be_empty>
|
86 |
+
</servicios>
|
87 |
+
|
88 |
+
<modo translate="label">
|
89 |
+
<label>Modo</label>
|
90 |
+
<comment>Permite indicar si el precio del transporte será el devuelto por el Web Service de Zeleris, o uno de los calculados localmente por Magento según la información introducida en 'Table Rates' o en 'Flat Rate'. Seleccione el modo de cálculo adecuado.</comment>
|
91 |
+
<frontend_type>select</frontend_type>
|
92 |
+
<source_model>ZELERISShipping/ZELERIS_Source_Modo</source_model>
|
93 |
+
<sort_order>8</sort_order>
|
94 |
+
<show_in_default>1</show_in_default>
|
95 |
+
<show_in_website>1</show_in_website>
|
96 |
+
<show_in_store>0</show_in_store>
|
97 |
+
</modo>
|
98 |
+
|
99 |
+
<handling_type translate="label">
|
100 |
+
<label>Tipo de coste de manipulado</label>
|
101 |
+
<comment>Define un coste de manipulado o preparación de pedido, bien fijo ('Fixed'), bien un porcentaje sobre la base imponible del pedido ('Percent').</comment>
|
102 |
+
<frontend_type>select</frontend_type>
|
103 |
+
<source_model>shipping/source_handlingType</source_model>
|
104 |
+
<sort_order>9</sort_order>
|
105 |
+
<show_in_default>1</show_in_default>
|
106 |
+
<show_in_website>1</show_in_website>
|
107 |
+
<show_in_store>0</show_in_store>
|
108 |
+
</handling_type>
|
109 |
+
|
110 |
+
<handling_fee translate="label">
|
111 |
+
<label>Coste fijo o porcentaje de manipulado</label>
|
112 |
+
<comment>Indica el coste fijo o el porcentaje sobre la base imponible de su pedido a cobrar al comprador en concepto de gastos de manipulación.</comment>
|
113 |
+
<frontend_type>text</frontend_type>
|
114 |
+
<sort_order>10</sort_order>
|
115 |
+
<show_in_default>1</show_in_default>
|
116 |
+
<show_in_website>1</show_in_website>
|
117 |
+
<show_in_store>0</show_in_store>
|
118 |
+
</handling_fee>
|
119 |
+
|
120 |
+
<free_shipping_enable translate="label">
|
121 |
+
<label>Transporte gratuito</label>
|
122 |
+
<comment>Seleccione 'Enable' para habilitar el transporte gratuito en las compras que alcancen o superen el 'Umbral para transporte gratuito'. Si no quiere ofrecer transporte gratuito seleccione 'Disable'.</comment>
|
123 |
+
<frontend_type>select</frontend_type>
|
124 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
125 |
+
<sort_order>11</sort_order>
|
126 |
+
<show_in_default>1</show_in_default>
|
127 |
+
<show_in_website>1</show_in_website>
|
128 |
+
<show_in_store>0</show_in_store>
|
129 |
+
</free_shipping_enable>
|
130 |
+
|
131 |
+
<free_shipping_subtotal translate="label">
|
132 |
+
<label>Umbral para transporte gratuito</label>
|
133 |
+
<comment>Importe del pedido, sin impuestos, a partir del cual el transporte pasa a ser gratuito para el comprador, siempre que la opción 'Transporte gratuito' este establecida a 'Enable'.</comment>
|
134 |
+
<frontend_type>text</frontend_type>
|
135 |
+
<sort_order>12</sort_order>
|
136 |
+
<show_in_default>1</show_in_default>
|
137 |
+
<show_in_website>1</show_in_website>
|
138 |
+
<show_in_store>0</show_in_store>
|
139 |
+
</free_shipping_subtotal>
|
140 |
+
|
141 |
+
<free_method translate="label">
|
142 |
+
<label>Servicio gratuito</label>
|
143 |
+
<comment>Servicio de transporte a utilizar en los envíos gratuitos.</comment>
|
144 |
+
<frontend_type>select</frontend_type>
|
145 |
+
<frontend_class>free-method</frontend_class>
|
146 |
+
<source_model>ZELERISShipping/ZELERIS_Source_Method</source_model>
|
147 |
+
<sort_order>13</sort_order>
|
148 |
+
<show_in_default>1</show_in_default>
|
149 |
+
<show_in_website>1</show_in_website>
|
150 |
+
<show_in_store>0</show_in_store>
|
151 |
+
</free_method>
|
152 |
+
|
153 |
+
<habilitar_pago_contrareembolso translate="label">
|
154 |
+
<label>Habilitar pago contra-reembolso</label>
|
155 |
+
<comment>Permite parametrizar Magento para realizar envíos contra-reembolso. Seleccione 'Yes' para habilitar el pago contra-reembolso.</comment>
|
156 |
+
<frontend_type>select</frontend_type>
|
157 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
158 |
+
<sort_order>14</sort_order>
|
159 |
+
<show_in_default>1</show_in_default>
|
160 |
+
<show_in_website>1</show_in_website>
|
161 |
+
<show_in_store>0</show_in_store>
|
162 |
+
</habilitar_pago_contrareembolso>
|
163 |
+
|
164 |
+
<forma_pago_contrareembolso translate="label">
|
165 |
+
<label>Pago contra-reembolso</label>
|
166 |
+
<comment>Si dispone de una forma de pago contra-reembolso configurada actualmente en Magento, indique aquí cual es.</comment>
|
167 |
+
<frontend_type>select</frontend_type>
|
168 |
+
<frontend_class>0</frontend_class>
|
169 |
+
<source_model>Mage_Adminhtml_Model_System_Config_Source_Payment_Allowedmethods</source_model>
|
170 |
+
<sort_order>15</sort_order>
|
171 |
+
<show_in_default>1</show_in_default>
|
172 |
+
<show_in_website>1</show_in_website>
|
173 |
+
<show_in_store>0</show_in_store>
|
174 |
+
</forma_pago_contrareembolso>
|
175 |
+
|
176 |
+
<showmethod translate="label">
|
177 |
+
<label>Mostrar servicios en caso de error</label>
|
178 |
+
<comment>Indica si se mostrarán o no los servicios al comprador en caso de no estar disponibles para el destino seleccionado, o no disponer de precio, etc.</comment>
|
179 |
+
<frontend_type>select</frontend_type>
|
180 |
+
<sort_order>16</sort_order>
|
181 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
182 |
+
<show_in_default>1</show_in_default>
|
183 |
+
<show_in_website>1</show_in_website>
|
184 |
+
<show_in_store>1</show_in_store>
|
185 |
+
</showmethod>
|
186 |
+
|
187 |
+
<specificerrmsg translate="label">
|
188 |
+
<label>Mensaje de error</label>
|
189 |
+
<comment>Texto que se mostrará al comprador, en caso de error de comunicaciones, al consultar precios de transporte.</comment>
|
190 |
+
<frontend_type>textarea</frontend_type>
|
191 |
+
<sort_order>17</sort_order>
|
192 |
+
<show_in_default>1</show_in_default>
|
193 |
+
<show_in_website>1</show_in_website>
|
194 |
+
<show_in_store>1</show_in_store>
|
195 |
+
</specificerrmsg>
|
196 |
+
|
197 |
+
</fields>
|
198 |
+
|
199 |
+
</ZELERISShipping>
|
200 |
+
</groups>
|
201 |
+
</carriers>
|
202 |
+
</sections>
|
203 |
+
</config>
|
app/design/adminhtml/default/default/layout/zeleris_sales.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<layout version="0.1.0">
|
4 |
+
|
5 |
+
<adminhtml_sales_order_shipment_new>
|
6 |
+
<reference name="order_items">
|
7 |
+
<action method="setTemplate">
|
8 |
+
<template>zeleris/sales/order/shipment/create/items.phtml</template>
|
9 |
+
</action>
|
10 |
+
</reference>
|
11 |
+
</adminhtml_sales_order_shipment_new>
|
12 |
+
</layout>
|
app/design/adminhtml/default/default/template/zeleris/sales/order/shipment/create/items.phtml
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package default_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<div class="grid np">
|
28 |
+
<div class="hor-scroll">
|
29 |
+
<table cellspacing="0" class="data order-tables">
|
30 |
+
<col />
|
31 |
+
<col width="1" />
|
32 |
+
<col width="1" />
|
33 |
+
<?php if (!$this->canShipPartiallyItem()): ?>
|
34 |
+
<col width="20" />
|
35 |
+
<?php endif; ?>
|
36 |
+
<thead>
|
37 |
+
<tr class="headings">
|
38 |
+
<th><?php echo $this->helper('sales')->__('Product') ?></th>
|
39 |
+
<th class="a-center"><?php echo $this->helper('sales')->__('Qty') ?></th>
|
40 |
+
<th<?php if ($this->isShipmentRegular()): ?> class="last"<?php endif; ?>><span class="nobr"><?php echo $this->helper('sales')->__('Qty to Ship') ?></span></th>
|
41 |
+
|
42 |
+
<?php if (!$this->canShipPartiallyItem()): ?>
|
43 |
+
<th class="a-center last"><span class="nobr"><?php echo $this->helper('sales')->__('Ship') ?></span></th>
|
44 |
+
<?php endif; ?>
|
45 |
+
|
46 |
+
</tr>
|
47 |
+
</thead>
|
48 |
+
<?php $_items = $this->getShipment()->getAllItems() ?>
|
49 |
+
<?php $_i=0;foreach ($_items as $_item): if ($_item->getOrderItem()->getIsVirtual() || $_item->getOrderItem()->getParentItem()): continue; endif; $_i++ ?>
|
50 |
+
<tbody class="<?php echo $_i%2?'odd':'even' ?>">
|
51 |
+
<?php echo $this->getItemHtml($_item) ?>
|
52 |
+
<?php echo $this->getItemExtraInfoHtml($_item->getOrderItem()) ?>
|
53 |
+
</tbody>
|
54 |
+
<?php endforeach; ?>
|
55 |
+
</table>
|
56 |
+
</div>
|
57 |
+
</div>
|
58 |
+
<br />
|
59 |
+
<div class="box-left entry-edit">
|
60 |
+
<div class="entry-edit-head"><h4><?php echo $this->__('Shipment Comments') ?></h4></div>
|
61 |
+
<fieldset>
|
62 |
+
<div id="order-history_form">
|
63 |
+
<span class="field-row">
|
64 |
+
<label class="normal" for="shipment_comment_text"><?php echo Mage::helper('sales')->__('Shipment Comments') ?></label>
|
65 |
+
<textarea id="shipment_comment_text" name="shipment[comment_text]" rows="3" cols="5" style="height:6em; width:99%;"><?php echo $this->getShipment()->getCommentText(); ?></textarea>
|
66 |
+
</span>
|
67 |
+
<div class="clear"></div>
|
68 |
+
</div>
|
69 |
+
</fieldset>
|
70 |
+
</div>
|
71 |
+
|
72 |
+
<div class="box-right entry-edit">
|
73 |
+
<div class="order-totals">
|
74 |
+
<div class="order-totals-bottom">
|
75 |
+
<?php if ($this->canCreateShippingLabel()): ?>
|
76 |
+
<p>
|
77 |
+
<label class="normal" for="create_shipping_label"><?php echo Mage::helper('sales')->__('Create Shipping Label') ?></label>
|
78 |
+
<input id="create_shipping_label" name="shipment[create_shipping_label]" value="1" type="checkbox" onclick="toggleCreateLabelCheckbox();" />
|
79 |
+
</p>
|
80 |
+
<?php endif ?>
|
81 |
+
<p>
|
82 |
+
<label class="normal" for="notify_customer"><?php echo Mage::helper('sales')->__('Append Comments') ?></label>
|
83 |
+
<input id="notify_customer" name="shipment[comment_customer_notify]" value="1" type="checkbox" />
|
84 |
+
</p>
|
85 |
+
<?php if ($this->canSendShipmentEmail()): ?>
|
86 |
+
<p>
|
87 |
+
<label class="normal" for="send_email"><?php echo Mage::helper('sales')->__('Email Copy of Shipment') ?></label>
|
88 |
+
<input id="send_email" name="shipment[send_email]" value="1" type="checkbox" />
|
89 |
+
</p>
|
90 |
+
<?php endif; ?>
|
91 |
+
<?php $arrayMethod = explode("_", $this->getOrder()->getShippingMethod()); ?>
|
92 |
+
<?php if ($arrayMethod[0] == "ZELERISShipping"): ?>
|
93 |
+
<p>
|
94 |
+
<label class="normal" for="no_generar_envio"><?php echo Mage::helper('sales')->__('No generar envío') ?></label>
|
95 |
+
<input id="no_generar_envio" name="shipment[no_generar_envio]" value="1" type="checkbox" />
|
96 |
+
</p>
|
97 |
+
<?php endif ?>
|
98 |
+
<div class="a-right">
|
99 |
+
<?php echo $this->getChildHtml('submit_button') ?>
|
100 |
+
</div>
|
101 |
+
</div>
|
102 |
+
</div>
|
103 |
+
</div>
|
104 |
+
|
105 |
+
<div class="clear"></div>
|
106 |
+
<script type="text/javascript">
|
107 |
+
//<![CDATA[
|
108 |
+
|
109 |
+
var sendEmailCheckbox = $('send_email');
|
110 |
+
if (sendEmailCheckbox) {
|
111 |
+
var notifyCustomerCheckbox = $('notify_customer');
|
112 |
+
var shipmentCommentText = $('shipment_comment_text');
|
113 |
+
Event.observe(sendEmailCheckbox, 'change', bindSendEmail);
|
114 |
+
bindSendEmail();
|
115 |
+
}
|
116 |
+
|
117 |
+
function bindSendEmail()
|
118 |
+
{
|
119 |
+
if (sendEmailCheckbox.checked == true) {
|
120 |
+
notifyCustomerCheckbox.disabled = false;
|
121 |
+
//shipmentCommentText.disabled = false;
|
122 |
+
}
|
123 |
+
else {
|
124 |
+
notifyCustomerCheckbox.disabled = true;
|
125 |
+
//shipmentCommentText.disabled = true;
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
function toggleCreateLabelCheckbox(){
|
130 |
+
var checkbox = $('create_shipping_label');
|
131 |
+
var submitButton = checkbox.up('.order-totals').select('.submit-button span')[0];
|
132 |
+
if (checkbox.checked) {
|
133 |
+
submitButton.innerText += '...';
|
134 |
+
} else {
|
135 |
+
submitButton.innerText = submitButton.innerText.replace(/\.\.\.$/, '');
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
function submitShipment(btn)
|
140 |
+
{
|
141 |
+
if ($('no_generar_envio') != null)
|
142 |
+
{
|
143 |
+
var marca_nogenerarenvio = 0;
|
144 |
+
if ($('no_generar_envio').checked)
|
145 |
+
{
|
146 |
+
marca_nogenerarenvio = "1";
|
147 |
+
}
|
148 |
+
|
149 |
+
$('shipment_comment_text').value = marca_nogenerarenvio + $('shipment_comment_text').value;
|
150 |
+
}
|
151 |
+
|
152 |
+
var checkbox = $(btn).up('.order-totals').select('#create_shipping_label')[0];
|
153 |
+
if (checkbox && checkbox.checked)
|
154 |
+
{
|
155 |
+
packaging.showWindow();
|
156 |
+
}
|
157 |
+
else if (editForm.submit())
|
158 |
+
{
|
159 |
+
disableElements('submit-button');
|
160 |
+
}
|
161 |
+
}
|
162 |
+
//]]>
|
163 |
+
</script>
|
app/design/frontend/base/default/layout/zeleris_puntosentrega.xml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<layout version="0.1.0">
|
4 |
+
|
5 |
+
<checkout_onepage_index>
|
6 |
+
<reference name="checkout.onepage.shipping">
|
7 |
+
<action method="setTemplate">
|
8 |
+
<template>zeleris/puntosentrega/checkout/onepage/shipping.phtml</template>
|
9 |
+
</action>
|
10 |
+
</reference>
|
11 |
+
<reference name="checkout.onepage.shipping_method">
|
12 |
+
<action method="setTemplate">
|
13 |
+
<template>zeleris/puntosentrega/checkout/onepage/shipping_method.phtml</template>
|
14 |
+
</action>
|
15 |
+
</reference>
|
16 |
+
</checkout_onepage_index>
|
17 |
+
|
18 |
+
<checkout_onepage_shippingmethod>
|
19 |
+
<reference name="root">
|
20 |
+
<action method="setTemplate">
|
21 |
+
<template>zeleris/puntosentrega/checkout/onepage/shipping_method/available.phtml</template>
|
22 |
+
</action>
|
23 |
+
</reference>
|
24 |
+
</checkout_onepage_shippingmethod>
|
25 |
+
</layout>
|
app/design/frontend/base/default/template/zeleris/puntosentrega/checkout/onepage/shipping.phtml
ADDED
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<form action="" id="co-shipping-form">
|
28 |
+
<ul class="form-list">
|
29 |
+
<?php if ($this->customerHasAddresses()): ?>
|
30 |
+
<li class="wide">
|
31 |
+
<label for="shipping-address-select"><?php echo $this->__('Select a shipping address from your address book or enter a new address.') ?></label>
|
32 |
+
<div class="input-box">
|
33 |
+
<?php echo $this->getAddressesHtmlSelect('shipping') ?>
|
34 |
+
</div>
|
35 |
+
</li>
|
36 |
+
<?php endif ?>
|
37 |
+
<li id="shipping-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif ?>>
|
38 |
+
<fieldset>
|
39 |
+
<input type="hidden" name="shipping[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="shipping:address_id" />
|
40 |
+
<ul>
|
41 |
+
<li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress())->setFieldIdFormat('shipping:%s')->setFieldNameFormat('shipping[%s]')->setFieldParams('onchange="shipping.setSameAsBilling(false)"')->toHtml() ?></li>
|
42 |
+
<li class="fields">
|
43 |
+
<div class="fields">
|
44 |
+
<label for="shipping:company"><?php echo $this->__('Company') ?></label>
|
45 |
+
<div class="input-box">
|
46 |
+
<input type="text" id="shipping:company" name="shipping[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" onchange="shipping.setSameAsBilling(false);" />
|
47 |
+
</div>
|
48 |
+
</div>
|
49 |
+
</li>
|
50 |
+
<?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
|
51 |
+
<li class="wide">
|
52 |
+
<label for="shipping:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
|
53 |
+
<div class="input-box">
|
54 |
+
<input type="text" title="<?php echo $this->__('Street Address') ?>" name="shipping[street][]" id="shipping:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" />
|
55 |
+
</div>
|
56 |
+
</li>
|
57 |
+
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
|
58 |
+
<?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
|
59 |
+
<li class="wide">
|
60 |
+
<div class="input-box">
|
61 |
+
<input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="shipping[street][]" id="shipping:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" />
|
62 |
+
</div>
|
63 |
+
</li>
|
64 |
+
<?php endfor; ?>
|
65 |
+
<?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
|
66 |
+
<li class="wide">
|
67 |
+
<label for="billing:vat_id"><?php echo $this->__('VAT Number'); ?></label>
|
68 |
+
<div class="input-box">
|
69 |
+
<input type="text" id="shipping:vat_id" name="shipping[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()); ?>" title="<?php echo $this->__('VAT Number'); ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
|
70 |
+
</div>
|
71 |
+
</li>
|
72 |
+
<?php endif; ?>
|
73 |
+
<li class="fields">
|
74 |
+
<div class="field">
|
75 |
+
<label for="shipping:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
|
76 |
+
<div class="input-box">
|
77 |
+
<input type="text" title="<?php echo $this->__('City') ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
|
78 |
+
</div>
|
79 |
+
</div>
|
80 |
+
<div class="field">
|
81 |
+
<label for="shipping:region" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
|
82 |
+
<div class="input-box">
|
83 |
+
<select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
|
84 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
85 |
+
</select>
|
86 |
+
<script type="text/javascript">
|
87 |
+
//<![CDATA[
|
88 |
+
$('shipping:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
89 |
+
//]]>
|
90 |
+
</script>
|
91 |
+
<input type="text" id="shipping:region" name="shipping[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
|
92 |
+
</div>
|
93 |
+
</div>
|
94 |
+
</li>
|
95 |
+
<li class="fields">
|
96 |
+
<div class="field">
|
97 |
+
<label for="shipping:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
|
98 |
+
<div class="input-box">
|
99 |
+
<input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="shipping[postcode]" id="shipping:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" onchange="shipping.setSameAsBilling(false);" />
|
100 |
+
</div>
|
101 |
+
</div>
|
102 |
+
<div class="field">
|
103 |
+
<label for="shipping:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
|
104 |
+
<div class="input-box">
|
105 |
+
<?php echo $this->getCountryHtmlSelect('shipping') ?>
|
106 |
+
</div>
|
107 |
+
</div>
|
108 |
+
</li>
|
109 |
+
<li class="fields">
|
110 |
+
<div class="field">
|
111 |
+
<label for="shipping:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
|
112 |
+
<div class="input-box">
|
113 |
+
<input type="text" name="shipping[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="shipping:telephone" onchange="shipping.setSameAsBilling(false);" />
|
114 |
+
</div>
|
115 |
+
</div>
|
116 |
+
<div class="field">
|
117 |
+
<label for="shipping:fax"><?php echo $this->__('Fax') ?></label>
|
118 |
+
<div class="input-box">
|
119 |
+
<input type="text" name="shipping[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="shipping:fax" onchange="shipping.setSameAsBilling(false);" />
|
120 |
+
</div>
|
121 |
+
</div>
|
122 |
+
</li>
|
123 |
+
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
|
124 |
+
<li class="control">
|
125 |
+
<input type="checkbox" name="shipping[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="shipping:save_in_address_book" onchange="shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="shipping:save_in_address_book"><?php echo $this->__('Save in address book') ?></label></li>
|
126 |
+
<?php else:?>
|
127 |
+
<li class="no-display"><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>
|
128 |
+
<?php endif;?>
|
129 |
+
</ul>
|
130 |
+
</fieldset>
|
131 |
+
</li>
|
132 |
+
<li class="control">
|
133 |
+
<input type="checkbox" name="shipping[same_as_billing]" id="shipping:same_as_billing" value="1"<?php if($this->getAddress()->getSameAsBilling()): ?> checked="checked"<?php endif; ?> title="<?php echo $this->__('Use Billing Address') ?>" onclick="shipping.setSameAsBilling(this.checked)" class="checkbox" /><label for="shipping:same_as_billing"><?php echo $this->__('Use Billing Address') ?></label>
|
134 |
+
</li>
|
135 |
+
</ul>
|
136 |
+
<div class="buttons-set" id="shipping-buttons-container">
|
137 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
138 |
+
<p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>« </small><?php echo $this->__('Back') ?></a></p>
|
139 |
+
<button type="button" class="button" title="<?php echo $this->__('Continue') ?>" onclick="validar_seleccion_metodo(); shipping.save();"><span><span><?php echo $this->__('Continue') ?></span></span></button>
|
140 |
+
<span id="shipping-please-wait" class="please-wait" style="display:none;">
|
141 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
|
142 |
+
</span>
|
143 |
+
</div>
|
144 |
+
</form>
|
145 |
+
<script type="text/javascript">
|
146 |
+
//<![CDATA[
|
147 |
+
var shipping = new Shipping('co-shipping-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveShipping') ?>',
|
148 |
+
'<?php echo $this->getUrl('checkout/onepage/shippingMethod') ?>');
|
149 |
+
var shippingForm = new VarienForm('co-shipping-form');
|
150 |
+
shippingForm.extraChildParams = ' onchange="shipping.setSameAsBilling(false);"';
|
151 |
+
//shippingForm.setElementsRelation('shipping:country_id', 'shipping:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
|
152 |
+
$('shipping-address-select') && shipping.newAddress(!$('shipping-address-select').value);
|
153 |
+
|
154 |
+
var shippingRegionUpdater = new RegionUpdater('shipping:country_id', 'shipping:region', 'shipping:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'shipping:postcode');
|
155 |
+
//]]>
|
156 |
+
</script>
|
157 |
+
<script type="text/javascript">
|
158 |
+
function validar_seleccion_metodo()
|
159 |
+
{
|
160 |
+
var methods = document.getElementsByName("shipping_method");
|
161 |
+
var seleccionado = false;
|
162 |
+
|
163 |
+
if (methods.length > 0)
|
164 |
+
{
|
165 |
+
for (var i = 0; i < methods.length; i++)
|
166 |
+
if (methods[i].checked)
|
167 |
+
{
|
168 |
+
seleccionado = true;
|
169 |
+
|
170 |
+
if (methods[i].value == "ZELERISShipping_Puntos de entrega")
|
171 |
+
if (document.getElementById("shipping:company").value != document.getElementById("nombre_id_punto").innerText ||
|
172 |
+
document.getElementById("shipping:street1").value != document.getElementById("dir_punto").innerText ||
|
173 |
+
document.getElementById("shipping:street2").value != "" ||
|
174 |
+
(document.getElementById("shipping:postcode").value + " " + document.getElementById("shipping:city").value) != document.getElementById("cp_pob_punto").innerText)
|
175 |
+
{
|
176 |
+
document.getElementById("idpunto").value = "";
|
177 |
+
document.getElementById("nombre_id_punto").innerHTML = "";
|
178 |
+
document.getElementById("dir_punto").innerHTML = "";
|
179 |
+
document.getElementById("cp_pob_punto").innerHTML = "";
|
180 |
+
|
181 |
+
document.getElementById("info_punto").style.display = "none";
|
182 |
+
document.getElementById("seleccion_punto").style.display = "none";
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
if (!seleccionado)
|
187 |
+
if (document.getElementById("idpunto").value != "")
|
188 |
+
if (document.getElementById("shipping:company").value != document.getElementById("nombre_id_punto").innerText ||
|
189 |
+
document.getElementById("shipping:street1").value != document.getElementById("dir_punto").innerText ||
|
190 |
+
document.getElementById("shipping:street2").value != "" ||
|
191 |
+
(document.getElementById("shipping:postcode").value + " " + document.getElementById("shipping:city").value) != document.getElementById("cp_pob_punto").innerText)
|
192 |
+
{
|
193 |
+
document.getElementById("idpunto").value = "";
|
194 |
+
document.getElementById("nombre_id_punto").innerHTML = "";
|
195 |
+
document.getElementById("dir_punto").innerHTML = "";
|
196 |
+
document.getElementById("cp_pob_punto").innerHTML = "";
|
197 |
+
|
198 |
+
document.getElementById("info_punto").style.display = "none";
|
199 |
+
document.getElementById("seleccion_punto").style.display = "none";
|
200 |
+
}
|
201 |
+
}
|
202 |
+
return false;
|
203 |
+
}
|
204 |
+
</script>
|
app/design/frontend/base/default/template/zeleris/puntosentrega/checkout/onepage/shipping_method.phtml
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<form id="co-shipping-method-form" action="">
|
28 |
+
<input type="hidden" id="idpunto" name="idpunto" />
|
29 |
+
<div id="checkout-shipping-method-load">
|
30 |
+
<?php echo $this->getChildHtml('available') ?>
|
31 |
+
</div>
|
32 |
+
<script type="text/javascript">
|
33 |
+
//<![CDATA[
|
34 |
+
var shippingMethod = new ShippingMethod('co-shipping-method-form', "<?php echo $this->getUrl('checkout/onepage/saveShippingMethod') ?>");
|
35 |
+
//]]>
|
36 |
+
</script>
|
37 |
+
<script type="text/javascript">
|
38 |
+
function seleccionar_punto()
|
39 |
+
{
|
40 |
+
var serverprotocol = "<?php echo substr($_SERVER['SERVER_PROTOCOL'], 0, 5) ?>";
|
41 |
+
|
42 |
+
if (serverprotocol != "https")
|
43 |
+
serverprotocol = "http";
|
44 |
+
|
45 |
+
var backurl = serverprotocol + "://" + "<?php echo $_SERVER['SERVER_NAME'] ?>" + ":" + "<?php echo $_SERVER['SERVER_PORT'] ?>" + "/magento/app/design/frontend/base/default/template/zeleris/puntosentrega/puntosentrega.php?";
|
46 |
+
|
47 |
+
var dir_street = document.getElementById("shipping:street1").value + " " + document.getElementById("shipping:street2").value;
|
48 |
+
var dir_postcode = document.getElementById("shipping:postcode").value;
|
49 |
+
var dir_city = document.getElementById("shipping:city").value;
|
50 |
+
|
51 |
+
var cadena = "http://locateandselect.kiala.com/search?dspid=DEMO_DSP&country=es&language=es&preparationdelay=2&street=" + dir_street + "&zip=" + dir_postcode + "&city=" + dir_city + "&bckUrl=" + encodeURIComponent(backurl) + "&map-controls=off";
|
52 |
+
|
53 |
+
var method = null;
|
54 |
+
var methods = document.getElementsByName("shipping_method");
|
55 |
+
|
56 |
+
for (var i = 0; i < methods.length; i++)
|
57 |
+
{
|
58 |
+
if (methods[i].checked)
|
59 |
+
{
|
60 |
+
method = methods[i].value;
|
61 |
+
break;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
if (method == "ZELERISShipping_Puntos de entrega")
|
66 |
+
{
|
67 |
+
window.open(cadena, "_kiala", "width=700, height= 600", true);
|
68 |
+
}
|
69 |
+
else
|
70 |
+
{
|
71 |
+
alert("Debe marcar punto de entrega para poder seleccionar uno");
|
72 |
+
}
|
73 |
+
|
74 |
+
return false;
|
75 |
+
}
|
76 |
+
|
77 |
+
function validar_formulario()
|
78 |
+
{
|
79 |
+
var method = null;
|
80 |
+
var methods = document.getElementsByName("shipping_method");
|
81 |
+
|
82 |
+
for (var i = 0; i < methods.length; i++)
|
83 |
+
{
|
84 |
+
if (methods[i].checked)
|
85 |
+
{
|
86 |
+
method = methods[i].value;
|
87 |
+
break;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
if (method != null)
|
92 |
+
{
|
93 |
+
if (method == "ZELERISShipping_Puntos de entrega")
|
94 |
+
{
|
95 |
+
if (document.getElementById("idpunto").value == "")
|
96 |
+
{
|
97 |
+
alert("Seleccione un punto de entrega");
|
98 |
+
document.getElementById("seleccion_punto").style.display = "block";
|
99 |
+
}
|
100 |
+
else
|
101 |
+
{
|
102 |
+
shippingMethod.save();
|
103 |
+
}
|
104 |
+
}
|
105 |
+
else
|
106 |
+
{
|
107 |
+
if (document.getElementById("idpunto").value != "")
|
108 |
+
{
|
109 |
+
alert("La direcci\u00f3n de entrega ser\u00e1 la indicada anteriormente");
|
110 |
+
|
111 |
+
document.getElementById("idpunto").value = "";
|
112 |
+
document.getElementById("nombre_id_punto").innerHTML = "";
|
113 |
+
document.getElementById("dir_punto").innerHTML = "";
|
114 |
+
document.getElementById("cp_pob_punto").innerHTML = "";
|
115 |
+
document.getElementById("info_punto").style.display = "none";
|
116 |
+
document.getElementById("seleccion_punto").style.display = "none";
|
117 |
+
|
118 |
+
shippingMethod.save();
|
119 |
+
}
|
120 |
+
else
|
121 |
+
{
|
122 |
+
shippingMethod.save();
|
123 |
+
}
|
124 |
+
}
|
125 |
+
}
|
126 |
+
else
|
127 |
+
{
|
128 |
+
if (document.getElementById("idpunto") != "" && document.getElementById("info_punto").style.display != "none")
|
129 |
+
{
|
130 |
+
document.getElementById("s_method_ZELERISShipping_Puntos de entrega").checked = true;
|
131 |
+
shippingMethod.save();
|
132 |
+
}
|
133 |
+
else
|
134 |
+
{
|
135 |
+
alert("Seleccione un servicio");
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
return false;
|
140 |
+
}
|
141 |
+
|
142 |
+
</script>
|
143 |
+
<div id="onepage-checkout-shipping-method-additional-load">
|
144 |
+
<?php echo $this->getChildHtml('additional') ?>
|
145 |
+
</div>
|
146 |
+
<div id="info_punto" style="display:none;">
|
147 |
+
<span id="nombre_id_punto"></span><br>
|
148 |
+
<span id="dir_punto"></span><br>
|
149 |
+
<span id="cp_pob_punto"></span>
|
150 |
+
</div>
|
151 |
+
<div id="seleccion_punto" style="display:none;">
|
152 |
+
<button type="button" onclick="seleccionar_punto();"><span><span><?php echo $this->__('Seleccionar punto') ?></span></span></button>
|
153 |
+
</div>
|
154 |
+
<div class="buttons-set" id="shipping-method-buttons-container">
|
155 |
+
<p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>« </small><?php echo $this->__('Back') ?></a></p>
|
156 |
+
<button type="button" class="button" onclick="validar_formulario();"><span><span><?php echo $this->__('Continue') ?></span></span></button>
|
157 |
+
<span id="shipping-method-please-wait" class="please-wait" style="display:none;">
|
158 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
|
159 |
+
</span>
|
160 |
+
</div>
|
161 |
+
</form>
|
app/design/frontend/base/default/template/zeleris/puntosentrega/checkout/onepage/shipping_method/available.phtml
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-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 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php /** @var $this Mage_Checkout_Block_Onepage_Shipping_Method_Available */ ?>
|
28 |
+
<?php $_shippingRateGroups = $this->getShippingRates(); ?>
|
29 |
+
<?php if (!$_shippingRateGroups): ?>
|
30 |
+
<p><?php echo $this->__('Sorry, no quotes are available for this order at this time.') ?></p>
|
31 |
+
<?php else: ?>
|
32 |
+
<dl class="sp-methods">
|
33 |
+
<?php $shippingCodePrice = array(); ?>
|
34 |
+
<?php $_sole = count($_shippingRateGroups) == 1; foreach ($_shippingRateGroups as $code => $_rates): ?>
|
35 |
+
<dt><?php echo $this->escapeHtml($this->getCarrierName($code)) ?></dt>
|
36 |
+
<dd>
|
37 |
+
<ul>
|
38 |
+
<?php $_sole = $_sole && count($_rates) == 1; foreach ($_rates as $_rate): ?>
|
39 |
+
<?php $shippingCodePrice[] = "'".$_rate->getCode()."':".(float)$_rate->getPrice(); ?>
|
40 |
+
<li>
|
41 |
+
<?php if ($_rate->getErrorMessage()): ?>
|
42 |
+
<ul class="messages"><li class="error-msg"><ul><li><?php echo $this->escapeHtml($_rate->getErrorMessage()) ?></li></ul></li></ul>
|
43 |
+
<?php else: ?>
|
44 |
+
<?php if ($_sole) : ?>
|
45 |
+
<span class="no-display"><input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>" checked="checked" /></span>
|
46 |
+
<?php else: ?>
|
47 |
+
<input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio"/>
|
48 |
+
|
49 |
+
<?php if ($_rate->getCode() === $this->getAddressShippingMethod()): ?>
|
50 |
+
<script type="text/javascript">
|
51 |
+
//<![CDATA[
|
52 |
+
lastPrice = <?php echo (float)$_rate->getPrice(); ?>;
|
53 |
+
//]]>
|
54 |
+
</script>
|
55 |
+
<?php endif; ?>
|
56 |
+
|
57 |
+
<?php endif; ?>
|
58 |
+
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $this->escapeHtml($_rate->getMethodTitle()) ?>
|
59 |
+
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
|
60 |
+
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
|
61 |
+
<?php echo $_excl; ?>
|
62 |
+
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
63 |
+
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
64 |
+
<?php endif; ?>
|
65 |
+
</label>
|
66 |
+
<?php endif ?>
|
67 |
+
</li>
|
68 |
+
<?php endforeach; ?>
|
69 |
+
</ul>
|
70 |
+
</dd>
|
71 |
+
<?php endforeach; ?>
|
72 |
+
</dl>
|
73 |
+
<script type="text/javascript">
|
74 |
+
//<![CDATA[
|
75 |
+
<?php if (!empty($shippingCodePrice)): ?>
|
76 |
+
var shippingCodePrice = {<?php echo implode(',',$shippingCodePrice); ?>};
|
77 |
+
<?php endif; ?>
|
78 |
+
|
79 |
+
$$('input[type="radio"][name="shipping_method"]').each(function(el){
|
80 |
+
Event.observe(el, 'click', function(){
|
81 |
+
if (el.checked == true)
|
82 |
+
{
|
83 |
+
|
84 |
+
if (el.value == "ZELERISShipping_Puntos de entrega")
|
85 |
+
{
|
86 |
+
document.getElementById("seleccion_punto").style.display = "block";
|
87 |
+
}
|
88 |
+
else
|
89 |
+
{
|
90 |
+
if (document.getElementById("idpunto").value != "")
|
91 |
+
{
|
92 |
+
var respuesta;
|
93 |
+
respuesta = confirm("Al cambiar de servicio es necesario introducir de nuevo la direcci\u00f3n de entrega.\n\xbfDesea continuar\?");
|
94 |
+
|
95 |
+
if (respuesta)
|
96 |
+
{
|
97 |
+
document.getElementById("idpunto").value = "";
|
98 |
+
document.getElementById("nombre_id_punto").innerHTML = "";
|
99 |
+
document.getElementById("dir_punto").innerHTML = "";
|
100 |
+
document.getElementById("cp_pob_punto").innerHTML = "";
|
101 |
+
|
102 |
+
document.getElementById("info_punto").style.display = "none";
|
103 |
+
document.getElementById("seleccion_punto").style.display = "none";
|
104 |
+
|
105 |
+
document.getElementById("shipping:company").value = "";
|
106 |
+
document.getElementById("shipping:street1").value = "";
|
107 |
+
document.getElementById("shipping:street2").value = "";
|
108 |
+
document.getElementById("shipping:city").value = "";
|
109 |
+
document.getElementById("shipping:postcode").value = "";
|
110 |
+
document.getElementById("shipping:same_as_billing").checked = false;
|
111 |
+
|
112 |
+
checkout.back();
|
113 |
+
}
|
114 |
+
else
|
115 |
+
{
|
116 |
+
document.getElementById("s_method_ZELERISShipping_Puntos de entrega").checked = true;
|
117 |
+
}
|
118 |
+
}
|
119 |
+
else
|
120 |
+
{
|
121 |
+
document.getElementById("seleccion_punto").style.display = "none";
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
var getShippingCode = el.getValue();
|
126 |
+
<?php if (!empty($shippingCodePrice)): ?>
|
127 |
+
var newPrice = shippingCodePrice[getShippingCode];
|
128 |
+
if (!lastPrice) {
|
129 |
+
lastPrice = newPrice;
|
130 |
+
quoteBaseGrandTotal += newPrice;
|
131 |
+
}
|
132 |
+
if (newPrice != lastPrice) {
|
133 |
+
quoteBaseGrandTotal += (newPrice-lastPrice);
|
134 |
+
lastPrice = newPrice;
|
135 |
+
}
|
136 |
+
<?php endif; ?>
|
137 |
+
checkQuoteBaseGrandTotal = quoteBaseGrandTotal;
|
138 |
+
return false;
|
139 |
+
}
|
140 |
+
});
|
141 |
+
});
|
142 |
+
//]]>
|
143 |
+
</script>
|
144 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/zeleris/puntosentrega/puntosentrega.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/***********************************************************************************************************************************************************/
|
4 |
+
/******************************************************************* Versi�n 2.0.0 de marzo de 2013 ******************************************************/
|
5 |
+
/***********************************************************************************************************************************************************/
|
6 |
+
|
7 |
+
echo "<body onLoad=\"javascript:devolver_idpunto();\">";
|
8 |
+
|
9 |
+
|
10 |
+
echo "<script language=\"JavaScript\">";
|
11 |
+
echo "function devolver_idpunto()";
|
12 |
+
echo "{ ";
|
13 |
+
|
14 |
+
echo " var idPunto = \"". $_GET['shortkpid']. "\";";
|
15 |
+
|
16 |
+
echo " if (idPunto != \"\")";
|
17 |
+
echo " idPunto = \"#\" + idPunto + \"#\";";
|
18 |
+
|
19 |
+
echo " if (window.opener.document.getElementById(\"shipping-address-select\") != null)";
|
20 |
+
echo " window.opener.document.getElementById(\"shipping-address-select\").value = \"\";";
|
21 |
+
|
22 |
+
echo " window.opener.document.getElementById(\"shipping:company\").value = idPunto + \"". $_GET['kpname']. "\";";
|
23 |
+
echo " window.opener.document.getElementById(\"shipping:street1\").value = \"". $_GET['street']. "\";";
|
24 |
+
echo " window.opener.document.getElementById(\"shipping:street2\").value = \"\";";
|
25 |
+
echo " window.opener.document.getElementById(\"shipping:city\").value = \"". $_GET['city']. "\";";
|
26 |
+
echo " window.opener.document.getElementById(\"shipping:postcode\").value = \"". $_GET['zip']. "\";";
|
27 |
+
echo " window.opener.document.getElementById(\"shipping:same_as_billing\").checked = false;";
|
28 |
+
|
29 |
+
echo " window.opener.document.getElementById(\"idpunto\").value = \"". $_GET['shortkpid']. "\";";
|
30 |
+
echo " window.opener.document.getElementById(\"nombre_id_punto\").innerHTML = \"#". $_GET['shortkpid']. "#". $_GET['kpname']. "\";";
|
31 |
+
echo " window.opener.document.getElementById(\"dir_punto\").innerHTML = \"". $_GET['street']. "\";";
|
32 |
+
echo " window.opener.document.getElementById(\"cp_pob_punto\").innerHTML = \"". $_GET['zip']. " ". $_GET['city']. "\";";
|
33 |
+
echo " window.opener.document.getElementById(\"info_punto\").style.display = \"inline\";";
|
34 |
+
|
35 |
+
echo " window.opener.shipping.save();";
|
36 |
+
|
37 |
+
echo " var inicio = (new Date()).getTime();";
|
38 |
+
echo " while ((new Date()).getTime() - inicio <= 10000) ";
|
39 |
+
echo " {";
|
40 |
+
echo " var methods = window.opener.document.getElementsByName(\"shipping_method\");";
|
41 |
+
echo " var seleccionado = false;";
|
42 |
+
|
43 |
+
echo " for (var i = 0; i < methods.length; i++)";
|
44 |
+
echo " if (methods[i].checked)";
|
45 |
+
echo " {";
|
46 |
+
echo " seleccionado = true;";
|
47 |
+
echo " break;";
|
48 |
+
echo " }";
|
49 |
+
|
50 |
+
echo " if (!seleccionado)";
|
51 |
+
echo " {";
|
52 |
+
echo " window.opener.document.getElementById(\"s_method_ZELERISShipping_Puntos de entrega\").checked = true;";
|
53 |
+
echo " break;";
|
54 |
+
echo " }";
|
55 |
+
echo " }";
|
56 |
+
|
57 |
+
echo " window.opener.document.getElementById(\"s_method_ZELERISShipping_Puntos de entrega\").checked = true;";
|
58 |
+
|
59 |
+
echo " window.close();";
|
60 |
+
echo " return false;";
|
61 |
+
echo "} ";
|
62 |
+
echo "</script>";
|
63 |
+
echo "</body>";
|
64 |
+
?>
|
65 |
+
|
66 |
+
|
app/etc/modules/ZELERIS_ZELERISShipping.xml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<ZELERIS_ZELERISShipping>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</ZELERIS_ZELERISShipping>
|
8 |
+
<ZELERIS_ZELERISShipping_Function>
|
9 |
+
<active>true</active>
|
10 |
+
<codePool>local</codePool>
|
11 |
+
</ZELERIS_ZELERISShipping_Function>
|
12 |
+
</modules>
|
13 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>ZelerisEcommerce</name>
|
4 |
+
<version>2.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.zeleris.com">Zeleris</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>El módulo de Zeleris permite una integración sencilla de la tienda con el Sistema de Transporte Zeleris.</summary>
|
10 |
+
<description>Entre las funcionalidades del Módulo destacan:
|
11 |
+

|
12 |
+
- Parametrización flexible de servicios estándar y urgente.
|
13 |
+
- Servicios nacionales e internacionales.
|
14 |
+
- Configuración de precios de transporte.
|
15 |
+
- Asignación de costes de manipulado.
|
16 |
+
- Fijación de importes de compra a partir de los cuales el transporte es gratuito.
|
17 |
+
- Gestión de pagos contrareembolso.
|
18 |
+

|
19 |
+
Para información adicional sobre el módulo así como cuestiones relacionadas con su instalación o puesta en funcionamiento puede enviar un correo a la dirección info.cac@zeleris.com. Le recordamos que para poder utilizar este módulo es necesario estar dado de alta como cliente de Zeleris.</description>
|
20 |
+
<notes>Zeleris ecommerce (sólo clientes Zeleris).</notes>
|
21 |
+
<authors><author><name>zeleris</name><user>zeleris</user><email>miguel.reygondaud@telefonica.com</email></author></authors>
|
22 |
+
<date>2013-10-08</date>
|
23 |
+
<time>16:28:49</time>
|
24 |
+
<contents><target name="magelocal"><dir name="ZELERIS"><dir name="ZELERISShipping"><dir name="Adminhtml"><dir name="Block"><dir name="Sales"><dir name="Order"><dir name="Shipment"><file name="View.php" hash="764cce4c57a2797cb8ff93ff8e6c3021"/></dir></dir></dir></dir></dir><dir name="Function"><dir name="FlatRate"><file name="Data.php" hash="c7c291d9486da259a9363c1c2bad9fcd"/></dir><dir name="TableRate"><file name="Data.php" hash="0b8e1bda54698cbb408767922701a71f"/></dir><dir name="etc"><file name="config.xml" hash="fcab25cb9c31c363b7aff9f83cb0debb"/></dir></dir><dir name="Model"><dir name="ZELERIS"><file name="Shipment.php" hash="20533088f8954732ec2b63507f7b26b7"/><dir name="Source"><file name="Method.php" hash="b8e856be9ba689fe895b9462e152cab0"/><file name="Modo.php" hash="9a29439f5f06b84b908af67d3c8ed553"/><file name="servicios.xml" hash="64f2dea0e7c14290925e28c27d9225a7"/></dir><file name="ZELERISShipping.php" hash="c42a26917acd6641610d58254cb1341f"/></dir></dir><dir name="etc"><file name="config.xml" hash="bd33315795750820fd8c8db886ddd7d4"/><file name="system.xml" hash="e4e89170e5f9ac2bce7b23b265ec87ea"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="zeleris_sales.xml" hash="2a69bb214fbce985aa001a6eac0b0cb1"/></dir><dir name="template"><dir name="zeleris"><dir name="sales"><dir name="order"><dir name="shipment"><dir name="create"><file name="items.phtml" hash="391139646e63e4efa51b0ac8999ac5db"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="zeleris_puntosentrega.xml" hash="2d2cf02142fdb03f8e7f5d68af3e00fd"/></dir><dir name="template"><dir name="zeleris"><dir name="puntosentrega"><dir name="checkout"><dir name="onepage"><file name="shipping.phtml" hash="1a0585b3a7cd5ad719c0e5b8920d1041"/><dir name="shipping_method"><file name="available.phtml" hash="43a6209666d35703196679ce44d51949"/></dir><file name="shipping_method.phtml" hash="3437266522ab16bc5f6480d54b4f298b"/></dir></dir><file name="puntosentrega.php" hash="2732f18287c63d7787415b23f6dbcff2"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ZELERIS_ZELERISShipping.xml" hash="a2ec18161b147338401305ef2cb8c70d"/></dir></target></contents>
|
25 |
+
<compatible/>
|
26 |
+
<dependencies><required><php><min>5.0.1</min><max>5.5.4</max></php></required></dependencies>
|
27 |
+
</package>
|