Join our new community forum for support & discussion
Join NowHome › Support › Extensions › Messages › Display Message Button only for certain listing
Display Message Button only for certain listing
-
AuthorPosts
-
shotsandvideos 1 year, 2 months ago
Hi! Is there a way to display the message/contact button for a listing based only on the presence of a given attribute?
Another question: is there a way to forward a message to the vendor email automatically?
Sorry, there’s no option to enable/disable messages per listing at the moment, this would require custom implementation. By default, vendors get an email notification if there’s a new message and you can include the message text there with the
%message_text%
token.shotsandvideos 1 year, 2 months agoOk thanks!
And another question: could it possible to display a contact form that automatically send a message to email recipient specified with the token %value%?
I desperately need to give chance to be contacted only for certain vendors.
What should I do?
If possible send more details, do you mean some checbox option for vendors (per vendor or listing) to display/hide the Send Message button on the front-end?
shotsandvideos 1 year, 1 month agoNot exactly. I have an “email” attribute, but not every vendor has one. I would like to enable messages only for those who have it.
Or, to make it easier, a function that hides the message button for all those vendors who don’t have email in their attributes.
Otherwise I would like to set a form in the text field of my email attribute, so that only those who inserted email can receve a message.
Sorry, this would require customizations because there are multiple places where the Send Message button/icon appears. It’s possible to check the attribute value to show/hide this form, but please note that this custom attribute value is not linked with the email address, messages are always sent to the user’s email address set in My Account/Settings section.
shotsandvideos 1 year, 1 month agoOK, so what would be the easiest way, without customization? How would you do it?
Thanks again for your support!Unfortunately there’s no simple code snippet for it. I can post a snippet for hiding a single button (e.g. on the listing page) depending on the attribute value and you can consider hiding all the other message buttons/icons via CSS, please let me know if this works for oyu.
shotsandvideos 1 year, 1 month agoYes please, that is absolutely viable. Thank you! 🙂
Please try this one (you can add it via the Code Snippets plugin):
add_filter( 'hivepress/v1/templates/listing_view_page/blocks', function( $blocks, $template ) { $listing = $template->get_context( 'listing' ); if ( $listing && ! $listing->has_attributenamehere() ) { $blocks = hivepress()->helper->merge_trees( [ 'blocks' => $blocks ], [ 'blocks' => [ 'message_send_link' => [ 'type' => 'content', ], ], ] )['blocks']; } return $blocks; }, 1000, 2 );
staarkos 1 year agoin wich line i need change listing name or atribute in your code.
i copieed this but i cant understand what i need change
Please try replacing the “attributenamehere” part with the attribute name that defines the Send Message button visibility.
-
AuthorPosts
New Reply
This forum has been archived and is no longer accepting new posts or replies. Please join our new community forum for support & discussion.