Best Way To Show Quantity Box In Archives

Hello.. Brand Spanking New to this plugin...

I see the Add To Cart button when viewing a product listing, but how do I add the Quantity box?

Is there a way to do it elegantly as to not have to edit core plugin files (so I won't have to implement all my changes again after a new release)?

Thanks in advance!

  • Mason
    • DEV MAN’s Sidekick

    Hiya keith,

    Take a look at the template-functions.php file included in the download section. You can use many of the template functions here to completely customize your pages. Just do a search for 'Quantity' and you'll find the functions you need.


  • keithjameslock
    • Flash Drive

    @Aaron... I agree :slight_smile: it is an option for single product settings, but not product list settings

    @masonjames.. thanks.. is there way to hook into the code rather than edit it.. or how about creating "add-ons"? Can you give me a basic idea of the best way to make changes without touching core files?

    Thanks again

  • Mason
    • DEV MAN’s Sidekick

    Hiya Keith,

    Nah, I wasn't recommending an edit to the plugin. You can use the information in the template-functions.php file and the themes/Themeing_MarketPress.txt file in order to create your own 'page templates' for MarketPress just like you would with a regular theme.

    That txt files has a lot more instructions on how you can create individual template pages.

    Hope that helps!


  • kalmarnet
    • WPMU DEV Initiate

    Why is it when i Add:

    //add quantity field
    $content .= mp_quantity"><label>' . __('Quantity:', 'mp') . ' <input class="mp_quantity_field" type="text" size="1" name="quantity" value="1" /></label></span> ';

    to template-functions.php here it doesn't work?
    The above is the code for quantity field yes?
    The below is the section where it generates the product listing in the archive (products page) yes?
    This is exactly what this gentleman is asking for and would really help me out as well because I need to do the same.
    Should be an option, why add to cart from the product page if you cant enter quantity?

    //The Query
    $custom_query = new WP_Query('post_type=product&post_status=publish' . $taxonomy_query . $paginate_query . $order_by_query . $order_query);

    //allows pagination links to work get_posts_nav_link()
    if ($wp_query->max_num_pages == 0 || $taxonomy_query)
    $wp_query->max_num_pages = $custom_query->max_num_pages;

    $content = '<div id="mp_product_list">';

    if (count($custom_query->posts)) {
    foreach ($custom_query->posts as $post) {

    $content .= '<div '.mp_product_class(false, 'mp_product', $post->ID).'>';
    $content .= '<h3 class="mp_product_name">ID ) . '">' . $post->post_title . '</h3>';
    $content .= '<div class="mp_product_content">';
    $content .= mp_product_image( false, 'list', $post->ID );
    $content .= $mp->product_excerpt($post->post_excerpt, $post->post_content, $post->ID);
    $content .= '</div>';

    $content .= '<div class="mp_product_meta">';
    $content .= mp_product_price(false, $post->ID);
    //add quantity field
    $content .= mp_quantity"><label>' . __('Quantity:', 'mp') . ' <input class="mp_quantity_field" type="text" size="1" name="quantity" value="1" /></label></span> ';
    $content .= mp_buy_button(false, 'list', $post->ID);
    $content .= '</div>';

    $content .= '</div>';
    } else {
    $content .= __('No Products', 'mp');

    $content .= '</div>';

    if ($echo)
    echo $content;
    return $content;

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.