how to customize the single product page

i'm new and just subscribe with wpmu,
i use marketpress in my network.

in my child network, i added a product, and also a collection of attachment to the product,
now i want it to be show on the single product page, but i try to edit the single.php, loop-single.php also not able to customized it, can you assist me how to do it ?

Thanks.

  • Tammie

    You need to create your own custom page ie; mp-product.php. Here is an example of one from our MarketPress theme GridMarket:

    <?php // custom template for product single view
    get_header();
    ?>
    	<div id="content">
    					<h1 class="entry-title"><?php the_title(); ?></h1>
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    				<div class="product-photo"><?php mp_product_image(true, 'single', null); ?></div>
    					<div class="product-details">
    				<div class="content-box">
    					<?php the_content(); ?>
    				</div>
    				<?php echo framemarket_product_meta(); ?>
    			</div>
    				<?php endwhile; else: ?>
    					<p><?php _e( 'Sorry, no posts matched your criteria.', TEMPLATE_DOMAIN ) ?></p>
    				<?php endif; ?>
    		<?php comments_template( '', true ); ?>
    	</div>
    <?php get_sidebar(); ?>
    <?php get_footer() ?>

    The function called is:

    function framemarket_product_meta() {
       global $post;
    
       //don't filter outside of the loop
     	if ( !in_the_loop() )
    		  return $content;
    
       $content = '<div class="product-meta-details">';
       $content .= mp_category_list($post->ID, '<span class="grid_mp_product_categories">' . __( 'Categorized in ', 'mp' ), ', ', '</span>');
       $content .= '  ';
       $content .= mp_tag_list($post->ID, '<span class="grid_mp_product_tags">', ', ', '</span>');
       $content .= '</div><hr/><div class="product-meta-details">';
       $content .= mp_product_price(false);
       $content .= mp_buy_button(false, 'single');
       $content .= '</div><hr />';
    
       return $content;
     }

    To use comments just whack this bit of code in your functions.php:

    add_filter( 'mp_register_post_type', 'framemarket_commentson' );
    	function framemarket_commentson( $args) {
    		$args['supports'] = array_merge($args['supports'], array('comments'));
    		return $args;
    	}

    Change framemarket prefix in all cases to your own though usually the prefix of your themename ie; themename_

  • anthrfrmt

    1 doubt, this text go in a new file (MP_PRODUCTS.PHP)

    <?php // custom template for product single view
    get_header();
    ?>
    <div id="content">
    <h1 class="entry-title"><?php the_title(); ?></h1>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="product-photo"><?php mp_product_image(true, 'single', null); ?></div>
    <div class="product-details">
    <div class="content-box">
    <?php the_content(); ?>
    </div>
    <?php echo framemarket_product_meta(); ?>
    </div>
    <?php endwhile; else: ?>
    <p><?php _e( 'Sorry, no posts matched your criteria.', TEMPLATE_DOMAIN ) ?></p>
    <?php endif; ?>
    <?php comments_template( '', true ); ?>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer() ?>

    THIS IN FUCTION.PHP
    add_filter( 'mp_register_post_type', 'framemarket_commentson' );
    function framemarket_commentson( $args) {
    $args['supports'] = array_merge($args['supports'], array('comments'));
    return $args;
    }

    AND THE FUNCTION, WHERE I NEED WRITE IT??
    function framemarket_product_meta() {
    global $post;

    //don't filter outside of the loop
    if ( !in_the_loop() )
    return $content;

    $content = '<div class="product-meta-details">';
    $content .= mp_category_list($post->ID, '<span class="grid_mp_product_categories">' . __( 'Categorized in ', 'mp' ), ', ', '</span>');
    $content .= ' ';
    $content .= mp_tag_list($post->ID, '<span class="grid_mp_product_tags">', ', ', '</span>');
    $content .= '</div><hr/><div class="product-meta-details">';
    $content .= mp_product_price(false);
    $content .= mp_buy_button(false, 'single');
    $content .= '</div><hr />';

    return $content;
    }