List Info

Thread: Re: Private-merchant-data question




Re: Private-merchant-data question
country flaguser name
United States
2007-02-26 19:53:14
I'll look at it tonight....

Have another fix for you in the XmlParser() code.

In the function UpdateRecursive($vals), you need to add a
line (first
line of function) of:
	$params = array();

Under certain conditions (outside GC) the last line of the
function:
	return $params;
$params comes up as an undefined variable.  Should always
initialize
variables, especially those that are return()'d.

Does this mean that I'm the only one on the planet who has
tried to use
the merchant-private-item-data?  How are others handling
item options?

tony 
www.ez-order-manager.com

-----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
-~----------~----~----~----~------~----~------~--~---


[1]

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