I'd like to display the price of appointment when using Appointments + with Marketpress

I have Marketpress & Appointments plus working together. In the "product" overview pages, all the "products" have prices, where as those which can take appointments do not. Is it possible to display the price of the appointment products here? See here http://bit.ly/ZvyI7q. Thanks!

  • Vladislav
    • Dead Eye Dev

    Hello,

    This happens with A+/MP working together in the list view. A quick and easy way out would be to swap the product list presentation to grid view - you can do this in your store settings, tab "Presentation", section "Product List Settings". Of course, this only works if this presentation model works with your design, but you can give it a go and see if it helps.

    Another, a bit more involved way of achieving this would be with some custom code. Something like this should work (it did the job for me):

    function app_mp_product_meta ($meta, $post_id) {
    	global $appointments;
    	if ( !in_array( $post_id, $appointments->mp_posts ) ) return $meta;
    
    	$app_meta = preg_replace(
    		'/<form.*?' . preg_quote('</form>', '/') . '/i',
    		'<a class="mp_link_buynow" href="' . get_permalink($post_id) . '">' . __('Choose Option &raquo;', 'mp') . '</a>',
    		$meta
    	);
    	return $app_meta;
    }
    
    function app_unbind_app_stuff_here () {
    	global $appointments;
    	remove_filter('mp_buy_button_tag', array($appointments, 'mp_buy_button_tag'), 10, 3);
    	remove_filter('mp_product_list_meta', array($appointments, 'mp_product_list_meta'), 10, 2);
    	add_filter('mp_product_list_meta',  'app_mp_product_meta', 10, 2);
    
    }
    add_filter('init', 'app_unbind_app_stuff_here');
  • no_bs_seo
    • WPMU DEV Initiate

    Hi Vladislav

    Thanks for your suggestion. You are correct that the price appears in the grid view, however we preferably need it to be in the list view.

    Where would I put that code? I thought it should go in marketpress.php, but it crashed the plugin with the following error

    Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION

    Or perhaps I put it in the wrong place within the plugin..?

    Thanks

    Meg

  • Vladislav
    • Dead Eye Dev

    Hello,

    The code I added above can go either in your theme's functions.php, or in a mu-plugin. A mu-plugin is basically a .php file in your wp-content/mu-plugins directory (if it doesn't exist, just create it) - any .php file there will automatically be included by WordPress. Please, note that if you decide to go with the mu-plugin approach, you'll need to add an opening "<?php" tag before you add any of the code to your file.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.