New fields do not appear in products

Francisco53's picture
Francisco53
Tue, 05/03/2016 - 14:52
#1
New fields do not appear in products

I added new fields in structure / types / shop products, but do not appear in the exibición the product in shop. 

cindy's picture
cindy
Fri, 05/06/2016 - 00:36

Hi,

Please go to sites\all\themes\md_avendor\templates\node and Open file node--shop-product.tpl.php then print the newly-added field 

tannis00's picture
tannis00
Tue, 05/30/2017 - 18:58

Is there no way to add/change fields in the shop_product content type without having to do custom coding each time? Can't I just have it use the display fields that are set up for the content type as is described in the Drupal Commerce documentation?

phuonght's picture
phuonght
Tue, 05/30/2017 - 23:30

Hi,

Can you please explain more? Please send us some screenshots also.

Thank you.

tannis00's picture
tannis00
Wed, 05/31/2017 - 09:49

The template shop product does not have the fields I need. I don't want size, or colour because those reflect a different sku for us, but there are several other fields I need including static fields and lists of taxonomy items. We also have different types of products that would require different sets of fields. I'm not a php programmer (which is why I purchased a theme), so having to go into code to add or remove fields is not what I'm looking for.

phuonght's picture
phuonght
Thu, 06/01/2017 - 06:04

So you need to customize code. there is no option to configure in Drupal.

tannis00's picture
tannis00
Wed, 06/14/2017 - 11:56
I managed to figure it out. I also figured out how to change the code to allow for optional taxonomies. We have ingredients attached to some of our products, but not to others, so it was throwing an error whenenver a product without ingredients was displayed. Here's the code snippet I used in template.php:

//field ingredients
$ingredients_content = '';
$field_ingredients = field_get_items('node', $node, 'field_ingredients');
if($field_ingredients) {
foreach ($field_ingredients as $key => $ingredients_item) {
$ingredients_content .= isset($ingredients_item['taxonomy_term']) ? l($ingredients_item['taxonomy_term']->name, 'taxonomy/term/' . $ingredients_item['taxonomy_term']->tid) : '';
}
}

$vars['ingredients_list'] = $ingredients_content;

Log in or register to post comments
Have More Idea?

We are here to build your website!

No Universal solution fits all special business requirements. Our experienced team is ready with ideas and state-of-the-art technical solutions to consult the best solution within your budget.