Hi Joyce,
Thanks, that solved the problem!
I should have read documentation more carefully,
As for my code example if someone will need it, here is the part I missed:
Thanks again!
вторник, 24 мая 2016 г., 19:36:38 UTC+3 пользователь Joyce Lava написал:
-- Thanks, that solved the problem!
I should have read documentation more carefully,
As for my code example if someone will need it, here is the part I missed:
// Map the FeedAttributeIds to the fieldId constants.
$textFieldMapping = new \AttributeFieldMapping();
$textFieldMapping->feedAttributeId = $savedFeed->attributes[0]->id;
$textFieldMapping->fieldId = 1;
$feedMapping = new \FeedMapping();
$feedMapping->placeholderType = $placeholderType;
$feedMapping->feedId = $savedFeed->id;
$feedMapping->attributeFieldMappings = [$textFieldMapping];
// additional field mapping attributes
if (self::EXT_SNIPPET == $type) {
$textFieldMapping2 = new \AttributeFieldMapping();
$textFieldMapping2->feedAttributeId = $savedFeed->attributes[1]->id;
$textFieldMapping2->fieldId = 2;
$feedMapping->attributeFieldMappings[] = $textFieldMapping2;
}
$operation = new \FeedMappingOperation();
$operation->operand = $feedMapping;
$operation->operator = 'ADD';
$operations = [$operation];
вторник, 24 мая 2016 г., 19:36:38 UTC+3 пользователь Joyce Lava написал:
Hi Alex,Sorry for the confusion.I take a look on your codes once again and saw that your doing the FeedMapping for attributeId 1 only. Based on the documentation, there is feedAttributeId "2" that you need to create for feedMapping as well.You are making the "header" attribute which are pre-defined (Types, Brands, etc.). However, you need to create also the "values" to show those information.Using Java client example, I was able to create the Structured Snippet successfully. I did the following code to do the mapping of FeedAttributeIds:// Map the FeedAttributeIds to the fieldId constants.AttributeFieldMapping headerFieldMapping = new AttributeFieldMapping();headerFieldMapping.setFeedAttributeId( structuredSnippetData. headerFeedAttributeId); headerFieldMapping.setFieldId(PLACEHOLDER_FIELD_STRUCTURED_ SNIPPET_HEADER); //PLACEHOLDER_FIELD_ STRUCTURED_SNIPPET_HEADER = 1 AttributeFieldMapping valuesFieldMapping = new AttributeFieldMapping();valuesFieldMapping.setFeedAttributeId( structuredSnippetData. valuesFeedAttributeId); valuesFieldMapping.setFieldId(PLACEHOLDER_FIELD_STRUCTURED_ SNIPPET_VALUES); //PLACEHOLDER_FIELD_ STRUCTURED_SNIPPET_VALUES = 2 // Create the FeedMapping and operation.FeedMapping feedMapping = new FeedMapping();feedMapping.setPlaceholderType( PLACEHOLDER_STRUCTURED_ SNIPPET); feedMapping.setFeedId(structuredSnippetData. structureSnippetFeedId); feedMapping.setAttributeFieldMappings(new AttributeFieldMapping[] { headerFieldMapping, valuesFieldMapping});FeedMappingOperation operation = new FeedMappingOperation();operation.setOperand(feedMapping); operation.setOperator(Operator.ADD); From the PHP code example, you may refer from line 170 to line 194.This means that you need to create feedMapping for attributeId 1 and attributeId 2 to create structured snippet successfully.Please let me know if this explains the solution on your case.Thanks and Regards,Joyce, AdWords API Team
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups "AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/2f981830-599d-4d56-80f6-baecb0c54ead%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment