List Info

Thread: Re: Private-merchant-data question




Re: Private-merchant-data question
country flaguser name
United States
2007-02-26 20:10:35
Made the changes in my version of the code...  Can't take
the time right
now to do an update from SVN.  But will try to get to it in
a couple of
days....

You missed one thing (I think).  Where you change In
library/googleitem.php:
merchant_private_data to merchant_private_item_data you also
need to
change the 'var' definition above.  Wasn't mentioned in your
post.

Appreciate the quick response....

tony

-----Original Message-----
From: google-checkout-api-integrationgooglegroups.com
[mailto:google-checkout-api-integrationgooglegroups.com] On Behalf Of
GoogleCheckoutDevPro
Sent: Monday, February 26, 2007 5:37 PM
To: Google Checkout Developers Forum - API Integration
Basics
Subject: [google-checkout-api-integration] Re:
Private-merchant-data
question


Thanks Tony,

The changes have been made in the
http://google-checkout-php-sample-code.googlecod
e.com/svn/trunk/
folder.

Could you check the latest files in the /trunk folder,
please?

Otherwise, the following changes should work as well:

1. In library/xml-processing/xmlbuilder.php:

Add the following function:

    function XmlElement($element, $content, $attributes =
array()) {
      $this->_indent();
      $this->xml .= '<'.$element;
      foreach ($attributes as $key => $value) {
        $this->xml .= '
'.$key.'="'.htmlentities($value).'"';
      }
      $this->xml .=
'>'.$content.'</'.$element.'>'."n";
    }


2. In library/googlechart.php:

Replace:
         
$xml_data->Element('merchant-private-item-data',
              $item->merchant_private_item_data);
WITH:
         
$xml_data->XmlElement('merchant-private-item-data',
              $item->merchant_private_item_data);

And

Replace:
        $xml_data->Element('merchant-private-data',
            $this->merchant_private_data);
WITH:
        $xml_data->XmlElement('merchant-private-data',
            $this->merchant_private_data);


3. In library/googleitem.php:

(Occurs twice)

Replace:
  $this->merchant_private_data = $private_data;
With:
  $this->merchant_private_item_data = $private_data;

Please let me know if this doesn't help.

Thanks,
Jacob

On Feb 25, 6:20 pm, "Tony Birnseth" <t...1sit.com> wrote:
> Hi Jacob et.al,
>
> I'm trying to use the merchant-private-data for Item
Options.  When 
> submitted to the GoogleItem() function as the 6th
parameter, 
> everything in that string is being converted to HTML
Special 
> Characters.  Any clue as to why?  And then I'm not
seeing it returned 
> in the $data array within the notification.  I've tried
to use the
> $gItem->SetMerchantPrivateData($privateData)
function but I get an 
> error about calling a member function with a
non-object.
>
> For each item in a cart, I'm creating the item as:
>
>              if( isset($item['options']) ) {
>               $optXML = '';
>               foreach($item['options'] as $optName
=> $optValue) { // 
> Name/value pairs
>                $optXML .= sprintf("
>                 <itemOption>
>                 
<optionName>%s</optionName>
>                 
<optionValue>%s</optionValue>
>                 </itemOption>n", $optName,
$optValue);
>               }
>               $privateData .= $optXML;
>              }
>              $gItem = new
GoogleItem($item['orderItemProductCode'],
> $item['orderItemDesc'], $item['orderItemQty'], 
> $item['orderItemPrice'], 'USD', $privateData);
>          $cart->AddItem(  $gItem );
>
> When I print this by doing:
> echo
'<pre>'.htmlspecialchars($cart->GetXML()).'</pre
>';
> I get:
>
>         ?xml version="1.0"
encoding="utf-8"?>
>         <checkout-shopping-cart
> xmlns="http://
checkout.google.com/schema/2">
>           <shopping-cart>
>             <items>
>               <item>
>                 <item-name>232</item-name>
>                 <item-description>Demo - Product

> Description</item-description>
>                 <unit-price
currency="USD">69.95</unit-price>
>                 <quantity>1</quantity>
>                 <merchant-private-data>
>                                
&lt;itemOption&gt;
>
>
&lt;optionName&gt;year&lt;/optionName&gt;
>
>
&lt;optionValue&gt;7&lt;/optionValue&gt;
>                                
&lt;/itemOption&gt;
>
>                                
&lt;itemOption&gt;
>
>
&lt;optionName&gt;season&lt;/optionName&gt;
>
>
&lt;optionValue&gt;Sum&lt;/optionValue&gt;
>                                
&lt;/itemOption&gt;
>
>                                
&lt;itemOption&gt;
>
>
&lt;optionName&gt;league&lt;/optionName&gt;
>
>
&lt;optionValue&gt;Gld&lt;/optionValue&gt;
>                                
&lt;/itemOption&gt;
>
>                                
&lt;itemOption&gt;
>
>
&lt;optionName&gt;team&lt;/optionName&gt;
>
>
&lt;optionValue&gt;team1&lt;/optionValue&gt;

>                                
&lt;/itemOption&gt;
>         </merchant-private-data>
>               </item>
>             </items>
>           </shopping-cart>
>           <checkout-flow-support>
>             <merchant-checkout-flow-support>
>
> <continue-shopping-url>http:
//www.1sit.com/ezomTest/om/Admin/viewLogs.
> ph
> p</continue-shopping-url>
>               <shipping-methods>
>                 <flat-rate-shipping name="UPS
Ground Residential">
>                   <price
currency="USD">7.65</price>
>                   <shipping-restrictions>
>                     <allowed-areas>
>                       <us-country-area 
>
country-area="ALL"></us-country-area>
>                     </allowed-areas>
>                   </shipping-restrictions>
>                 </flat-rate-shipping>
>                 <flat-rate-shipping name="2nd
Day">
>                   <price
currency="USD">17.595</price>
>                   <shipping-restrictions>
>                     <allowed-areas>
>                       <us-country-area 
>
country-area="ALL"></us-country-area>
>                     </allowed-areas>
>                   </shipping-restrictions>
>                 </flat-rate-shipping>
>               </shipping-methods>
>
>
<request-buyer-phone-number>true</request-buyer-pho
ne-number>
>             </merchant-checkout-flow-support>
>           </checkout-flow-support>
>         </checkout-shopping-cart>






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "API Integration Basics" group.
To post to this group, send email to
google-checkout-api-integrationgooglegroups.com
To unsubscribe from this group, send email to
google-checkout-api-integration-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/google-checko
ut-api-integration?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Private-merchant-data question
country flaguser name
United States
2007-02-26 20:27:25
Ah, right. I forgot to mention about the line with var
$merchant_private_data.

Thanks for pointing it out!

Jacob

On Feb 26, 6:10 pm, "Tony Birnseth" <t...1sit.com> wrote:
> Made the changes in my version of the code...  Can't
take the time right
> now to do an update from SVN.  But will try to get to
it in a couple of
> days....
>
> You missed one thing (I think).  Where you change In
> library/googleitem.php:
> merchant_private_data to merchant_private_item_data you
also need to
> change the 'var' definition above.  Wasn't mentioned in
your post.
>
> Appreciate the quick response....
>
> tony
>
> -----Original Message-----
> From: google-checkout-api-integrationgooglegroups.com
>
> [mailto:google-checkout-api-integrationgooglegroups.com] On Behalf Of
> GoogleCheckoutDevPro
> Sent: Monday, February 26, 2007 5:37 PM
> To: Google Checkout Developers Forum - API Integration
Basics
> Subject: [google-checkout-api-integration] Re:
Private-merchant-data
> question
>
> Thanks Tony,
>
> The changes have been made in thehttp://google-checkout-php-sample-code.googlecod
e.com/svn/trunk/
> folder.
>
> Could you check the latest files in the /trunk folder,
please?
>
> Otherwise, the following changes should work as well:
>
> 1. In library/xml-processing/xmlbuilder.php:
>
> Add the following function:
>
>     function XmlElement($element, $content, $attributes
= array()) {
>       $this->_indent();
>       $this->xml .= '<'.$element;
>       foreach ($attributes as $key => $value) {
>         $this->xml .= '
'.$key.'="'.htmlentities($value).'"';
>       }
>       $this->xml .=
'>'.$content.'</'.$element.'>'."n";
>     }
>
> 2. In library/googlechart.php:
>
> Replace:
>          
$xml_data->Element('merchant-private-item-data',
>               $item->merchant_private_item_data);
> WITH:
>          
$xml_data->XmlElement('merchant-private-item-data',
>               $item->merchant_private_item_data);
>
> And
>
> Replace:
>         $xml_data->Element('merchant-private-data',
>             $this->merchant_private_data);
> WITH:
>        
$xml_data->XmlElement('merchant-private-data',
>             $this->merchant_private_data);
>
> 3. In library/googleitem.php:
>
> (Occurs twice)
>
> Replace:
>   $this->merchant_private_data = $private_data;
> With:
>   $this->merchant_private_item_data =
$private_data;
>
> Please let me know if this doesn't help.
>
> Thanks,
> Jacob
>
> On Feb 25, 6:20 pm, "Tony Birnseth"
<t...1sit.com> wrote:
> > Hi Jacob et.al,
>
> > I'm trying to use the merchant-private-data for
Item Options.  When
> > submitted to the GoogleItem() function as the 6th
parameter,
> > everything in that string is being converted to
HTML Special
> > Characters.  Any clue as to why?  And then I'm not
seeing it returned
> > in the $data array within the notification.  I've
tried to use the
> > $gItem->SetMerchantPrivateData($privateData)
function but I get an
> > error about calling a member function with a
non-object.
>
> > For each item in a cart, I'm creating the item
as:
>
> >              if( isset($item['options']) ) {
> >               $optXML = '';
> >               foreach($item['options'] as $optName
=> $optValue) { //
> > Name/value pairs
> >                $optXML .= sprintf("
> >                 <itemOption>
> >                 
<optionName>%s</optionName>
> >                 
<optionValue>%s</optionValue>
> >                 </itemOption>n",
$optName, $optValue);
> >               }
> >               $privateData .= $optXML;
> >              }
> >              $gItem = new
GoogleItem($item['orderItemProductCode'],
> > $item['orderItemDesc'], $item['orderItemQty'],
> > $item['orderItemPrice'], 'USD', $privateData);
> >          $cart->AddItem(  $gItem );
>
> > When I print this by doing:
> > echo
'<pre>'.htmlspecialchars($cart->GetXML()).'</pre
>';
> > I get:
>
> >         ?xml version="1.0"
encoding="utf-8"?>
> >         <checkout-shopping-cart
> > xmlns="http://
checkout.google.com/schema/2">
> >           <shopping-cart>
> >             <items>
> >               <item>
> >                
<item-name>232</item-name>
> >                 <item-description>Demo -
Product
> > Description</item-description>
> >                 <unit-price
currency="USD">69.95</unit-price>
> >                
<quantity>1</quantity>
> >                 <merchant-private-data>
> >                                
&lt;itemOption&gt;
>
> >
&lt;optionName&gt;year&lt;/optionName&gt;
>
> >
&lt;optionValue&gt;7&lt;/optionValue&gt;
> >                                
&lt;/itemOption&gt;
>
> >                                
&lt;itemOption&gt;
>
> >
&lt;optionName&gt;season&lt;/optionName&gt;
>
> >
&lt;optionValue&gt;Sum&lt;/optionValue&gt;
> >                                
&lt;/itemOption&gt;
>
> >                                
&lt;itemOption&gt;
>
> >
&lt;optionName&gt;league&lt;/optionName&gt;
>
> >
&lt;optionValue&gt;Gld&lt;/optionValue&gt;
> >                                
&lt;/itemOption&gt;
>
> >                                
&lt;itemOption&gt;
>
> >
&lt;optionName&gt;team&lt;/optionName&gt;
>
> >
&lt;optionValue&gt;team1&lt;/optionValue&gt;

> >                                
&lt;/itemOption&gt;
> >         </merchant-private-data>
> >               </item>
> >             </items>
> >           </shopping-cart>
> >           <checkout-flow-support>
> >            
<merchant-checkout-flow-support>
>
> > <continue-shopping-url>http:
//www.1sit.com/ezomTest/om/Admin/viewLogs.
> > ph
> > p</continue-shopping-url>
> >               <shipping-methods>
> >                 <flat-rate-shipping
name="UPS Ground Residential">
> >                   <price
currency="USD">7.65</price>
> >                   <shipping-restrictions>
> >                     <allowed-areas>
> >                       <us-country-area
> >
country-area="ALL"></us-country-area>
> >                     </allowed-areas>
> >                   </shipping-restrictions>
> >                 </flat-rate-shipping>
> >                 <flat-rate-shipping
name="2nd Day">
> >                   <price
currency="USD">17.595</price>
> >                   <shipping-restrictions>
> >                     <allowed-areas>
> >                       <us-country-area
> >
country-area="ALL"></us-country-area>
> >                     </allowed-areas>
> >                   </shipping-restrictions>
> >                 </flat-rate-shipping>
> >               </shipping-methods>
>
> >
<request-buyer-phone-number>true</request-buyer-pho
ne-number>
> >            
</merchant-checkout-flow-support>
> >           </checkout-flow-support>
> >         </checkout-shopping-cart>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "API Integration Basics" group.
To post to this group, send email to
google-checkout-api-integrationgooglegroups.com
To unsubscribe from this group, send email to
google-checkout-api-integration-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/google-checko
ut-api-integration?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )