Home Forums WC Vendors Pro Support Output of Shop Description and View Shop menu item…

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 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #29662
    Anna
    Member

    A few questions… I am customizing and could use some guidance if you’d be so kind. If not, then no cupcakes for you! >:-(

    1. I’d like to output the $shop_description that we have in the headers onto a page similar to how the vendor ratings/feedback displays. I have had to truncate the shop description so wordy vendors do not cover half the shop pages. However, I’d like them to be able to have the rest of the info available for those who wish to read it all. Ideally I’d like to also have other information they enter for their shop on this page as well, such as the Seller Info.
    Where would I start??? I am not sure how to create a semi-page like the vendor ratings, so that if someone was to click on a link (i.e shop description & info) they would view this information within the vendor’s store just as they can view the ratings/feedback.
    I’ve tried to replicate the feedback files and templates, but there are several and I am lost…. Could you give me any direction? I think I could manage to create the page and output the correct info if you could guide me as to where I start making something – a base – like the vendor feedback/ratings ( /vendors/this-shop/?ratings=all ).

    2. Is there a way in which we can create a link in a menu for the vendors to “view my shop”? I have the vendor dashboard as a menu item for the vendors, but I cannot figure out how to make a “view my shop” selection- identical to that which is in the menu in the vendor dashboard top menu.

    I make really good cupcakes, FYI.

    #29679
    WC Vendors Support
    Participant

    I hate cupcakes. But you could bribe my wife with them *any day of the week*. The more frosting the better. 🙂 If you said chocolate chip cookies, now you’ve got my attention!

    1.) Tough question! But actually pretty easy when you get down to it. You’ve already got the shop description, it’s a user meta field. pv_shop_description. $shop_desc = get_user_meta( $vendor_id, 'pv_shop_description', true); Of course, you set $vendor_id as the vendors user ID you want to look up. Now $shop_desc is the full shop description. To make it smaller, $smaller_shop_desc = substr($shop_desc, 0, 100); would create a new value, of only the first 100 characters of the shop description. Change 100 to whatever number you like. You might even add a few dots after the end when you echo it out so it doesnt look broken, such as $smaller_shop_desc = substr($shop_desc, 0, 100) . '...'; Now, you have $smaller_shop_desc and $shop_desc and you can use them as you see fit! For seller info, that’s just a different meta key, pv_seller_info, also in the user meta table.

    2.) A link in ANY menu is harder than a link in the Pro Dashboard menu. I’m thinking you mean your normal WordPress menus. There’s a number of menu plugins that would allow you to dynamically control menu output — which ones I dont know, but I do know they exist. You can also google “WordPress PHP in Menu” and find a ton of snippets to add code to a menu. From there, you’d get the vendors user ID, and then WCV_Vendors::get_vendor_shop_page( $vendor_id ); would be the function you use to get the vendors shop page URL. From there, add it to the menu in any way you see fit. Of course, it would help to wrap that inside of a function that checks if the current user logged in has the role vendor, then do this code, otherwise do nothing…….

    #29888
    Anna
    Member

    Hi, Ben. Thanks for your response. 🙂

    1.) I believe I need to clarify my first question. I already do have the header shop description set at truncated. What I am trying to do:
    I am trying to create a page similar to the “ratings / feedback”. I think I will be able to gather the information I wish to output correctly. What I am having difficulty with is creating the page in the first place. I’ve tried to figure out how to replicate the ratings/feedback page by digging through the wc vendors code, and am having trouble.

    So…. Ultimately I’d like to create a link that would lead to a destination like the ratings/feedback ( vendors/this-vendor/?ratings=all ), but instead of showing the feedback, it shows the shop description and seller info…. or other information as I would choose.

    Is this possible? I am good with getting the information on the page and gathering the info for the vendor… I just don’t know how to make the ?ratings=all page.

    2.) Thank you- I’ll look for plugin or code that will allow php in menus. I understand the rest, and will format it as such.

    Chocolate chip cookies, extra frosting cupcakes and ginger snaps. Got it. 😉

    #29935
    Jamie
    Keymaster

    Hello,

    2) Here is a gist that will insert a ‘view my store’ into a menu called ‘Vendor Menu’. You will need to change the menu slug to whatever menu you want to insert this link into. If you don’t it won’t show up. Please note that this will hit the database on every page load and if you have a big enough site you may see slow downs. You can fix the styles in the html for the link.

    https://gist.github.com/digitalchild/5f737f6c9c5e8771f5bce3262fa0a1ac

    cheers,

    Jamie

    #29936
    Anna
    Member

    Thank you, Jamie @digitalchild !
    I appreciate your time and help.

    That will help with the menu link. However, I was actually hoping that perhaps you could help me with my first question posed in this topic. I will repeat it here:

    What I am trying to do:
    I am trying to create a page similar to the “ratings / feedback”. I think I will be able to gather the information I wish to output correctly. What I am having difficulty with is creating the page in the first place. I’ve tried to figure out how to replicate the ratings/feedback page by digging through the wc vendors code, and am having trouble.

    So…. Ultimately I’d like to create a link that would lead to a destination like the ratings/feedback ( vendors/this-vendor/?ratings=all ), but instead of showing the feedback, it shows the shop description and seller info…. or other information as I would choose.

    Is this possible? I am good with getting the information on the page and gathering the info for the vendor… I just don’t know how to make the ?ratings=all page.

    If you could guide me in any way, I’d greatly appreciate the help. Thanks again.

    #29937
    Jamie
    Keymaster

    Hello,

    So you want to create a new page that’s more like /vendors/vendor-store/more-info that then has shop description and seller info? or something like that?

    If so you’ll have to hook into the get_query_vars() and create a new one for more info. Then you’ll need to create a new re-write rule for this. You will then need to have it load a template when you have this date to display the required information.

    The code that does this kind of thing is in the class-wcvendors-pro-ratings-controller.php in includes/.

    cheers,

    Jamie.

    #29938
    Anna
    Member

    Jamie,
    Thank you.

    Well, this will be a fair bit of work for me… but you have given me direction so I think I can make it happen. 😉 Thanks for pointing me to the file in includes/ … that helps a lot!

    I appreciate the guidance. Take care & enjoy your visit with Ben!!

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