I'm trying to find a good way to array variables generated by php into google checkout.
Basically I have php connecting to a mysql DB and it is pulling the data and generating the variables to be base64_encode then sent over the Google checkout (xml)
<?
$OUTPUT_XML = true; /* Show XML or HTML Form */
/**
* Include phpGCheckout configuration file
*
*/
require_once('config.php');
/**
* Your Merchant IDs and Keys here
*/
$merchant_id = 'xxxxx';
$mercant_key = '_xxxxxx';
/**
* Create a new Cart
*/
$GCheckout = new gCart($merchant_id, $mercant_key);
/**
* Add Merchant Checkout Flow Support
*/
$GCheckout->setMerchantCheckoutFlowSupport("http://www.daemonprojects.com.com/timeshare/edit", "http://www.daemonprojects.com.com/timeshare/shopping");
/**
* Create Item
*/
//Database connection
$conn2 = mysql_connect($hostname, $user_name, $user_pass) or die ("<b><center>".mysql_errno().": ".mysql_error()."</b></center>\n");
$db2 = mysql_select_db($database, $conn2) or die ("<b><center>".mysql_errno().": ".mysql_error()."</b></center>\n");
$sql2 = "SELECT * FROM timeshare ORDER BY T_ITEM_NAME ASC";
$result2 = mysql_query($sql2, $conn2) or die ("<b><center>".mysql_errno().": ".mysql_error()."</b></center>\n");
$i=0;
//Loop database records SQL
while ($row_get2 = mysql_fetch_array($result2)){
$i=$i+1;
// GENERATE ITEMS WITH VARIABLE $GET_I
$get_i = new gItem($row_get2["T_ITEM_NAME"], $row_get2["T_ITEM_DESC"], $row_get2["T_ITEM_Q"], $row_get2["T_ITEM_PRICE"]);
}
/**
* Add Shipping
*/
$UPS_GROUND = new gShipping('UPS Ground', 4.00, SHIPPING_FLAT_RATE);
$UPS_GROUND->addAllowedAreas(COUNTRY_AREA_ALL);
$arr_allowed_states = array('FL', 'NY', 'GA', 'CA');
$UPS_2nd_DAY_AIR = new gShipping("UPS 2nd Day Air", 8.20, SHIPPING_FLAT_RATE);
$UPS_2nd_DAY_AIR->addAllowedAreas(null, $arr_allowed_states);
$GCheckout->setShipping(array($UPS_GROUND, $UPS_2nd_DAY_AIR));
// ************ NEED HELP HERE ***************
// Need to add $get_# into the array below
/**
* Add Item to Cart
*/
// Example: $GCheckout->addItems(array($get_1,$get_2,$get_3,$get_4,etc..));
$GCheckout->addItems(array($get_i));
// ******************************************
/**
* Create Default Tax Table
*/
$default_tax_rule = new gTaxRule(0.0775, COUNTRY_AREA_FULL_50);
$default_tax_table = new gTaxTable("Default", array($default_tax_rule), TAX_TABLE_DEFAULT);
$GCheckout->setDefaultTaxTable($default_tax_table);
//if($OUTPUT_XML){
//header('Content-type: text/xml');
// echo $GCheckout->getCart();
//} else {
?>
<form action="https://sandbox.google.com/checkout/cws/v2/Merchant/<?php echo $merchant_id; ?>/checkout" method="post">
<input type="hidden" name="cart" value="<?php echo base64_encode($GCheckout->getCart());?>">
<input type="hidden" name="signature" value="<?php echo base64_encode($GCheckout->getSignature($GCheckout->getCart()));?>">
<input type="image" name="Google Checkout" alt="Fast checkout through Google" src="http://checkout.google.com/buttons/checkout.gif?merchant_id=<?php echo $merchant_id;?>&w=180&h=46
&style=white&variant=text&loc=en_US" height="46" width="180">
</form>
<?php
// }
?>
anyone know how to get the array to work?