Hi!

I am using commerce with marketplace. When I try to edit the product variation types, I get the following errors: I am also using Entity Field Builder (efb) module which makes use of schemaorg.

Notice: Undefined index: rdftype in schemaorg_ui_term_load() (line 216 of /home/antogeorge/public_html/vshop/sites/all/modules/schemaorg/schemaorg_ui/schemaorg_ui.module).
Warning: Invalid argument supplied for foreach() in schemaorg_ui_term_load() (line 222 of /home/antogeorge/public_html/vshop/sites/all/modules/schemaorg/schemaorg_ui/schemaorg_ui.module).

Please help...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

  • scor committed 042b89d on 7.x-1.x
    Issue #2306415 by scor | gonzalves: Fixed Undefined index: rdftype in...
scor’s picture

Title: Undefined index: rdftype in schemaorg_ui_term_load() (line 216 of all/modules/schemaorg/schemaorg_ui/schemaorg_ui.module) and Warning: Invalid argument supplied for foreach() in schemaorg_ui_term_load() (line 222 of schemaorg_ui/schemaorg_ui.module) » Undefined index: rdftype in schemaorg_ui_term_load()
Version: 7.x-1.0-beta4 » 7.x-1.x-dev
Priority: Critical » Normal

Should be fixed now in the dev snapshot which you can download from https://drupal.org/node/1183816 (allow a few hours for it to get rebuilt).

gonzalves’s picture

Hi Scor, thank you for your quick response.. I uninstalled and installed the module and updated the new dev as you suggested.. Still I get the same error.. except that the line number has changed... I am using Schema cache module and that was run by using cron.

Notice: Undefined index: rdftype in schemaorg_ui_term_load() (line 205 of all/modules/schemaorg/modules/schemaorg_ui/schemaorg_ui.module).
Warning: Invalid argument supplied for foreach() in schemaorg_ui_term_load() (line 211 of /all/modules/schemaorg/modules/schemaorg_ui/schemaorg_ui.module).

gonzalves’s picture

Hi Scor, I noticed that I get the error only when I enable efb module. In fact variation types do not have an option to map the schema.org and when we open variation types edit field, it brings up an option to map the field with empty values. Is there a way we can map schema.org under variation types?

scor’s picture

Could you check what code you have at line 205 of all/modules/schemaorg/modules/schemaorg_ui/schemaorg_ui.module? It shouldn't matter what modules you're using, the code I added should avoid this entirely.

scor’s picture

sorry, it's line 204 that I'm interested in seeing actually.

gonzalves’s picture

Do you suggest I come on IRC? The lines are:

204
if ($field == 'rdftype') {

198 -216

/**
* Loads the schema.org term for a particular Drupal field or rdftype.
*/
function schemaorg_ui_term_load($type, $bundle, $field) {
$terms = array();
$mapping = rdf_mapping_load($type, $bundle);
if ($field == 'rdftype') {
$terms = $mapping['rdftype'];
}
elseif (!empty($mapping[$field]['predicates'])) {
$terms = $mapping[$field]['predicates'];
}
// Return the first schema: term.
foreach ($terms as $term) {
if (strpos(trim($term), 'schema:') === 0) {
return str_replace('schema:', '', $term);
}
}
}

scor’s picture

That's what I thought. You don't have the fix. It might be that the release hadn't been rebuilt yet when you downloaded it. Please try now. Alternatively you can use git to get the latest:

 git clone --branch 7.x-1.x scor@git.drupal.org:project/schemaorg.git

(Here is the change you should have in your code if you download the right version)

gonzalves’s picture

Yes, That has fixed the error.. Thank You Scor...

However, the mapping of the metadata fields has not been enabled for variation types.. Are we able to extend the mapping towards Variation types as well??? Thanks again...

scor’s picture

Could you provide more info please? screenshots, steps, etc. I'm not sure I understand.

gonzalves’s picture

Hi Scor, I have added 4 screenshots based on the sequence. In the content type (Display), I have an option to specify the shema and am able to map the fields based on the schema. However, when I create a variation, I do not have an option to map the schema and hence I am not able to choose the fields against the schema. I am using Entity Fields Builder module to have the fields mapped.

scor’s picture

Status: Active » Closed (fixed)

I think this feature should allow you to choose a type for your variation: #2416635: Use Schema.org type on all entity types - please test the patch over there and provide feedback. If you still have problems, please open a new issue, the initial problem as described in the OP is fixed.