Hi,

Similar to *ProductBiddingCategory*, when creating a *ProductType* criterion, 
you'll want to pass both:

   1. The product type level (enum) - this is on the type 
   
<https://developers.google.com/adwords/api/docs/reference/v201409/AdGroupCriterionService.ProductType#type>
 attribute 
   and should match one of the *PRODUCT_TYPE_Lx* enums of 
   ProductDimensionType 
   
<https://developers.google.com/adwords/api/docs/reference/v201409/AdGroupCriterionService.ProductDimensionType>
   2. The product type value (string) - this is on the value 
   
<https://developers.google.com/adwords/api/docs/reference/v201409/AdGroupCriterionService.ProductType#value>
    attribute

In your calls to the *ProductType* constructor you are only passing the 
*value*, but the constructor expects the type and the value, in that order. 
For example, for your "shirts" product type, you could modify your 
constructor call to:

new ProductType('PRODUCT_TYPE_L1', 'shirts')

Please give that a try and let me know if you're still running into errors.

Cheers,
Josh, AdWords API Team

On Friday, November 21, 2014 9:21:30 AM UTC-5, Sarah Gilmore wrote:
>
> 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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@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+unsubscr...@googlegroups.com.
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/facf64b8-14f5-4b7a-8efc-0343047ea6a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to