Hi,

I got some notices when installed a module and tried to add some products to the wishlist:

Notice: Undefined index: entity funktsioonis commerce_wishlist_add_form_validate() (rida 129 / /htdocs/sites/all/modules/commerce_wishlist/commerce_wishlist.module).
Notice: Trying to get property of non-object funktsioonis commerce_wishlist_add_form_validate() (rida 129 / /htdocs/sites/all/modules/commerce_wishlist/commerce_wishlist.module).
Notice: Undefined index: entity funktsioonis commerce_wishlist_add_form_submit() (rida 153 / /htdocs/sites/all/modules/commerce_wishlist/commerce_wishlist.module).
Notice: Trying to get property of non-object funktsioonis commerce_wishlist_add_form_submit() (rida 153 / /htdocs/sites/all/modules/commerce_wishlist/commerce_wishlist.module).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'nid' cannot be null: INSERT INTO {commerce_wishlist} (uid, nid, product_id) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => [:db_insert_placeholder_2] => 5 ) funktsioonis commerce_wishlist_add_form_submit() (rida 156 / /htdocs/sites/all/modules/commerce_wishlist/commerce_wishlist.module).

Tormi

Comments

fall_0ut’s picture

Hi,

What are the modules you had enabled?

How you created a product display?

Tsuba’s picture

I also see error in reports when user try add product to wishlist.
Products page generated with Views. I see error only for Views generated pages. In product page no errors.

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'nid' cannot be null: INSERT INTO {commerce_wishlist} (uid, nid, product_id) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 30 [:db_insert_placeholder_1] => [:db_insert_placeholder_2] => 230 ) в функции commerce_wishlist_add_form_submit() (строка 156 в файле /home/u2932/domains/mysite.ru/sites/all/modules/commerce_wishlist/commerce_wishlist.module).
aristeides’s picture

I get the same errors...

    Notice: Undefined index: entity in commerce_wishlist_add_form_validate() (line 129 of commerce_wishlist.module).
    Notice: Trying to get property of non-object in commerce_wishlist_add_form_validate() (line 129 of commerce_wishlist.module).
    Notice: Undefined index: entity in commerce_wishlist_add_form_submit() (line 153 of commerce_wishlist.module).
    Notice: Trying to get property of non-object in commerce_wishlist_add_form_submit() (line 153 of commerce_wishlist.module).
    PDOException: SQLSTATE[23000]: Integrity constraint violation: 19 commerce_wishlist.nid may not be NULL: INSERT INTO {commerce_wishlist} (uid, nid, product_id) VALUES (?, ?, ?); Array ( [0] => 1 [1] => [2] => 8 ) in commerce_wishlist_add_form_submit() (line 156 of commerce_wishlist.module).

aristeides’s picture

After seeing comment #1 mentioning a product display, I have to mention that I'm building a site WITHOUT product displays.
All the fields are in the product itself and everything else is handled by views.
The wishlist icon is rendered by views on my product list.
When using product display nodes I don't get these errors, but my use case demands that the store administration is as simple as possible, thus I can't have 2 steps for creating a product. All I can afford in terms of complexity is a single form for new products.
Took a little while to grasp the concept of making everything work without product displays but the end resuld is really rewarding and everything works perfectly.

fall_0ut’s picture

Assigned: Unassigned » fall_0ut
Priority: Normal » Major
Status: Active » Needs review

Hi,

On the module commerce wishlist I fixed the code to allow add product when haven't a node display to the product!

Download the last version and execute the update-php

Please test this fix!

aristeides’s picture

Wow, I didn't expect such a quick response....
the results are simply PERFECT!!

Thank you very much!

aristeides’s picture

Status: Needs review » Fixed

Marking as fixed.

Status: Fixed » Closed (fixed)

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