Hi there
I'm having trouble getting the Product Partition script to work in PHP. I'm
using the example in the SDK. I've solved some errors by creating a new
Adgroup from scratch within the API, but I get the following exception when
I run the script:
An error has occurred: Unmarshalling Error: cvc-enumeration-valid: Value
'shirts' is not facet-valid with respect to enumeration '[UNKNOWN,
BIDDING_CATEGORY_L1, BIDDING_CATEGORY_L2, BIDDING_CATEGORY_L3,
BIDDING_CATEGORY_L4, BIDDING_CATEGORY_L5, BRAND, CANONICAL_CONDITION,
CUSTOM_ATTRIBUTE_0, CUSTOM_ATTRIBUTE_1, CUSTOM_ATTRIBUTE_2,
CUSTOM_ATTRIBUTE_3, CUSTOM_ATTRIBUTE_4, OFFER_ID, PRODUCT_TYPE_L1,
PRODUCT_TYPE_L2, PRODUCT_TYPE_L3, PRODUCT_TYPE_L4, PRODUCT_TYPE_L5]'
I'm assuming this means that I'm entering invalid categories/making an
invalid tree but I can't work out how. I've checked that the categories I'm
using are in the product feed. I don't work much with Adwords itself - just
the API - so any advice would be appreciated
*function addProductPartitionTreeExample(AdWordsUser $user, $adGroupId) {*
* // Get the AdGroupCriterionService, which loads the required classes.*
* $adGroupCriterionService = $user->GetService('AdGroupCriterionService',*
* ADWORDS_VERSION);*
* $helper = new ProductPartitionHelper($adGroupId);*
* // The most trivial partition tree has only a unit node as the root:*
* // $helper->createUnit(null, null, 100000);*
* $root = $helper->createSubdivision();*
* $helper->createUnit($root, new ProductCanonicalCondition('NEW'),
200000);*
* $helper->createUnit($root, new ProductCanonicalCondition('USED'),
100000);*
* $otherCondition = $helper->createSubdivision($root,*
* new ProductCanonicalCondition());*
* $helper->createUnit($otherCondition, new ProductType('shirts'), 200000);*
* $helper->createUnit($otherCondition, new ProductType('footwear'),
100000);*
* $otherBrand =*
* $helper->createSubdivision($otherCondition, new ProductType());*
* // The value for the bidding category is a fixed ID for the 'Luggage &
Bags'*
* // category. You can retrieve IDs for categories from the
ConstantDataService.*
* // See the 'GetProductCategoryTaxonomy' example for more details.*
* $helper->createUnit($otherBrand,*
* new ProductBiddingCategory('BIDDING_CATEGORY_L1',*
* '-3817140941569278349'), 750000);//for clothes*
* $helper->createUnit($otherBrand,*
* new ProductBiddingCategory('BIDDING_CATEGORY_L1'), 110000);*
* // Make the mutate request.*
* $result = $adGroupCriterionService->mutate($helper->getOperations());*
* $children = array();*
* $rootNode = null;*
* // For each criterion, make an array containing each of its children*
* // We always create the parent before the child, so we can rely on that
here*
* foreach ($result->value as $adGroupCriterion) {*
* $children[$adGroupCriterion->criterion->id] = array();*
* if (isset($adGroupCriterion->criterion->parentCriterionId)) {*
* $children[$adGroupCriterion->criterion->parentCriterionId][] =*
* $adGroupCriterion->criterion;*
* } else {*
* $rootNode = $adGroupCriterion->criterion;*
* }*
* }*
* // Show the tree*
* displayTree($rootNode, $children);*
*}*
Thanks
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/042ce4cf-9b60-485c-accc-9ea3671131df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.