Plugin Directory

Changeset 1788951


Ignore:
Timestamp:
12/18/2017 04:09:19 PM (8 years ago)
Author:
ecomerciar
Message:

Modificacion Readme y Actualizacion 1.4

Location:
woo-oca
Files:
27 added
3 edited

Legend:

Unmodified
Added
Removed
  • woo-oca/trunk/oca-utilities.php

    r1787831 r1788951  
    1414function woo_oca_rastreo_oca_func( $atts, $content= NULL) {
    1515    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 */
     77add_shortcode ( 'sucursales_oca' , 'woo_oca_sucursales_oca_func' );
     78function woo_oca_sucursales_oca_func( $atts, $content= NULL) {
     79    if($_POST['cp']){
     80        $post_data = [ "CodigoPostal" => intval($_POST['cp']) ];
    1781        $url = 'http://webservice.oca.com.ar/epak_tracking/Oep_TrackEPak.asmx/GetCentrosImposicionConServiciosByCP';
    1882        $response = wp_remote_get( $url, array(
     
    75139
    76140
    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)->nodeValue
    118                             );
    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 
    148141// =========================================================================
    149142/**
  • woo-oca/trunk/readme.txt

    r1787836 r1788951  
    1 === Plugin Name ===
     1=== Woocommerce OCA Envios ===
    22Contributors: ecomerciar
    33Donate link: http://ecomerciar.com/
     
    66Tested up to: 4.9
    77Requires PHP: 5.6
    8 Stable tag: 1.3
     8Stable tag: 1.4
    99Language: Spanish
    1010License: GPLv2 or later
    1111License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1212
    13 WooCommerce OCA Envios
    14 
    1513== Description ==
    1614
    17 Suma envios a traves de OCA a tu pagina de WooCommerce a traves de la API OCA E-Pak.
     15Suma envios a traves de OCA a tu pagina de WooCommerce a traves de la API OCA E-Pak
    1816
    1917== Instalation ==
    2018
    21 1. Subi los plugins a la carpeta `/wp-content/plugins/woocommerce-oca`, o instala el plugin a traves de WordPress plugins directamente.
     191. Subi los archivos del plugin a la carpeta `/wp-content/plugins/woo-oca`, o instala el plugin a traves de WordPress plugins directamente.
    22202. Active el plugin a traves de la pantalla de 'Plugins' en WordPress
    23213. Usa el plugin en la configuracion de Envios y Zonas de Woocommerce
     
    4038
    4139= 1.1 =
    42 Reiniciar Cache de Envíos
     40Reiniciar Cache de Envios
    4341
    4442= 1.2 =
    45 Reiniciar Cache de Envíos
    46 
    47 = 1.3 =
    48 Nada
     43Reiniciar Cache de Envios
    4944
    5045== Screenshots ==
     
    5954== Changelog ==
    6055
     56= 1.4 =
     57* Agregada pagina de tracking
     58
    6159= 1.3 =
    62 * Ya no es necesario reiniciar la caché de envío
     60* Ya no es necesario reiniciar la cache de envio
    6361* Arreglado bug importante sobre el funcionamiento del plugin
    6462
    6563= 1.2 =
    66 * Código optimizado
    67 * Agregada sanitización de información del usuario antes de realizar un envío
     64* Codigo optimizado
     65* Agregada sanitizacion de informacion del usuario antes de realizar un envio
    6866
    6967= 1.1 =
    70 * Agregada verificación de dimensiones y pesos cero
    71 * Agregada descripción sobre el CUIT en la configuración del plugin
    72 * Agregada la opción para enviar con contrareembolso
     68* 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
    7371
    7472= 1.0 =
  • woo-oca/trunk/woocommerce-oca.php

    r1787836 r1788951  
    55Plugin URI: http://ecomerciar.com
    66Description: Integración de oca para realizar envíos a través de la plataforma WooCommerce.
    7 Version: 1.3
     7Version: 1.4
    88Author: Ecomerciar
    99Author URI: http://ecomerciar.com
     
    3939        ) );
    4040    }
     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    }
    4160}
    4261register_activation_hook(__FILE__,'woo_oca_install');
Note: See TracChangeset for help on using the changeset viewer.