Home Forums Theme Support Dokan Issues with dokan seller vacation

This topic is: not resolved

This topic contains 4 replies, has 2 voices, and was last updated by  Gregório Sordi 3 years, 11 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #41575

    Gregório Sordi
    Member
    Post count: 152

    1) First thing, i noticed the current date is wrong. And i think i know why. Dokan doesn't use the Date format and the utc i imputted in wordpress settings. This way, the date that the plugin is getting with $now = date( ‘Y-m-d' ) is the UTC time. I am in UTC-3. So, here is now 2015/04/16 22:39:11, it shows 2015/04/17 1:39:11.

    2) Second thing, and most important. The imediately go to vacation is working fine. But the datewide go to vacation is not working. I've made extensive test. Deactivated plugins and all my customizations with no success. It doesn't change anything. Store message appear ok, but products are still available or unavailable. If it was available before setting it, it still is. If the imediately go to vacation was chosen before. It doesn't change status even if the vacation is not set to the present date.

    Please debug this and confirm this error.

    thanks.

    #41633

    towhid
    Participant
    Post count: 4505

    Hello Sordi,

    Can you please send me some screenshot about those above issues. Then it will be easy for me to see how you test everything. I have also found some inconsistency.

    Thank you 🙂

    #41726

    Gregório Sordi
    Member
    Post count: 152

    It's better to tell you than make a lot of screenshots.

    First, i copied this code from dokan-seller-vacation.php to dashboard-nav.php so i can print the variable values.

            $profile_info = dokan_get_store_info( get_current_user_id() );
    
            $settings_closing_style   = isset( $profile_info['settings_closing_style'] ) ? esc_attr( $profile_info['settings_closing_style'] ) : 'open';
            $settings_close_from      = isset( $profile_info['settings_close_from'] ) ? esc_attr( $profile_info['settings_close_from'] ) : '';
            $settings_close_to        = isset( $profile_info['settings_close_to'] ) ? esc_attr( $profile_info['settings_close_to'] ) : '';
            $setting_vacation_message = isset( $profile_info['setting_vacation_message'] ) ? esc_attr( $profile_info['setting_vacation_message'] ) : '';
    
            if ( $settings_closing_style  == 'instantly' || $settings_closing_style == '' ) {
                print 'instantaneo';
            }
    
            if ( $settings_close_to == '' || $settings_close_from == '' ) {
                print 'blado2';
            }
    
            $from_date = date( 'Y-m-d', strtotime( $settings_close_from ) );
            $to_date = date( 'Y-m-d', strtotime( $settings_close_to ) );
            $now = date( 'Y-m-d' );
    		
    		echo "<pre>";print_r($from_date);echo "</pre>";
    		echo "<pre>";print_r($to_date);echo "</pre>";
    		echo "<pre>";print_r($now);echo "</pre>";
    		        if ( $from_date <= $now && $to_date >= $now ) {
                // Date is within beginning and ending time
                print 'Date is within beginning and ending time';
            } else {
                // Date is not within beginning and ending time
                print 'Date is not within beginning and ending time';
            }
    		
    		$user_id        = get_current_user_id();
    		$dokan_enable_seller_vacation = get_user_meta( $user_id , 'dokan_enable_seller_vacation', true );
    		
    		 if( $dokan_enable_seller_vacation ) { print 'on vacation';} else { print 'not on vacation';}

    As far as i remember it now, it all went fine. the variables printed the expected value. But, not all worked.

    this line doesn't seem to be working:

            if ( $from_date <= $now && $to_date >= $now ) {
                // Date is within beginning and ending time
                $this->update_product_status( 'publish', 'vacation' );
            } else {
                // Date is not within beginning and ending time
                $this->update_product_status( 'vacation', 'publish' );
            }

    Why i think that?

    The message on store is printed ok. If not on vacation, not printed, if it is, imediately or datewise, it is printed.

    but the products are not.

    If not set on vacation: Prodcuts are shown to buy.

    If set vacation imeadiately: Products disappear.

    If set datewise vacation: Message is printed, but products are shown and are still available.

    Got it?

    thanks for your time.

    #41902

    towhid
    Participant
    Post count: 4505

    Hello Sordi,

    The idea you had mentioned is very helpful. I already forward your idea to our developer team. Hope they will implement this idea very soon.

    Thank you 🙂

    #42055

    Gregório Sordi
    Member
    Post count: 152

    Ok. thanks. keep me posted on updates about this issue.

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Issues with dokan seller vacation’ is closed to new replies.