Home Forums WC Vendors Pro Support Vacation Notice w/old shop header

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #31537
    Anna
    Member

    1.3+ rocks so far! 🙂 Nice work and thank you!

    Question- I am using the option for the old shop headers, and I have customized the vendor-main-header.php to display info as I wish.
    Anyway, I am trying to get the new vacation mssg to display, and cannot get it to work.
    I tried by putting:
    <div class=”wcv-store-msg”><?php echo $vacation_msg; ?></div>

    in my vendors-main-header.php, but I cannot get it to show anything but the div properties of the blue background for the message. I’ve also studied the new store-header.php to see info I might need to add to the old header page, but so far I am not finding it.

    Could you please help me? I know there’s something I’m missing here… likely a chunk of code I need but I cannot yet find it..

    Thank you!

    #31553
    WC Vendors Support
    Participant

    /templates/store/store-vacation-message.php 🙂

    #31577
    Anna
    Member

    Hi Ben,
    Thanks, yes- I did see the template and have moved it to my child theme.

    However— I am trying to add the message to my shops’ header, which use the “free” wc vendors option for the shop header, not the pro option. So the message does not automatically show up since I am not using the pro headers.

    First I tried adding the code from the template to my vendor-header-main.php:

    <?php if ( $vacation_mode ) : ?>
    <div class="wcv-store-msg">
    		<?php echo $vacation_msg; ?>
    </div>
    <?php endif; ?>

    That did not work.

    Next I tried creating my own function to make them show up.. but I must be missing something.

    /* Shop Vacation Message */
    function shop_vacation_message () {
         $vacation_mode 	= get_user_meta( get_current_user_id(), '_wcv_vacation_mode', 	true ); 
         $vacation_msg 	= get_user_meta( get_current_user_id(), '_wcv_vacation_mode_msg', true );
    	 
    	 echo $vacation_msg;
    	 }

    Either way, I’m having trouble getting the vacation message to appear while using the “free” shop header.

    #31585
    WC Vendors Support
    Participant

    You’re so close.

    You are using get_current_user_id(). So, if I’m logged into your site, I dont see a vacation message because get_CURRENT_user_id() is ME! 🙂 You need the post_author’s ID there, not john doe’s in there.

    /public/class-wcvendors-pro-vendor-controller.php Line #1079-1106 to see how we do it.

    #31587
    Anna
    Member

    Thanks, Ben! That’s the file I was looking for. I had only found the info in the class-vendors-pro-store-form.php. YAY!

    I got it:

    /* Shop Vacation Message */
    function shop_vacation_message () {
        if ( is_shop() ) {
    	$vendor_shop 		= urldecode( get_query_var( 'vendor_shop' ) );
    	$vendor_id   		= WCV_Vendors::get_vendor_id( $vendor_shop ); 
    		}
    	if ( isset( $vendor_id ) ){ 
                $vacation_mode 		= get_user_meta( $vendor_id , '_wcv_vacation_mode', true ); 
    	    $vacation_msg 		= ( $vacation_mode ) ? get_user_meta( $vendor_id , '_wcv_vacation_mode_msg', true ) : '';
         
    	 echo $vacation_msg;
    	 }
    	}

    Now I need to make a similar function for my product page headers, and I’ll be good to go. 🙂 Thanks for the guidance, as always!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘WC Vendors Pro Support’ is closed to new topics and replies.