Plugin Directory

Changeset 2761922


Ignore:
Timestamp:
07/26/2022 04:13:47 PM (4 years ago)
Author:
perseosoftware
Message:

Actualización tarifas venta y rebaja , versión 6.1

Location:
perseo-software/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • perseo-software/trunk/PluginPerseo.php

    r2727087 r2761922  
    44Plugin URI: https://perseo.ec/
    55Description: Este Plugins integra el Sistema Contable Perseo Web y PC con la tienda Woocommerce
    6 Version: 22.0
     6Version: 23.0
    77Author: Perseo Soft S.A. - Ecuador
    88Author URI: https://perseo.ec
     
    144144        }
    145145        settings_errors('eperseo_verificacion');
    146        
    147        
    148          
    149 
    150146            ///////////////////////////////////////////////////////////////////////
    151147            //llamamos a la pag de secciones
     
    156152            $perseo_config  = PERSEOCONFIGBASE; //VARIABLE DEFINIDA DE CONFIGURACION BASE DE DATOS
    157153            if (!empty($perseo_config['perseotoken'])) {
    158                 submit_button('Guardar Cambios','primary','submit', true, array( 'onclick' => 'perseoprogress()' ));
     154                submit_button('Guardar Cambios Parametrizacion','primary','submit', true, array( 'onclick' => 'perseoprogress()' ));
    159155               
    160156            }else{
    161                 submit_button('Guardar Cambios','primary','submit', true,'disabled');
     157                submit_button('Guardar Cambios Parametrizacion','primary','submit', true,'disabled');
    162158            }
    163            
    164159            echo "</form>";
    165160           
     
    830825
    831826
     827
    832828/////////////////////////////////////
    833829//libreria js
  • perseo-software/trunk/README.md

    r2727055 r2761922  
    55Tags: auto publish, content marketing
    66Requires at least: 1.1
    7 Tested up to: 5.9
     7Tested up to: 6.1
    88Requires PHP: 7.4
    99Stable tag: 1.1
     
    48481. perseo-1.jpg
    4949== Changelog ==
     50= 23.0 =
     51* Actualizacion precios .
     52
    5053= 22.0 =
    5154* Actualizacion .
     55
    5256== Changelog ==
    5357= 21.0 =
  • perseo-software/trunk/includes/PluginPerseo_cron.php

    r2729580 r2761922  
    682682                        'contenido'     =>''
    683683            ];     
     684           //print_r(wp_json_encode($perseo_bodyproducto));
     685           echo "<br>";
    684686            $perseo_responseproducto = wp_remote_post($perseo_urlproducto,
    685687                    array(
     
    692694                        'body'        => wp_json_encode($perseo_bodyproducto))
    693695                    );
    694                 // print_r($perseo_responseproducto['body']);
     696                 // print_r($perseo_responseproducto['body']);
    695697            if (! empty($perseo_responseproducto)){   
    696698                $perseo_datosProductos = json_decode($perseo_responseproducto['body'],true);
     
    11691171                                        if (isset($tarifa))
    11701172                                        {
     1173                                       
    11711174                                            //$perseo_iva= ($producto['porcentajeiva']/100)+1;
    11721175
     
    15321535    }
    15331536   
     1537    public function fperseo_ActualizarTarifas(){
     1538         // echo '<br>- consulta stock del producto desde aqui- <br>';
     1539         global $wpdb;       
     1540         global $table_prefix;
     1541         $perseo_config          =get_option('pluginperseo_configuracion');
     1542         $perseo_parametros      =get_option('pluginperseo_parametros');
     1543         
     1544         
     1545             //////////////////////////////////
     1546             //mostramos el codigo del producto para traer tarifa mediante consultas
     1547             $ConsultaProducstock=$wpdb->get_results("SELECT product_id FROM {$table_prefix}wc_product_meta_lookup ");
     1548             //print_r($ConsultaProducstock);
     1549             //echo '<br>- consulta  <br>';
     1550             if( ! empty($ConsultaProducstock)){ 
     1551                 
     1552                foreach ($ConsultaProducstock as $DatProd){
     1553                     $perseo_totalstock= 0;
     1554                     //consulta id del producto
     1555                     //echo 'ID woocommerce ';
     1556                     //echo $DatProd -> product_id;
     1557                     //echo '<br><br>';
     1558
     1559                     $ConsultaProductoUpd = $DatProd -> product_id;
     1560                     //echo  $ConsultaProductoUpd;
     1561                     $ConsultaProducstock=$wpdb->get_var("SELECT meta_value FROM {$table_prefix}postmeta where meta_key ='_product_attributes' and post_id=".$DatProd -> product_id);
     1562                     $perseo_codigoprodstock= unserialize($ConsultaProducstock);
     1563                     //print_r($perseo_codigoprodstock);
     1564                     //echo '<br>';
     1565                     if (isset($perseo_codigoprodstock['ID_Perseo']['value'])){
     1566                                 $perseo_codigostock=$perseo_codigoprodstock['ID_Perseo']['value'];
     1567                     }else{
     1568                                 $perseo_codigostock=$perseo_codigoprodstock['id_perseo']['value'];
     1569                     };
     1570
     1571                    //echo $perseo_codigoprodstock['ID_Perseo']['value'];
     1572                    //echo ' - ID perseo<br>'; 
     1573                    //echo '<br>';
     1574                    /////////////////////////////////////
     1575                    //Verificar pc o web
     1576                        if ($perseo_config['perseotiposoftware']=='WEB'){
     1577                            $perseo_urlproducto =$perseo_config['perseoservidor'].'/api/productos_consulta';
     1578                            }else{
     1579                            $perseo_urlproducto  =$perseo_config['perseocertificado'].'://'.$perseo_config['perseoip'].'/api/productos_consulta';
     1580                        };
     1581                    // echo "<br>- Producto---<br> ";
     1582                    //echo  $perseo_urlproducto;
     1583                        $perseo_bodyproducto = ['api_key'       => $perseo_config['perseotoken'],
     1584                                    'productosid'   => $perseo_codigostock,
     1585                                    'productocodigo'=>'',
     1586                                    'barras'        =>'',
     1587                                    'contenido'     =>''
     1588                        ];     
     1589                    //print_r(wp_json_encode($perseo_bodyproducto));
     1590                    //echo "<br>";
     1591                        $perseo_responseproducto = wp_remote_post($perseo_urlproducto,
     1592                                array(
     1593                                    'method'      => 'POST',
     1594                                    'timeout'     => 55000,
     1595                                    'redirection' => 5,
     1596                                    'httpversion' => '1.0',
     1597                                    'blocking'    => true,
     1598                                    'headers'     => array( 'Content-Type'=> 'application/json' ),
     1599                                    'body'        => wp_json_encode($perseo_bodyproducto))
     1600                                );
     1601                        // print_r($perseo_responseproducto['body']);
     1602                        if (! empty($perseo_responseproducto)){   
     1603                            $perseo_datosProductos = json_decode($perseo_responseproducto['body'],true);
     1604                        // print_r($perseo_datosProductos['productos']);
     1605                        //echo "<br>";   echo "<br>";
     1606                            foreach($perseo_datosProductos['productos'] as $producto)
     1607                            { 
     1608                                foreach($producto['tarifas'] as $tarifa)
     1609                                {
     1610                                //print_r($tarifa);
     1611                                //echo "<br>";
     1612                                if (isset($tarifa))
     1613                                {
     1614                               
     1615                                    //$perseo_iva= ($producto['porcentajeiva']/100)+1;
     1616                                    //// Si tuviera los mismos precios eliminar la promocion
     1617                                    if($perseo_parametros['perseotarifaVenta']==$perseo_parametros['perseotarifaAumento']){
     1618                                        if($perseo_parametros['perseotarifaVenta']==$tarifa['tarifasid'])
     1619                                            {
     1620                                            $perseo_tarifaventa=round($tarifa['precio'],2);
     1621                                            update_post_meta($ConsultaProductoUpd, '_price', $perseo_tarifaventa);
     1622                                            update_post_meta($ConsultaProductoUpd, '_sale_price', $perseo_tarifaventa );
     1623                                            update_post_meta($ConsultaProductoUpd, '_regular_price', $perseo_tarifaventa );
     1624                                            };
     1625
     1626                                    }else{
     1627                                                if($perseo_parametros['perseotarifaVenta']==$tarifa['tarifasid'])
     1628                                                {                                                           
     1629                                                    $perseo_tarifaventa=round($tarifa['precio'],2);
     1630                                                    //echo $perseo_tarifaventa;
     1631                                                    //echo "<br>";
     1632                                                    update_post_meta($ConsultaProductoUpd, '_price', $perseo_tarifaventa);
     1633                                                    update_post_meta($ConsultaProductoUpd, '_sale_price', $perseo_tarifaventa );
     1634                                                    //update_post_meta($ConsultaProductoUpd, '_regular_price', $perseo_tarifaventa );
     1635
     1636                                                    ///////////////////////////////////////////////////
     1637                                                    //insertamos Nuevo producto CUARTA TABLA plugin_wc_product_meta_lookup
     1638                                                        $wpdb->update($table_prefix.'wc_product_meta_lookup',
     1639                                                        array('max_price'  =>  $perseo_tarifaventa ),
     1640                                                        array('product_id' => $ConsultaProductoUpd)
     1641                                                        );
     1642
     1643                                                };
     1644                                                    //precio 2
     1645                                                if($perseo_parametros['perseotarifaAumento']==$tarifa['tarifasid'])
     1646                                                {                                                           
     1647                                                    $perseo_tarifaaumento =round($tarifa['precio'],2);
     1648                                                    update_post_meta($ConsultaProductoUpd, '_price', $perseo_tarifaaumento);
     1649                                                    update_post_meta($ConsultaProductoUpd, '_sale_price', $perseo_tarifaaumento);
     1650
     1651                                                    ///////////////////////////////////////////////////
     1652                                                    //insertamos Nuevo producto CUARTA TABLA plugin_wc_product_meta_lookup
     1653                                                    $wpdb->update($table_prefix.'wc_product_meta_lookup',
     1654                                                    array('min_price'     =>  $perseo_tarifaaumento),
     1655                                                    array('product_id' => $ConsultaProductoUpd)
     1656                                                    );
     1657
     1658                                                };
     1659                                            };
     1660
     1661                                };
     1662
     1663
     1664
     1665                                }
     1666                            }
     1667                        };
     1668
     1669                   
     1670                 }
     1671            };
     1672    }
     1673
    15341674    public function fperseo_inicializador() {
    15351675        //elimina el cron
  • perseo-software/trunk/includes/PluginPerseo_master.php

    r2387291 r2761922  
    4141        $this->perseo_cargador->add_action( 'perseo_cron', $this->perseo_cron, 'fperseo_stockproducto');
    4242        $this->perseo_cargador->add_action( 'perseo_cron', $this->perseo_cron, 'fperseo_enviarclientes');
     43        $this->perseo_cargador->add_action( 'perseo_cron', $this->perseo_cron, 'fperseo_ActualizarTarifas');
    4344
    4445        $this->perseo_cargador->add_action( 'init', $this->perseo_cron, 'fperseo_inicializador');
Note: See TracChangeset for help on using the changeset viewer.