Esempio n. 1
0
 protected function filtros_precio($precio = false)
 {
     if (!$precio) {
         $precio = (double) get_post_meta($this->id, '_precio', true);
     }
     if (is_user_logged_in()) {
         /*
          **SI HAY USUARIO LOGUEADO REVISAMOS
          **SI TIENE CUPONES
          */
         $cupones = Cupon::get_cupones($this->comprador);
         if ($cupones) {
             foreach ($cupones as $identificador => $setting) {
                 $cupon = new Cupon($identificador);
                 $mensaje_cupon = $cupon->get_mensajes();
                 if ($mensaje_cupon->ok) {
                     /*
                      **SI NO HAY ERRORES EN EL CUPÓN seteamos
                      **PRECIO
                      */
                     $precio -= $cupon->get_descuento();
                     if ($precio < 0) {
                         $precio = 0;
                     }
                 }
             }
         }
     }
     return $precio;
 }
Esempio n. 2
0
function cintillo_menu()
{
    global $current_user;
    $identificador = "verano";
    $cupon = new Cupon($identificador);
    if (is_user_logged_in() && $cupon->check_limite_por_usuario($current_user->ID) || !is_user_logged_in()) {
        return '<div class="cintillo_menu small azul2"><strong>¡Verano en ruedas!</strong> Con el código <span>' . $identificador . '</span><br/> te regalamos $' . $cupon->get_descuento() . ' pesos.</div>';
    } else {
        return '<div class="cintillo_menu small azul2">Por cada 5 amigos que invites y usen tu código te regalamos una clase: <span class="color_negro">' . get_codigo($current_user->ID) . '</span></div>';
    }
}