Since installing this module, I get this issue on just about every page:

Notice: Trying to get property of non-object in uc_product_minmax_form_alter() (line 431 of /var/www/websites/mywebsite.com/sites/all/modules/uc_product_minmax/uc_product_minmax.module).
Notice: Trying to get property of non-object in uc_product_minmax_form_alter() (line 434 of /var/www/websites/mywebsite.com/sites/all/modules/uc_product_minmax/uc_product_minmax.module).
Notice: Trying to get property of non-object in uc_product_minmax_form_alter() (line 437 of /var/www/websites/mywebsite.com/sites/all/modules/uc_product_minmax/uc_product_minmax.module).
Notice: Undefined variable: output in uc_product_minmax_form_alter() (line 441 of /var/www/websites/mywebsite.com/sites/all/modules/uc_product_minmax/uc_product_minmax.module).

Comments

Eduardo_Martinez’s picture

Solved partially at http://drupal.org/node/1131430

lokolo’s picture

Has anybody an idea to solve this?

bmunslow’s picture

Find this function in uc_product_minmax.module:
'uc_product_minmax_form_alter'

Replace the whole function with this code:

/*******************************************************************************
 * Display minmax restrictions in add to cart form if selected in product
 * feature general settings.
 ******************************************************************************/

/**
 * Implementation of hook_form_alter().
 */
function uc_product_minmax_form_alter(&$form, &$form_state, $form_id) {
  // Add text for "Add to cart" and "Buy it now" forms
  if (variable_get('uc_product_minmax_position', 0) == 1) {
    if ((strpos($form_id, 'add_to_cart_form') > 0 || strpos($form_id, 'uc_catalog_buy_it_now_form_') === 0)) {
      $minmax = uc_product_minmax_feature_load($form['nid']['#value']);
	  $output = '';
	if (isset($minxmax->pmin_multiple) || isset($minxmax->display_multiple)){
      if ($minmax->pmin_multiple > 1 && $minmax->display_multiple) {
        $output = '<div class="uc_product_multiple">' . t('This product must be ordered in sets of !qty.', array('!qty' => $minmax->pmin_multiple)) . '</div>';
      }
      if ($minmax->product_min > 1 && $minmax->display_min) {
        $output .= '<div class="uc_product_min">' . t('A minimum order of at least !qty is required.', array('!qty' => $minmax->product_min)) . '</div>';
      }
      if ($minmax->product_max >= 1 && $minmax->display_max) {
        $output .= '<div class="uc_product_max">' . t('A maximum order of !qty is allowed.', array('!qty' => $minmax->product_max)) . '</div>';
      }

      $form['qty']['#description'] = $output;
	  }
    }
  }
}
jodyfr’s picture

Issue summary: View changes

Thanks! The replacement code in #3 fixed the problem for me.

daniel.moberly’s picture

Status: Active » Needs review
StatusFileSize
new1.96 KB

Submitting a patch that fixes this issue