All modules and D7 the latest dev releases as of today > installing commerce (basic modules) > at

http://localhost/drupal7jul28/admin/modules/list/confirm > message :

FieldException: Attempt to create a field of unknown type commerce_line_item_reference. in field_create_field() (line 298 of D:\xampp\htdocs\drupal7jul28\modules\field\field.crud.inc).

FYI

Comments

bojanz’s picture

artatac, are you using the dev branch from drupal.org? Can you maybe try to install this version? I believe this is the download link.

rszrama’s picture

This still an issue, artatac? If not, will close this out. (I get no errors on installation of any module.)

artatac’s picture

Started again > latest verstion of D7 dev and commerce from your link.
D7 install - no issues
Commerce > commerce main module install by itself - no issue
then went back and installed rest of commerce sub modules - following error

FieldException: Attempt to create a field of unknown type <em class="placeholder">commerce_line_item_reference</em>. in field_create_field() (line 297 of D:\xampp\htdocs\d71208\modules\field\field.crud.inc).

will roll back and install sub modules one by one and report back

artatac’s picture

Installed one by one and this was the result

views

Rules, Rules UI, Views UI, Entity Metadata, Entity CRUD API

Commerce

Price

order, line item

all ok so far...

Then try to enable Product and..

Warning: in_array(): Wrong datatype for second argument in drupal_write_record() (line 5960 of D:\xampp\htdocs\d71208\includes\common.inc).
Warning: in_array(): Wrong datatype for second argument in drupal_write_record() (line 5960 of D:\xampp\htdocs\d71208\includes\common.inc).
Warning: in_array(): Wrong datatype for second argument in drupal_write_record() (line 5960 of D:\xampp\htdocs\d71208\includes\common.inc).
Warning: in_array(): Wrong datatype for second argument in drupal_write_record() (line 5960 of D:\xampp\htdocs\d71208\includes\common.inc).

if it helps can be seen at
http://venturacottage.homedns.org/d71208/
user webmaster password demo
help yourself :-)

rszrama’s picture

Status: Active » Needs review

Alrighty, did some debugging on installation issues. Can you get the latest versions from CVS of Views, Entity, Rules, and Commerce and try again? Following the installation order you're using I'm not getting any more notices or errors, and everything's actually being configured properly. The fixes came in through #857662: Notices when installing Product Reference.

artatac’s picture

I don't have a cvs client or use cvs. Could you zip the relevant modules and I will happily install and retry. Or if I wait a couple of days does the cvs version become the dev version on the module project page?

rszrama’s picture

Yep, after tonight it'll be packaged into a new dev release here on d.o.

Alternatively you can use the "Download source" button at the top right of this page:

http://github.com/rszrama/drupalcommerce/

That's where I commit stuff as I work on it. : )

artatac’s picture

Still getting same error BUT only grabbed your cvs not Views, Entity, Rules - so will grab those and retry

artatac’s picture

Still getting same error with latest DEV versions (all but views are dated 12/8) FYI joe

rszrama’s picture

So you're getting the "Attempt to create a field of unknown type" error? Or the wrong data type for second argument error?

artatac’s picture

Yes error is second arg type

rszrama’s picture

Weird... I haven't ever seen that one. Are you running Drupal 7.0-alpha6?

artatac’s picture

No Drupal 7 dev

See paste below

Update available
Drupal core 7.x-dev (2010-Aug-12)
Recommended version: 7.0-alpha6 (2010-Jul-09)
Download Release notes
Development version: 7.x-dev (2010-Aug-13)
Download Release notes
Includes: Bartik, Block, Color, Comment, Contextual links, Dashboard, Database logging, Field, Field SQL storage, Field UI, File, Filter, Help, Image, List, Menu, Node, Number, Options, Overlay, Path, RDF, Search, Seven, Shortcut, System, Taxonomy, Text, Toolbar, Update manager, User

rszrama’s picture

Hmm, ok, could be a difference in that API function or something. Will keep an eye out for it.

artatac’s picture

If you zip your current test site and send be a link I could install and prove it is not the current
Modules

rszrama’s picture

I wonder if it's an installation bug with Drupal itself. Can you try installing the Line Item module on its own first, then Product Reference on its own, and then Order?

bojanz’s picture

artatac’s picture

Will do

bojanz’s picture

bojanz’s picture

Double posted accidentally.

artatac’s picture

StatusFileSize
new31.33 KB

sure..

Modules > line Item > enable
Receive message
"You must enable the Rules, Entity Metadata, Entity CRUD API, Price, Commerce modules to install Line Item."
> continue
"The configuration options have been saved." - ok so far
> Product Reference > enable
> message
"You must enable the Product module to install Product Reference."
> continue

THEN

Warning: in_array(): Wrong datatype for second argument in drupal_write_record() (line 5960 of D:\xampp\htdocs\d71208\includes\common.inc).
Warning: in_array(): Wrong datatype for second argument in drupal_write_record() (line 5960 of D:\xampp\htdocs\d71208\includes\common.inc).
Warning: in_array(): Wrong datatype for second argument in drupal_write_record() (line 5960 of D:\xampp\htdocs\d71208\includes\common.inc).
Warning: in_array(): Wrong datatype for second argument in drupal_write_record() (line 5960 of D:\xampp\htdocs\d71208\includes\common.inc).

hope that this helps
interestingly if you go into available updates commerce is not listed and but when I check back to /#overlay=admin/modules commerce, Product ref, Line item are checked see attached screen shot

Regards

Joe

das-peter’s picture

StatusFileSize
new2.84 KB

Hi,

this issue is related to a change in drupal_write_record.
Instead NULL as empty value array() should be used.
Commerce uses on several locations this construct - what causes the warning:

$op = drupal_write_record('commerce_product_type', $product_type, empty($product_type->is_new) ? 'type' : NULL);

Patch replaces all the NULL values with array()

Cheers
Peter

rszrama’s picture

Thanks a lot, Peter! Joe, if that fixes it for you, I bet we can consider this issue resolved - the unknown field type errors seem to be beyond the scope of Drupal Commerce itself, and as Peter mentioned the drupal_write_record() errors are due to a change in that function that used to accept a NULL value instead of an empty array.

I've committed the patch locally and will get it pushed to CVS as soon as possible.

pieterdc’s picture

I got the same issue, even with commerce drupal 7.x-dev and 7.x-1.0-alpha1, which include fixes from comment #22 as you state in comment #23.

But, I get no error if I firstly install the required (dependency) modules !

Thus, if I choose to install, let's say commerce_cart (after installing only the commerce base module), I get the question if I want to install the required modules (commerce_checkout, commerce_ui, commerce_order, rules, entity_metadata, entity, commerce_line_item, commerce_price, commerce_product, commerce_product_reference, views, commerce_cart)
I agree.
And then I get : FieldException: Attempt to create a field of unknown type commerce_line_item_reference. in field_create_field() (line 297 of /drupal-7.x-dev/modules/field/field.crud.inc).

But, if I firstly install rules, entity and views before I install commerce_cart; no errors appear.

So, it seems to me as it's problem with the order of installing dependent modules.

rszrama’s picture

Cool, thanks for the thorough testing. I'm guessing we need to wait on the issue bojanz mentioned in #17 to go in.

artatac’s picture

Title: Attempt to create a field of unknown type » working - but more feedback

Downloaded and installed the latest d7alpha (released today) and latest commerce etc. Can confirm all installed ok and have created first product via #overlay=admin/commerce/products/add/product. This allowed me to add sku, title and price. save and showing.

Then used #overlay=admin/commerce/products/types/product/fields to add and (existing) image field > went into the first product and added an image

so product exists at /commerce/products/1#overlay=admin/commerce/products/1 but cant see how to 'view/buy' it? I also presume that like the image field you add a cck text description field if you need it?

also /1#overlay=admin/content shown no content despite my toy teddy, is this because product is not a node type anymore?
demo site at
http://venturacottage.homedns.org/d70309/user
logon: wembaster password demo

artatac’s picture

famouse last words - working fine as above > realised I had not added Address_field and enabled customer - so did this and got

FieldException: Attempt to create a field of unknown type <em class="placeholder">addressfield</em>. in field_create_field() (line 297 of D:\xampp\htdocs\d70309\modules\field\field.crud.inc).
rszrama’s picture

Ahh, nice - didn't know there was a new alpha. : )

Will have to catch up now to take advantage of display formatter settings... Obviously look like core still has a problem.

tcmug’s picture

I double #24; I left commerce_cart for last and it worked without any problems.

Previous attempts with auto enabling commerce_cart gave me various errors depending on which module(s) I had left disabled.

/tcmug

rszrama’s picture

Title: working - but more feedback » Attempt to create a field of unknown type
Status: Needs review » Closed (duplicate)

I'm going to mark this a duplicate and point to the issue with a full explanation and attempted patch. No point keeping this one alive any more.

See: #906668: Installation fails when all modules are enabled at once - FieldException errors