Active
Project:
Ubercart Product Minimum & Maximum
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Apr 2011 at 04:49 UTC
Updated:
9 Jan 2013 at 11:54 UTC
Have set up a product with a minimum of 10, maximum 0 (unlimited). Every time I view a page logged in as the administrator, I see an error reading:
"Notice: Undefined variable: output in uc_product_minmax_form_alter() (line 435 of [...]/uc_product_minmax/uc_product_minmax.module)."
Comments
Comment #1
BrandonJSchwartz commentedSeemed to have resolved it...or at least made the error disappear. Please advise if I have created a problem elsewhere:
Code was:
Code is...
(Removed the periods before output of min and max messages.)
Comment #2
fred0 commentedThe periods before the equals sign id php for "add this to the previous value. The use in this case is to concatenate the strings so that a buyer sees the various restrictions the module is applying to the product. Removing the periods means that the variable $output will be over-witten by each if statement and only display the last one that matched so, that's not really a solution.
IF you have chosen not to display these restrictions, then all if statements would be false and there would be no $output value. My guess is the correct fix is to set $output to a null value prior to the if statements. Try this and let me know if it works:
Comment #3
Eduardo_Martinez commentedRuns for me: Undefined variable outpost solved, but not: Notice: Trying to get property of non-object a uc_product_minmax_form_alter(), see: http://drupal.org/node/1403634
Comment #4
LTech commentedAdding the line $output = ''; solved it for me. Thanks
Comment #5
lokolo commentedDid this solve the "Trying to get property of non-object..." notice? Where did u add this?
Comment #6
sibro commentedWhere can I add the line. My log is seeing mostly these errors.
Comment #7
LTech commentedI added the line in the file: sites/all/modules/uc_product_minmax/uc_product_minmax.module
line 430:
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 ($minmax->pmin_multiple > 1 && $minmax->display_multiple) {
$output = '
';
It took away the error.
Comment #8
sibro commentedLTech, thanks for your response. I had the line in correctly. It was shown in #2. I am down to this error in my log.
Notice: Trying to get property of non-object in uc_product_minmax_form_alter() (line 438 of /home/fjmcprod/public_html/sites/all/modules/uc_product_minmax/uc_product_minmax.module).I have many of these every time I have a Drupal transaction.