Auto-populate product minimum

Project:Product Minimum for Checkout
Component:Code
Category:
Priority:normal
Assigned:Unassigned
Status:active
Description
Project: 
Product Minimum

In uc_product_min.module, I added:

  if (preg_match('/.*add-to-cart-form.*/', $form_id)) {
    $form['qty']['#default_value'] = !empty($node->product_min) ? $node->product_min : 1;
  }

At line 71, so it now reads:

function uc_product_min_form_alter($form_id, &$form) {
  $node = $form['#node'];
  $product_types = uc_product_node_info();
  if (preg_match('/.*add-to-cart-form.*/', $form_id)) {
    $form['qty']['#default_value'] = !empty($node->product_min) ? $node->product_min : 1;
  }
  if ($form_id == $node->type .'_node_form' && isset($product_types[$node->type])){

This enables the default minimum to be set prior to check-out. Users can still choose less, and the logic to limit this upon checkout is still there.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Auto-populate product minimum

Nice idea. I'll put this on my to-do list to return to and get it added in. Smiling