after upgrading from 1.3 to 1.4 I'm getting this error

Notice: Undefined index: show_single_product_attributes in commerce_cart_field_formatter_view() (line 2266 of ..../sites/all/modules/commerce/modules/cart/commerce_cart.module).

#3 show_single_product_attributes_error_for_old_settings-1819956-3.patch1.78 KBvasike
FAILED: [[SimpleTest]]: [MySQL] Invalid PHP syntax in sites/default/modules/commerce/modules/cart/commerce_cart.module. View
Members fund testing for the Drupal project. Drupal Association Learn more


bojanz’s picture

I think this only appears on old (pre 1.4) carts (if you retry with a new cart, the notice won't be there).

jday’s picture

I get the error on product pages.

vasike’s picture

Version: 7.x-1.4 » 7.x-1.x-dev
Status: Active » Needs review
1.78 KB
FAILED: [[SimpleTest]]: [MySQL] Invalid PHP syntax in sites/default/modules/commerce/modules/cart/commerce_cart.module. View

It seems it's about the display "Add to cart form" formatter that haven't the new setting 'show_single_product_attributes' (Show attribute widgets even if the Add to Cart form only represents one product.) set. so probably for all product displays OLD Displays that use this formatter and are not re-set (resaved).

Probably a similar error takes place also on Manage Displays pages

1. Just resave the Product Display Content Type "Displays", that uses "Add to cart form" formatter for product.

2. the patch attached.

Status: Needs review » Needs work
jday’s picture

I re-saved my product display "displays" and the error is gone, thanks.

rszrama’s picture

Component: User experience » Cart
Status: Needs work » Fixed

Yep, I should've caught that when the new setting was added. This is why I prefer !empty() checks on boolean values in arrays instead of just assuming there's going to be a boolean value there. It combines the "is it set? is it not FALSE?" into a single quick statement and ensure the result is a boolean to boot.


Status: Fixed » Closed (fixed)

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