Modifying product pages in MarketPress

Hello

I'm trying to remove the buy now button from all product list pages. I can't find a simple way to do this so I'm using the filter mp_product_list_meta to change the outputted code.

This works fine for products in list view, but not in grid view.

In grid view the filter mp_product_list_meta is in a different location in its respective function (_mp_products_html_grid) compared to list view(_mp_products_html_list).

So how best do you suggest I change the product meta in grid view?

Pete

  • petemurray

    Hi Alexander

    I need to display the buy now and checkout for single product pages, just not the product/category list pages.

    The code in question is in template-functions.php

    line 1400 for list view

    $html .= '<div class="mp_product_meta">';
            //price
            $meta = mp_product_price(false, $post->ID);
            //button
            $meta .= mp_buy_button(false, 'list', $post->ID);
            $html .= apply_filters('mp_product_list_meta', $meta, $post->ID);
            $html .= '</div>';

    and line 1452 for grid view

    $html .= '<div class="mp_one_tile ' . implode($class, ' ') . '">
                    <div class="mp_one_product"' . ($inline_style ? ' style="width: ' . $width . 'px;"' : '') . '>
    
                      <div class="mp_product_detail"' . ($inline_style ? ' style="width: ' . $width . 'px;"' : '') . '>
                        ' . $img . '
    
                        <h3 class="mp_product_name">
                          <a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a>
                        </h3>
    
                        ' . $mp_product_list_content . '
                      </div>
    
                      <div class="mp_price_buy"' . ($inline_style ? ' style="width: ' . $width . 'px; margin-left:-' . $width . 'px;"' : '') . '>
                        ' . mp_product_price(false, $post->ID) . '
                        ' . mp_buy_button(false, 'list', $post->ID) . '
                        ' . apply_filters('mp_product_list_meta', '', $post->ID) . '
                      </div>
    
                    </div>
                  </div>';

    I can filter the meta easily in list view, but the filter is in a different location in the second snippet and it's not clear to me how to use it.

    Pete

  • petemurray

    Hi @Alexander

    I think I mislead you with my previous text - I want to remove the buy now / add to cart buttons and the price.

    Using a filter function, in the list view case, I can see that it's easy to make $meta = '' which removes the price and the buy buttons.

    However in the grid view example I can only add to the $html variable, I can't see how to remove only the price/buy now.

    I'm not very experienced at using filters so it's probably something fundamental which I'm missing. Could you give me an example of a filter function which I could use to remove the price/buy buttons in the grid view example?

    Thanks
    Pete

  • Ben

    @petemurry

    I hate giving links for answers, but in your case I think it might be appropriate.

    I think you will have to create a new product listing template for your theme.

    Here seems to be a pretty good tutorial for that to walk you through it:

    https://premium.wpmudev.org/forums/topic/tutorial-how-to-customise-marketpress-product-list

    Then you can manually create it products listing display without the price and buy now button.

    Hope that provides the solution you are looking for, best of luck.