Changeset 1788951
- Timestamp:
- 12/18/2017 04:09:19 PM (8 years ago)
- Location:
- woo-oca
- Files:
-
- 27 added
- 3 edited
-
tags/1.2 (added)
-
tags/1.2/LICENSE (added)
-
tags/1.2/etiquetas (added)
-
tags/1.2/etiquetas/ver_eti.php (added)
-
tags/1.2/js (added)
-
tags/1.2/js/oca.js (added)
-
tags/1.2/oca (added)
-
tags/1.2/oca-class.php (added)
-
tags/1.2/oca-shipping.php (added)
-
tags/1.2/oca-utilities.php (added)
-
tags/1.2/oca/autoload.php (added)
-
tags/1.2/oca/composer (added)
-
tags/1.2/oca/composer/ClassLoader.php (added)
-
tags/1.2/oca/composer/LICENSE (added)
-
tags/1.2/oca/composer/autoload_classmap.php (added)
-
tags/1.2/oca/composer/autoload_namespaces.php (added)
-
tags/1.2/oca/composer/autoload_psr4.php (added)
-
tags/1.2/oca/composer/autoload_real.php (added)
-
tags/1.2/oca/composer/autoload_static.php (added)
-
tags/1.2/oca/composer/installed.json (added)
-
tags/1.2/oca/juanchorossi (added)
-
tags/1.2/oca/juanchorossi/oca-php-api (added)
-
tags/1.2/oca/juanchorossi/oca-php-api/README.md (added)
-
tags/1.2/oca/juanchorossi/oca-php-api/composer.json (added)
-
tags/1.2/oca/juanchorossi/oca-php-api/oca.php (added)
-
tags/1.2/readme.txt (added)
-
tags/1.2/woocommerce-oca.php (added)
-
trunk/oca-utilities.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/woocommerce-oca.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woo-oca/trunk/oca-utilities.php
r1787831 r1788951 14 14 function woo_oca_rastreo_oca_func( $atts, $content= NULL) { 15 15 if($_POST['id']){ 16 $post_data = [ "CodigoPostal" => intval($_POST['id']) ]; 16 $oca_id = filter_var ($_POST['id'], FILTER_SANITIZE_NUMBER_INT); 17 $_query_string = array( 'Pieza' => $oca_id, 18 'NroDocumentoCliente' => '', 19 'Cuit' => '', 20 ); 21 $ch = curl_init(); 22 $curl_opt_arr[CURLOPT_POST] = true; 23 $curl_opt_arr[CURLOPT_POSTFIELDS] = http_build_query($_query_string); 24 $curl_opt_arr[CURLOPT_RETURNTRANSFER] = true; 25 $curl_opt_arr[CURLOPT_HEADER] = false; 26 $curl_opt_arr[CURLOPT_URL] = "webservice.oca.com.ar/epak_tracking/Oep_TrackEPak.asmx/Tracking_Pieza"; 27 curl_setopt_array($ch, $curl_opt_arr); 28 $res = curl_exec($ch); 29 $dom = new DOMDocument(); 30 @$dom->loadXML($res); 31 $xpath = new DOMXpath($dom); 32 $envio = array(); 33 foreach (@$xpath->query("//NewDataSet/Table") as $tp) 34 { 35 36 $envio[] = array("NumeroEnvio"=>$tp->getElementsByTagName('NumeroEnvio')->item(0)->nodeValue, 37 "Descripcion_Motivo"=>$tp->getElementsByTagName('Descripcion_Motivo')->item(0)->nodeValue, 38 "Desdcripcion_Estado"=>$tp->getElementsByTagName('Desdcripcion_Estado')->item(0)->nodeValue, 39 "SUC"=>$tp->getElementsByTagName('SUC')->item(0)->nodeValue, 40 "fecha"=>$tp->getElementsByTagName('fecha')->item(0)->nodeValue, 41 ); 42 } 43 44 ob_start(); 45 if($envio[0]['SUC']){ 46 echo '<h3>Envío Nro: '.$envio[0]['NumeroEnvio'].'</h3>'; 47 echo "<table>"; 48 echo "<tr>"; 49 echo "<td>Estado</td>"; 50 echo "<td>".$envio[0]['Desdcripcion_Estado']."</td>"; 51 echo "</tr>"; 52 echo "<tr>"; 53 echo "<td>Sucursal</td>"; 54 echo "<td>".$envio[0]['SUC']."</td>"; 55 echo "</tr>"; 56 echo "<tr>"; 57 echo "<td>Fecha</td>"; 58 echo "<td>".$envio[0]['fecha']."</td>"; 59 echo "</tr>"; 60 echo "</table>"; 61 }else{ 62 wc_print_notice( __( 'Hubo un error, por favor intenta nuevamente', 'woocommerce' ), 'error' ); 63 } 64 return ob_get_clean(); 65 66 } 67 } 68 69 70 71 72 // ========================================================================= 73 /** 74 * Shortcode [sucursales_oca] 75 * 76 */ 77 add_shortcode ( 'sucursales_oca' , 'woo_oca_sucursales_oca_func' ); 78 function woo_oca_sucursales_oca_func( $atts, $content= NULL) { 79 if($_POST['cp']){ 80 $post_data = [ "CodigoPostal" => intval($_POST['cp']) ]; 17 81 $url = 'http://webservice.oca.com.ar/epak_tracking/Oep_TrackEPak.asmx/GetCentrosImposicionConServiciosByCP'; 18 82 $response = wp_remote_get( $url, array( … … 75 139 76 140 77 78 79 // =========================================================================80 /**81 * Shortcode [sucursales_oca]82 *83 */84 add_shortcode ( 'sucursales_oca' , 'woo_oca_sucursales_oca_func' );85 function woo_oca_sucursales_oca_func( $atts, $content= NULL) {86 if($_POST['cp']){87 $post_data = [ "CodigoPostal" => intval($_POST['cp']) ];88 $url = 'http://webservice.oca.com.ar/epak_tracking/Oep_TrackEPak.asmx/GetCentrosImposicionConServiciosByCP';89 $response = wp_remote_get( $url, array(90 'method' => 'GET',91 'timeout' => 45,92 'redirection' => 5,93 'httpversion' => '1.0',94 'blocking' => true,95 'headers' => array(),96 'body' => $post_data,97 'cookies' => array()98 )99 );100 $response = $response['http_response']->get_response_object()->body;101 $dom = new DOMDocument();102 @$dom->loadXML($response);103 $xpath = new DOMXpath($dom);104 105 $c_imp = array();106 foreach (@$xpath->query("//CentrosDeImposicion/Centro") as $ci)107 {108 $c_imp[] = array( 'idCentroImposicion' => $ci->getElementsByTagName('IdCentroImposicion')->item(0)->nodeValue,109 'Sucursal' => $ci->getElementsByTagName('Sucursal')->item(0)->nodeValue,110 'Sigla' => $ci->getElementsByTagName('Sigla')->item(0)->nodeValue,111 'Sucursal' => $ci->getElementsByTagName('Sucursal')->item(0)->nodeValue,112 'Calle' => $ci->getElementsByTagName('Calle')->item(0)->nodeValue,113 'Numero' => $ci->getElementsByTagName('Numero')->item(0)->nodeValue,114 'Localidad' => $ci->getElementsByTagName('Localidad')->item(0)->nodeValue,115 'Provincia' => $ci->getElementsByTagName('Provincia')->item(0)->nodeValue,116 'Telefono' => $ci->getElementsByTagName('Telefono')->item(0)->nodeValue,117 'CodigoPostal' => $ci->getElementsByTagName('CodigoPostal')->item(0)->nodeValue118 );119 }120 ob_start();121 echo '<table>';122 echo '<tr>123 <th>ID</th>124 <th>Nombre</th>125 <th>Calle</th>126 <th>Número</th>127 <th>Localidad</th>128 <th>Teléfono</th>129 <th>CP</th>130 </tr>';131 foreach($c_imp as $centro){132 echo '<tr>133 <td>'.$centro['idCentroImposicion'].'</td>134 <td>'.$centro['Sucursal'].'</td>135 <td>'.$centro['Calle'].'</td>136 <td>'.$centro['Numero'].'</td>137 <td>'.$centro['Localidad'].'</td>138 <td>'.$centro['Telefono'].'</td>139 <td>'.$centro['CodigoPostal'].'</td>140 </tr>';141 }142 echo '</table>';143 return ob_get_clean();144 }145 }146 147 148 141 // ========================================================================= 149 142 /** -
woo-oca/trunk/readme.txt
r1787836 r1788951 1 === Plugin Name===1 === Woocommerce OCA Envios === 2 2 Contributors: ecomerciar 3 3 Donate link: http://ecomerciar.com/ … … 6 6 Tested up to: 4.9 7 7 Requires PHP: 5.6 8 Stable tag: 1. 38 Stable tag: 1.4 9 9 Language: Spanish 10 10 License: GPLv2 or later 11 11 License URI: https://www.gnu.org/licenses/gpl-2.0.html 12 12 13 WooCommerce OCA Envios14 15 13 == Description == 16 14 17 Suma envios a traves de OCA a tu pagina de WooCommerce a traves de la API OCA E-Pak .15 Suma envios a traves de OCA a tu pagina de WooCommerce a traves de la API OCA E-Pak 18 16 19 17 == Instalation == 20 18 21 1. Subi los plugins a la carpeta `/wp-content/plugins/woocommerce-oca`, o instala el plugin a traves de WordPress plugins directamente.19 1. Subi los archivos del plugin a la carpeta `/wp-content/plugins/woo-oca`, o instala el plugin a traves de WordPress plugins directamente. 22 20 2. Active el plugin a traves de la pantalla de 'Plugins' en WordPress 23 21 3. Usa el plugin en la configuracion de Envios y Zonas de Woocommerce … … 40 38 41 39 = 1.1 = 42 Reiniciar Cache de Env íos40 Reiniciar Cache de Envios 43 41 44 42 = 1.2 = 45 Reiniciar Cache de Envíos 46 47 = 1.3 = 48 Nada 43 Reiniciar Cache de Envios 49 44 50 45 == Screenshots == … … 59 54 == Changelog == 60 55 56 = 1.4 = 57 * Agregada pagina de tracking 58 61 59 = 1.3 = 62 * Ya no es necesario reiniciar la cach é de envío60 * Ya no es necesario reiniciar la cache de envio 63 61 * Arreglado bug importante sobre el funcionamiento del plugin 64 62 65 63 = 1.2 = 66 * C ódigo optimizado67 * Agregada sanitizaci ón de información del usuario antes de realizar un envío64 * Codigo optimizado 65 * Agregada sanitizacion de informacion del usuario antes de realizar un envio 68 66 69 67 = 1.1 = 70 * Agregada verificaci ón de dimensiones y pesos cero71 * Agregada descripci ón sobre el CUIT en la configuración del plugin72 * Agregada la opci ón para enviar con contrareembolso68 * Agregada verificacion de dimensiones y pesos cero 69 * Agregada descripcion sobre el CUIT en la configuracion del plugin 70 * Agregada la opcion para enviar con contrareembolso 73 71 74 72 = 1.0 = -
woo-oca/trunk/woocommerce-oca.php
r1787836 r1788951 5 5 Plugin URI: http://ecomerciar.com 6 6 Description: Integración de oca para realizar envíos a través de la plataforma WooCommerce. 7 Version: 1. 37 Version: 1.4 8 8 Author: Ecomerciar 9 9 Author URI: http://ecomerciar.com … … 39 39 ) ); 40 40 } 41 42 $contenido = '<h2>Número de envío</h2> 43 <form method="post"> 44 <input type="text" name="id"style="width:40%"><br> 45 <br /> 46 <input name="submit_button" type="submit" value="Consultar" id="update_button" class="update_button"/> 47 </form> 48 [rastreo_oca]'; 49 if(! post_exists('OCA Rastreo', $contenido)){ 50 wp_insert_post( array( 51 'post_title' => 'OCA Rastreo', 52 'post_name' => 'oca_rastreo', 53 'post_status' => 'publish', 54 'post_type' => 'page', 55 'post_content' => $contenido, 56 'comment_status' => 'closed', 57 'ping_status' => 'closed' 58 ) ); 59 } 41 60 } 42 61 register_activation_hook(__FILE__,'woo_oca_install');
Note: See TracChangeset
for help on using the changeset viewer.