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

    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!

    Thanks!

  • kalmarnet

    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">';
    //price
    $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> ';
    }
    //button
    $content .= mp_buy_button(false, 'list', $post->ID);
    $content .= '</div>';

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

    $content .= '</div>';

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

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.