Forum Replies Created

Viewing 15 replies - 1 through 15 (of 31 total)
  • Thread Starter rualsi

    (@rualsi)

    Great!

    I have modified it a bit in order to “save” local pickup. Maybe can be useful for someone:

    function hide_shipping_when_free_is_available( $rates, $package ) {
    	$new_rates = array();
    	foreach ( $rates as $rate_id => $rate ) {
    		// Only modify rates if free_shipping is present.
    		if ( 'free_shipping' === $rate->method_id ) {
    			$new_rates[ $rate_id ] = $rate;
    			break;
    		}
    	}
    	// To unset all methods except for free_shipping and local pick up, do the following:
    	if ( ! empty( $new_rates ) ) {
    		//Save local pickup if it's present.
    		foreach ( $rates as $rate_id => $rate ) {
    			if ('local_pickup' === $rate->method_id ) {
    				$new_rates[ $rate_id ] = $rate;
    				break;
    			}
    		}
    		return $new_rates;
    	}
    
    	return $rates;
    }
    
    add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 10, 2 );

    Thanks again

    Thread Starter rualsi

    (@rualsi)

    Html and Javascript code must be added to footer on your theme

    Thread Starter rualsi

    (@rualsi)

    I’m going to test it.

    Thank you so much!

    Thread Starter rualsi

    (@rualsi)

    <!-- HTML-->
    <div id="avisocookie" style="display: none;">
        <div class="linea">
            <p>YOUR MESSAGE HERE</p>
            <a href="javascript:void(0);" class="button" onclick="PonerCookie();"><b>OK</b></a> ? ?
            <a href="YOUR TERMS LINK POLICY HERE" target="_blank" class="button">Read More</a>
        </div>
    </div>
    <!-- JAVASCRIPT-->
    <script>
    function getCookie(c_name){
        var c_value = document.cookie;
        var c_start = c_value.indexOf(" " + c_name + "=");
        if (c_start == -1){
            c_start = c_value.indexOf(c_name + "=");
        }
        if (c_start == -1){
            c_value = null;
        }else{
            c_start = c_value.indexOf("=", c_start) + 1;
            var c_end = c_value.indexOf(";", c_start);
            if (c_end == -1){
                c_end = c_value.length;
            }
            c_value = unescape(c_value.substring(c_start,c_end));
        }
        return c_value;
    }
    
    function setCookie(c_name,value,exdays){
        var exdate=new Date();
        exdate.setDate(exdate.getDate() + exdays);
        var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()) + "; path=/";
        document.cookie=c_name + "=" + c_value;
    }
    
    if(getCookie('aviso')!="1"){
        document.getElementById("avisocookie").style.display="block";
    }
    function PonerCookie(){
        setCookie('aviso','1',365);
        document.getElementById("avisocookie").style.display="none";
    }
    </script>
    <!--//FIN BLOQUE COOKIES-->

    You need to write CSS code accroding with your theme.

    Mine is:

    #avisocookie{
        display:none;
        position:fixed;
        left:0px;
        right:0px;
        bottom:0px;
        width:100%;
        text-align:center;
        min-height:185px;
        background-color: rgba(85, 85, 85, 0.8);
        color:#fff;
        z-index:99999;
    }
    
    .linea {
        width:100%;
        position:absolute;
        padding:3%;
        font-size:16px;
    }
    Thread Starter rualsi

    (@rualsi)

    Don’t worry.

    I have writen a small script in javascript wich is enough for me and seems to work well.

    If you still want to test, my site isn’t open to public yet. Only a test site is avaliable for admins.

    Thanks for your quick answer.

    Same problem. I have deactivated minify and problem is still there.

    Maybe we have to exlude some files in w3 total cache configuration…

    Any help?

    Thread Starter rualsi

    (@rualsi)

    Thanks a lot.

    I have sent you an email.

    Regards

    Thread Starter rualsi

    (@rualsi)

    Another one:

    In pro version (on demo page) how can I serach for an order? Id order seems not working.

    How can I manage refunds?

    Thanks

    Thread Starter rualsi

    (@rualsi)

    OK, I’ll do it.

    Thanks

    Thread Starter rualsi

    (@rualsi)

    I mean catalog pages. If I deactivate Zencache, Out of stock products don’t appear on catalog altough, of course, they appear at searching.

    Thanks

    Thread Starter rualsi

    (@rualsi)

    Last time I got it, It was answering a topic in BBpress. But nothing in the frontend is shown so maybe I’m misstaken becouse I have got the warning many times even with no bbpress mesages at this time.

    Thread Starter rualsi

    (@rualsi)

    I don’t know really. I have a plugin which send me an email when an error is logged but I don’t have more information. Where can I look it for?

    Thanks again

    Thread Starter rualsi

    (@rualsi)

    Yes, I have two php files for two contact forms.

    <?php
    $dia = $_POST['dia'];
    $mes = $_POST['mes'];
    $ano = $_POST['ano'];
    
    if (empty($ano) && $dia == '17' && $mes == 'maio'){
    
    	/* Recollemos datos do formulario */
    	$nome = $_POST['nome'];
    	$apelidos = $_POST['apelidos'];
    	$dni = $_POST['dni'];
    	$email = $_POST['email'];
    	$repiteemail = $_POST['repiteemail'];
    	$telefono = $_POST['telefono'];
    	$direccion = $_POST['direccion'];
    	$ncc = $_POST['ncc'];
    	$erros ='';
    
    	/* Comprobamos que os campos non están baleiros, que os emails coinciden e que o tipo de arquivo e tama?o é correcto */
    	if (empty($nome)) $erros .='<p>Debes encher o nome</p>';
    	if (empty($apelidos)) $erros .='<p>Debes encher os apelidos</p>';
    	if (empty($dni)) $erros .='<p>Debes encher o DNI</p>';
    	if (empty($email)) $erros .='<p>Debes encher o email</p>';
    	if (empty($telefono)) $erros .='<p>Debes encher o teléfono</p>';
    	if (empty($direccion)) $erros .='<p>Debes encher a dirección</p>';
    	if (empty($ncc)) $erros .='<p>Debes encher o número de conta</p>';
    	for ($i = 0 ; $i <= 3 ; $i++) {
    		$pesoadx = $_FILES['adxunto']['size'][$i];
    		if (empty($pesoadx)) {
    			$erros .='<p>Non adxuntaches o arquivo '.($i+1).'</p>';
    		}
    		else {
    			if ($pesoadx >= 1050000 ) {
    				$erros .='<p>O arquivo '.($i+1).' é máis grande do permitido. Tama?o máximo por ficheiro: 1 MB.</p>';
    			}
    			$nomearquivo = $_FILES['adxunto']['name'][$i];
    			$comezaextension = '.';
    			$arraytemporal = explode($comezaextension,$nomearquivo);
    			$tipoadx[$i] = end($arraytemporal);
    			if (!($tipoadx[$i] == 'jpeg' || $tipoadx[$i] == 'jpg' || $tipoadx[$i] == 'pdf' || $tipoadx[$i] == 'doc' || $tipoadx[$i] == 'docx' || $tipoadx[$i] == 'odt' ||  $tipoadx[$i] =='png')) {
    				$erros .='<p>O arquivo '.($i+1).' é dun tipo non permitido. Debes adxuntar un jpg, jpeg, png, doc, docx, pdf ou odt.</p>';
    			}
    		}
    	}
    	if ($email != $repiteemail) $erros .= '<p>Os emails non coinciden</p>';
    
    	/* Se non hai erros, subimos os ficheiros ao servidor e os enviamos por mail. Se hai erros, informamos por pantalla. */
    	if ($erros == ''){
    		$ruta = 'XXXXXXXXXXX'.$dni.'/';
    		if (!file_exists($ruta)) {
    			mkdir($ruta,0700);
    		}
    		for ( $i=0; $i<=3; $i++){
    			$nomeadx[$i] = $ruta.'Adxunto-'.$i.'.'.$tipoadx[$i];
    			$nometemporaladx= $_FILES['adxunto']['tmp_name'][$i];
    			move_uploaded_file($nometemporaladx,$nomeadx[$i]);
    		}
    		$mensaxe= '<p>Apelidos: '.$apelidos.'</p>'.'<p>Nome: '.$nome.'</p>'.'<p>DNI: '.$dni.'</p>'.'<p>Email: '.$email.'</p>'.'<p>Telefono: '.$telefono.'</p>'.'<p>Direccion: '.$direccion.'</p>'.'<p>NCC: '.$ncc.'</p>';
    		$cabeceira = array('MIME-Version: 1.0; Content-Type: text/html; Charset: UTF-8');
    		include_once ('../../../wp-load.php');
    		wp_mail('XXXXXXXXXXXX','XXXXXXXXXXX',$mensaxe,$cabeceira,$nomeadx);
    		echo '<html><head><meta http-equiv="refresh" content="5;url=XXXXXXXXXXXX"></head><body>A túa mensaxe foi enviada correctamente. Grazas</body></html>';
    	}
    	else{
    		echo $erros;
    		echo '<a href="javascript:history.back()">Volve atrás</a> para corrixir os erros e volve enviar a solicitude.';
    	}
    }
    else echo '<html><head><meta http-equiv="refresh" content="5;url=XXXXXXXX"></head><body>A túa mensaxe foi filtrada como basura, tenta contactar por email directamente.</body></html>';
    ?>

    The other one is quite similar, but more simple.

    Thread Starter rualsi

    (@rualsi)

    I only have a function to send emails via smtp.

    <?php
    add_action('phpmailer_init','send_smtp_email');
    function send_smtp_email( $phpmailer )
    {
        // Define que estamos enviando por SMTP
        $phpmailer->isSMTP();
    
        // La dirección del HOST del servidor de correo SMTP
        $phpmailer->Host = 'smtp.gmail.com';
    
        // Uso autenticación por SMTP (true|false)
        $phpmailer->SMTPAuth = true;
    
        // Puerto SMTP
        $phpmailer->Port = '465';
    
        // Usuario de la cuenta de correo
        $phpmailer->Username = 'XXXXXXXX';
    
        // Contrase?a para la autenticación SMTP
        $phpmailer->Password = 'XXXXXXXXXX';
    
        // El tipo de encriptación que usamos al conectar - ssl o tls
        $phpmailer->SMTPSecure = 'ssl';
    
        $phpmailer->From = 'XXXXXX';
        $phpmailer->FromName = 'XXXXXX';
    }
    ?>

    That’s all

    Thanks.

    Thread Starter rualsi

    (@rualsi)

    I have updated to the last version and since this I haven’t touched the code.

    Regards

Viewing 15 replies - 1 through 15 (of 31 total)