Hi,

The bid is a complex object, if you want the numerical money value
inside it you need to unwrap the object, the same way you built it:

  $value = $adGroup->bids->keywordMaxCpc->amount->microAmount;

The AdWords API developer documentation shows these field names and
their types:

  
http://code.google.com/apis/adwords/v2009/docs/reference/AdGroupCriterionService.ManualCPCAdGroupCriterionBids.html

Best,
- Eric

On Feb 19, 4:44 pm, Mike-Indiana <michaelyanda+...@gmail.com> wrote:
> Hi Eric,
>
> Thanks for the reply. I'm running into this error:
> Catchable fatal error: Object of class Bid could not be converted to
> string
>
> On Feb 18, 9:37 am, AdWords API Advisor <adwordsapiadvi...@google.com>
> wrote:
>
>
>
> > Hi,
>
> > You need to retrieve the value the same way you are setting it.  In
> > this case your code should be:
>
> >   $newstatus = $adGroup->bids->keywordMaxCpc;
>
> > Best,
> > - Eric Koleda, AdWords API Team
>
> > On Feb 17, 5:52 pm, "michaelyanda+...@gmail.com" <michaelyanda
>
> > +...@gmail.com> wrote:
> > > Hi, updating an adgroup CPC is completed smoothly, however I am having
> > > problems printing the value.
>
> > > In PHP, my code is: (Please see $newstatus = $adGroup->keywordMaxCpc;)
>
> > >         // Adjust bid to micro format
> > >         $agcpcG = ($cpc * 1000000);
>
> > >         // Create ad group bid.
> > >         $adGroupBids = new ManualCPCAdGroupBids();
> > >         $adGroupBids->keywordMaxCpc = new Bid(new Money($agcpcG));
> > >         $adGroup->bids = $adGroupBids;
>
> > >         // Create operations.
> > >         $operation = new AdGroupOperation();
> > >         $operation->operand = $adGroup;
> > >         $operation->operator = 'SET';
>
> > >         $operations = array($operation);
>
> > >         // Update ad group.
> > >         $result = $adGroupService->mutate($operations);
>
> > >         // Display status
> > >                 if (isset($result->value)) {
> > >                         foreach ($result->value as $adGroup) {
> > >                         $newstatus = $adGroup->keywordMaxCpc;
> > >                         }
> > >                 }
> > >                 else {
> > >                 $newstatus = "Error";
> > >                 }
>
> > > Many thanks.

-- 
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-...@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.

Reply via email to