Hi. I'm struggeling with making a subdivision to a brand. Can you provide 
full example of you code? It seems you found a solution to what I'm trying 
to do. 

mandag den 4. marts 2019 kl. 12.18.32 UTC+1 skrev ry...@n-i-e.co.uk:
>
> thanks for the support, I tried your solution of setting the ID but I was 
> getting issues because of *new ProductPartition(); *I was creating the 
> partition using *$root = ProductPartitions::createSubdivision(); *so 
> having *use Google\AdsApi\AdWords\v201806\cm\ProductPartition; *caused 
> conflicts. 
>
> I got around this by reading the response *e.g *$all_ids = 
> ProductPartitions::showAdGroupTree($adWordsServices,$session,$adGroupId);
>
> I then did explode to get the ID of the partition I needed. 
>
> I had another issue as *ProductPartitions::createUnit *only allows for an 
> object to be passed not a partition ID so I created an almost identical 
> function which could read the ID not Object.
>
> I now have 2 functions in my API code (ProductPartitions.php) for Creating 
> Units. 
>
>     
>     public static function createUnit(
>         ProductPartition $parent = null,
>         ProductDimension $value = null
>     ) {
>         $unit = new ProductPartition();
>         $unit->setPartitionType(ProductPartitionType::UNIT);
>
>         // The root node has neither a parent nor a value
>         if ($parent !== null) {
>             $unit->setParentCriterionId($parent->getId());
>             $unit->setCaseValue($value);
>         }
>
>         return $unit;
>     }
>     public static function createUnit2($parent,$value) {
>         $unit = new ProductPartition();
>         $unit->setPartitionType(ProductPartitionType::UNIT);
>
>         // The root node has neither a parent nor a value
>             $unit->setParentCriterionId($parent);
>             $unit->setCaseValue($value);
>
>         return $unit;
>     }
>
>
>
>
>
> On Friday, 1 March 2019 19:34:41 UTC, ry...@n-i-e.co.uk wrote:
>>
>> Hi, 
>>
>> I am currently trying to update our Shopping campaign through the Google 
>> Ad's API and so far so good. 
>>
>> I have a bit of an issue when hitting over 5000 requests. I am aware that 
>> there is a 5000 limit per request and I'm not too far off we have 5,600ish 
>> products in the shopping that I want on the Ad Campaign. 
>>
>>
>> Problem is I create the Ad Group and Partitions at the top of my script 
>> with this code: 
>>
>>                         
>>                         $operations = [];
>> $root = *ProductPartitions::createSubdivision(); ///This is what I think 
>> is causing the problem,*
>> $criterion = ProductPartitions::asBiddableAdGroupCriterion($adGroupId, 
>> $root);
>> $operation = ProductPartitions::createAddOperation($criterion);
>> $operations[] = $operation;
>> $otherCondition = ProductPartitions::createSubdivision(
>> $root,
>> new ProductCanonicalCondition()
>> );
>> $criterion = ProductPartitions::asBiddableAdGroupCriterion(
>> $adGroupId,
>> $otherCondition
>> );
>> $operation = ProductPartitions::createAddOperation($criterion);
>> $operations[] = $operation;
>>   
>> $otherBrand = ProductPartitions::createSubdivision(
>> $otherCondition,
>> new ProductOfferId()
>> );
>> $criterion = ProductPartitions::asBiddableAdGroupCriterion(
>> $adGroupId,
>> $otherBrand
>> );
>> $operation = ProductPartitions::createAddOperation($criterion);
>> $operations[] = $operation;
>> $productBiddingCategory = new ProductBiddingCategory();
>>
>> $productBiddingCategory->setType(ProductDimensionType::BIDDING_CATEGORY_L1);
>> $productBiddingCategoryUnit = ProductPartitions::createUnit($otherBrand, 
>> $productBiddingCategory);
>> $criterion = ProductPartitions::asBiddableAdGroupCriterion(
>> $adGroupId,
>> $productBiddingCategoryUnit,
>> 10000
>> );
>> $operation = ProductPartitions::createAddOperation($criterion);
>> $operations[] = $operation;
>>
>>
>>
>> After I send the first 5000 operations I try to do another loop to send 
>> another 1400ish, the problem is where I run this code
>>
>>
>>                         $cheapBrand = new ProductOfferId(); 
>> $cheapBrand->setValue($sku); 
>> $cheapBrandUnit = ProductPartitions::createUnit(*$root*, $cheapBrand); 
>> *///Where 
>> this line says $root I think it's trying to re-create $root rather than get 
>> the previously created.*
>> $criterion = ProductPartitions::asBiddableAdGroupCriterion(
>> $adGroupId,
>> $cheapBrandUnit,
>>         $bid_trans
>> );
>>         $operation = ProductPartitions::createAddOperation($criterion);
>> $operations[] = $operation; 
>>  
>>
>> It seems because I don't store the $root object the code tries to 
>> re-create and then fails with error: 
>>
>>
>>  AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ 
>> operations[1].operand.criterion.parentCriterionId; 
>>  
>>
>> I can't delete and rebuild the Root partition as I just want to add to 
>> the existing 5000 request so in total there are 2 requests to build the 
>> partitions. 
>>
>>
>>
>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads 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 and Google Ads 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 https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/d5bb97f5-47f3-4803-a52d-f6f897f033cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • Re: How... Hans Henrik Søllested
    • RE... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum

Reply via email to