• Resolved yoyob40

    (@yoyob40)


    Hello,

    No matter what i am doing, the admin notif for new orders doesn’t appear. I disabled all plugins, i used default theme…. nothing works, No error in console.
    I just receive the new order sound notif but not the popup.

    Using different browsers, same result.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Bibhu Prakash Ota

    (@bibhu1995)

    Hello @yoyob40,

    You need to check the browser notification permission and make sure that the sound, popup push notification is allowed for your site URL.

    Regards,
    Bibhu

    Thread Starter yoyob40

    (@yoyob40)

    Already did this. I forgot to mention.
    I allow the notif mess and sound. No luck. Message doesn’t appear

    I am having the same issue, could we have an option to send notifications to our phone?

    Thread Starter yoyob40

    (@yoyob40)

    The final solution is to write my own function for this since this default one is defectuos. I will give the solution asap

    Thread Starter yoyob40

    (@yoyob40)

    New Order Notification

    By editing this file -> restropress/includes/admin/payments/payments-history.php
    Starting with line 44, exactly after line <?php $payments_table->advanced_filters(); ?>
    I was added these line of code in order to receive message notif and audio notif when new order arrived.

    code to be added

    <script>
    jQuery(document).ready(function () {
    var interval = setInterval(function () {
    if (jQuery(".rpress_notify_audio").length) {
    clearInterval(interval);
    jQuery( "<div id='alert'>YOU HAVE A NEW ORDER!</br></br></br><button class='button modal button2'>SHOW ME</button></div>" ).insertAfter( ".top" );
    }
    }, 2000);
    jQuery(function() {
    jQuery(".button2").click(function() {
    location.reload(true);
    })
    })	
    });
    
    jQuery(function ($) {
    if (rpress_vars.is_admin == 1 && rpress_vars.enable_order_notification == 1) {
    if (typeof Notification !== "undefined") {
    Notification.requestPermission()
    .then(function (result) {
    if (result === 'denied') {
    console.log('Permission wasn\'t granted. Allow a retry.');
    return;
    }
    
    if (result === 'default') {
    console.log('The permission request was dismissed.');
    return;
    }
    
    setInterval(function () {
    $.ajax({
    type: 'POST',
    data: {
    action: 'rpress_check_new_orders'
    },
    url: ajaxurl,
    success: function (response) {
    if (response != '0') {
    
    if (typeof response.title === "undefined") return;
    
    var notifyTitle = response.title;
    var options = {
    body: response.body,
    icon: response.icon,
    sound: response.sound,
    };
    var n = new Notification(notifyTitle, options);
    n.custom_options = {
    url: response.url,
    }
    n.onclick = function (event) {
    event.preventDefault(); // prevent the browser from focusing the Notification's tab
    window.open(n.custom_options.url, '_blank');
    };
    
    //add audio notify because, this property is not currently supported in any browser.
    if (response.sound != '') {
    var loopsound = '1' == rpress_vars.loopsound ? 'loop' : '';
    $("<audio controls " + loopsound + " class='rpress_notify_audio'></audio>")
    .attr({
    'src': response.sound,
    })
    .appendTo("body");
    $('.rpress_notify_audio')
    .trigger("play");
    }
    
    //set time to notify is show
    var time_notify = parseInt(rpress_vars.notification_duration);
    if (time_notify > 0) {
    time_notify = time_notify * 1000;
    setTimeout(n.close.bind(n), time_notify);
    }
    
    n.onclose = function (event) {
    event.preventDefault();
    $('.rpress_notify_audio')
    .remove();
    };
    }
    },
    complete: function () { }
    });
    }, 5000);
    });
    }
    }
    });
    
    </script>
    <?php $payments_table->display() ?>
    </form>
    <?php do_action( 'rpress_payments_page_bottom' ); ?>
    </div>
    <style>
    #alert {
    padding: 50px;
    text-align: center;
    background-color: #F0FFF0;
    color: #ffffff;
    font-size: 30px;
    -webkit-animation: NAME-YOUR-ANIMATION 1s infinite;  /* Safari 4+ */
    -moz-animation: NAME-YOUR-ANIMATION 1s infinite;  /* Fx 5+ */
    -o-animation: NAME-YOUR-ANIMATION 1s infinite;  /* Opera 12+ */
    animation: NAME-YOUR-ANIMATION 1s infinite;  /* IE 10+, Fx 29+ */
    }	
    #close {
    float:right;
    display:inline-block;
    padding:2px 5px;
    background:transparent;
    margin-top: -45px;
    margin-right: -40px;
    cursor: pointer;
    }
    @-webkit-keyframes NAME-YOUR-ANIMATION {
    0%, 49% {
    background-color: #FA8072;
    color: #F0FFF0;
    }
    50%, 100% {
    background-color: #F0FFF0;
    color: #FA8072;
    }
    }
    .button2 {
    background-color: #008CBA !important;
    color: #ffffff !important;
    width: 100px;
    }
    </style>
    • This reply was modified 2 years, 3 months ago by yoyob40.
    • This reply was modified 2 years, 3 months ago by yoyob40.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘New order – Admin popup Notification’ is closed to new replies.