I am experiencing problem with add to cart form on taxonomy pages that are set do display apache solr results (via Pages/Blocks apache solr interface). My product has one attribute attached with two options. In search results I show product title, body sku and add to cart form. When product appear in search results I get error:

Notice: Trying to get property of non-object in _uc_attribute_alter_form() (line 1321 of /proj/www/aegir/platforms/iewuber2/sites/all/modules/ubercart/uc_attribute/uc_attribute.module).
Warning: Invalid argument supplied for foreach() in _uc_attribute_alter_form() (line 1321 of /proj/www/aegir/platforms/iewuber2/sites/all/modules/ubercart/uc_attribute/uc_attribute.module).
Notice: Trying to get property of non-object in _uc_attribute_alter_form() (line 1375 of /proj/www/aegir/platforms/iewuber2/sites/all/modules/ubercart/uc_attribute/uc_attribute.module).
Notice: Trying to get property of non-object in _uc_attribute_alter_form() (line 1407 of /proj/www/aegir/platforms/iewuber2/sites/all/modules/ubercart/uc_attribute/uc_attribute.module).
Notice: Trying to get property of non-object in _uc_attribute_alter_form() (line 1417 of /proj/www/aegir/platforms/iewuber2/sites/all/modules/ubercart/uc_attribute/uc_attribute.module).
Notice: Trying to get property of non-object in _uc_attribute_get_name() (line 1485 of /proj/www/aegir/platforms/iewuber2/sites/all/modules/ubercart/uc_attribute/uc_attribute.module).
Notice: Trying to get property of non-object in _uc_attribute_get_name() (line 1489 of /proj/www/aegir/platforms/iewuber2/sites/all/modules/ubercart/uc_attribute/uc_attribute.module).
Notice: Trying to get property of non-object in _uc_attribute_alter_form() (line 1428 of /proj/www/aegir/platforms/iewuber2/sites/all/modules/ubercart/uc_attribute/uc_attribute.module).
Notice: Trying to get property of non-object in _uc_attribute_alter_form() (line 1428 of /proj/www/aegir/platforms/iewuber2/sites/all/modules/ubercart/uc_attribute/uc_attribute.module).
Notice: Trying to get property of non-object in _uc_attribute_alter_form() (line 1429 of /proj/www/aegir/platforms/iewuber2/sites/all/modules/ubercart/uc_attribute/uc_attribute.module).
Notice: Trying to get property of non-object in _uc_attribute_alter_form() (line 1429 of /proj/www/aegir/platforms/iewuber2/sites/all/modules/ubercart/uc_attribute/uc_attribute.module).

and instead of showing two radio buttons with options I get one input box in add to cart form.
Note that product in search results is themed via display suite module. On all other places (node view, display via views etc.) add to cart form behaves normally (shows two radio buttons with add to cart button). Also I have enabled i18n module (1.8)

After some debugging i try to find workaround to this issue by converting problematic $attribute (array variable) to object.
I add to line 1321 uc_attribute.module (_uc_attribute_alter_form())

$attr = $attribute;
if(!is_object($attr)) {
$attribute = (object) $attr;
}

and in line 1368 (_uc_attribute_alter_form())

$op = $option;
if(!is_object($op)) {
$option = (object) $op;
}

This solve my issue but still this does not remove cause of problem.
Can any one reproduce this?

Comments

longwave’s picture

Title: Problem with attributes in add to cart form » Problem with attributes in add to cart form with Display Suite

Somehow, the product attribute options are not being correctly loaded, while the product attributes themselves appear to be. I guess this is an incompatibility with display suite somehow, but without recreating your entire setup I am not sure how to go about fixing it I'm afraid.

rakun’s picture

Status: Closed (fixed) » Active

Tnx longwave, you are right. Issue is not related to ubercart, is display suite problem.
I found issue on ds which solve my problem.

http://drupal.org/node/1950660

rakun’s picture

Status: Active » Closed (fixed)
tr’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.