I have two product types:
Product (the standard) and the new one: Investment.

They both have a field_image field - and I can find no differences in settings for them.

I then have my product_display and investment_display content types (/nodetypes) - which have a reference to different taxonomy terms.

When I view a taxonomy term - the code automaticly (something I can't disable - annoyingly enough) fetches all nodes that refer to this taxonomy term, and put them in $variables['page']['content']['content']['content']['system_main']['nodes'] (why it's under 3*'content' I don't understand).

The problem, that I think is a bug, is that all nodes of type product_display (which product reference field refer to only product types of type "Product") have a Product:Field_image array - but this is not the case for nodes of type investment_display - even though has the same product reference field (which refers only to product types of type "Investment").

I've attached a dpm dump of $variables['page']['content']['content']['content']['system_main']['nodes'] - as it looks in THEME_preprocess_page.

Also - not all fields in the product referenced from the node is loaded - only SKU, Title and Price (and Field_image on Products) -so it looks as if it's selected somewhere - which fields are loaded into $variables - but I can't seem to find it :(

Also of note - is the product reference field is in the product_display $node - but not in the investment_display node - even though they both have that field (with the same machine name - different settings - for which product types is selectable).

CommentFileSizeAuthor
product-and-own-producttype.png144.26 KBklavs

Comments

klavs’s picture

If I look in the product_reference module - function commerce_product_reference_field_extra_fields() - and dpm $extra at the end - it outputs the $extra array 3 times - all containing both a product_display and an investment_display bundle (kinda odd - since the taxonomy I'm viewing ONLY has 1 node (of type product_display) with a reference to that term) - and both bundles has field_image listed.

Somewhere later on - it disappears.. I've yet to find where that happens.

rszrama’s picture

Category: bug » support
Status: Active » Fixed

What's going on is that adding fields to products doesn't automatically make them show up in product display nodes. If I'm not mistaken, we default every new field to not be shown on purpose. The potential is there thanks to the product reference field's settings, but you need to actually go into the "Manage display" settings for your product display node type and enable the product fields you want to inject into each view mode.

klavs’s picture

Arghh - and I was sure I had checked manage display on both display nodetype and on the product types - obviously not.

Thank you for the help.

rszrama’s picture

No prob! : )

bakulaw’s picture

Sorry for posting this issue here but its somewhat related to my problem, Im new to drupal, how can i assign a file to a commerce file in code? I can't find any example. I'm developing a module that produce a file that i need to create as a product/order and add to cart.

Thank You Very Much

klavs’s picture

Well - no matter - it is not exactly useful to post a comment to a closed issue.

I'd recommend you ask here: http://www.drupalcommerce.org/forum/2

I'd suggest you look into creating a field you can add to your product - that handles this file business.

Status: Fixed » Closed (fixed)

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